Commit 0d959156 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Sync: Small cleanups in ServerConnectionManager

Bug: 842096
Change-Id: I43334b71da4ff0542f3f7c028f05dec860a2b0c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1559149
Auto-Submit: Marc Treib <treib@chromium.org>
Commit-Queue: Jan Krcal <jkrcal@chromium.org>
Reviewed-by: default avatarJan Krcal <jkrcal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#649121}
parent cd2d185e
......@@ -7,7 +7,6 @@
#include <errno.h>
#include <ostream>
#include <vector>
#include "base/metrics/histogram.h"
#include "build/build_config.h"
......@@ -22,25 +21,19 @@
namespace syncer {
using std::ostream;
using std::string;
using std::vector;
static const char kSyncServerSyncPath[] = "/command/";
namespace {
HttpResponse::HttpResponse()
: http_status_code(kUnsetResponseCode),
content_length(kUnsetContentLength),
payload_length(kUnsetPayloadLength),
server_status(NONE) {}
const char kSyncServerSyncPath[] = "/command/";
#define ENUM_CASE(x) \
case x: \
return #x; \
#define ENUM_CASE(x) \
case HttpResponse::x: \
return #x; \
break
const char* HttpResponse::GetServerConnectionCodeString(
ServerConnectionCode code) {
const char* GetServerConnectionCodeString(
HttpResponse::ServerConnectionCode code) {
switch (code) {
ENUM_CASE(NONE);
ENUM_CASE(CONNECTION_UNAVAILABLE);
......@@ -55,6 +48,15 @@ const char* HttpResponse::GetServerConnectionCodeString(
#undef ENUM_CASE
} // namespace
HttpResponse::HttpResponse()
: net_error_code(-1),
http_status_code(-1),
content_length(-1),
payload_length(-1),
server_status(NONE) {}
ServerConnectionManager::Connection::Connection(ServerConnectionManager* scm)
: scm_(scm) {}
......@@ -264,8 +266,7 @@ ServerConnectionManager::MakeConnection() {
std::ostream& operator<<(std::ostream& s, const struct HttpResponse& hr) {
s << " Response Code (bogus on error): " << hr.http_status_code;
s << " Content-Length (bogus on error): " << hr.content_length;
s << " Server Status: "
<< HttpResponse::GetServerConnectionCodeString(hr.server_status);
s << " Server Status: " << GetServerConnectionCodeString(hr.server_status);
return s;
}
......
......@@ -11,23 +11,15 @@
#include <memory>
#include <string>
#include "base/atomicops.h"
#include "base/macros.h"
#include "base/observer_list.h"
#include "base/sequence_checker.h"
#include "base/strings/string_util.h"
#include "base/synchronization/lock.h"
#include "components/sync/base/cancelation_observer.h"
#include "components/sync/syncable/syncable_id.h"
namespace syncer {
class CancelationSignal;
static const int32_t kUnsetResponseCode = -1;
static const int32_t kUnsetContentLength = -1;
static const int32_t kUnsetPayloadLength = -1;
// HttpResponse gathers the relevant output properties of an HTTP request.
// Depending on the value of the server_status code, response_code, and
// content_length may not be valid.
......@@ -70,8 +62,6 @@ struct HttpResponse {
ServerConnectionCode server_status;
HttpResponse();
static const char* GetServerConnectionCodeString(ServerConnectionCode code);
};
struct ServerConnectionEvent {
......
......@@ -11,6 +11,7 @@
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "components/sync/base/cancelation_observer.h"
#include "components/sync/engine_impl/net/server_connection_manager.h"
namespace syncer {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment