| Index: components/sync/engine_impl/net/server_connection_manager.cc
|
| diff --git a/sync/engine/net/server_connection_manager.cc b/components/sync/engine_impl/net/server_connection_manager.cc
|
| similarity index 88%
|
| rename from sync/engine/net/server_connection_manager.cc
|
| rename to components/sync/engine_impl/net/server_connection_manager.cc
|
| index b496f5b674bd0a28d1420374f60da77d4bf2faec..4386eb74e4a21441f5bcdbfbdb779524c04e46c0 100644
|
| --- a/sync/engine/net/server_connection_manager.cc
|
| +++ b/components/sync/engine_impl/net/server_connection_manager.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "sync/engine/net/server_connection_manager.h"
|
| +#include "components/sync/engine_impl/net/server_connection_manager.h"
|
|
|
| #include <errno.h>
|
| #include <stdint.h>
|
| @@ -13,13 +13,13 @@
|
|
|
| #include "base/metrics/histogram.h"
|
| #include "build/build_config.h"
|
| +#include "components/sync/base/cancelation_signal.h"
|
| +#include "components/sync/engine_impl/net/url_translator.h"
|
| +#include "components/sync/engine_impl/syncer.h"
|
| +#include "components/sync/protocol/sync.pb.h"
|
| +#include "components/sync/syncable/directory.h"
|
| #include "net/base/net_errors.h"
|
| #include "net/http/http_status_code.h"
|
| -#include "sync/engine/net/url_translator.h"
|
| -#include "sync/engine/syncer.h"
|
| -#include "sync/internal_api/public/base/cancelation_signal.h"
|
| -#include "sync/protocol/sync.pb.h"
|
| -#include "sync/syncable/directory.h"
|
| #include "url/gurl.h"
|
|
|
| namespace syncer {
|
| @@ -36,7 +36,10 @@ HttpResponse::HttpResponse()
|
| payload_length(kUnsetPayloadLength),
|
| server_status(NONE) {}
|
|
|
| -#define ENUM_CASE(x) case x: return #x; break
|
| +#define ENUM_CASE(x) \
|
| + case x: \
|
| + return #x; \
|
| + break
|
|
|
| const char* HttpResponse::GetServerConnectionCodeString(
|
| ServerConnectionCode code) {
|
| @@ -55,12 +58,10 @@ const char* HttpResponse::GetServerConnectionCodeString(
|
|
|
| #undef ENUM_CASE
|
|
|
| -ServerConnectionManager::Connection::Connection(
|
| - ServerConnectionManager* scm) : scm_(scm) {
|
| -}
|
| +ServerConnectionManager::Connection::Connection(ServerConnectionManager* scm)
|
| + : scm_(scm) {}
|
|
|
| -ServerConnectionManager::Connection::~Connection() {
|
| -}
|
| +ServerConnectionManager::Connection::~Connection() {}
|
|
|
| bool ServerConnectionManager::Connection::ReadBufferResponse(
|
| string* buffer_out,
|
| @@ -90,8 +91,8 @@ bool ServerConnectionManager::Connection::ReadDownloadResponse(
|
| ReadResponse(buffer_out, static_cast<int>(response->content_length));
|
|
|
| if (bytes_read != response->content_length) {
|
| - LOG(ERROR) << "Mismatched content lengths, server claimed " <<
|
| - response->content_length << ", but sent " << bytes_read;
|
| + LOG(ERROR) << "Mismatched content lengths, server claimed "
|
| + << response->content_length << ", but sent " << bytes_read;
|
| response->server_status = HttpResponse::IO_ERROR;
|
| return false;
|
| }
|
| @@ -99,7 +100,8 @@ bool ServerConnectionManager::Connection::ReadDownloadResponse(
|
| }
|
|
|
| ServerConnectionManager::ScopedConnectionHelper::ScopedConnectionHelper(
|
| - ServerConnectionManager* manager, Connection* connection)
|
| + ServerConnectionManager* manager,
|
| + Connection* connection)
|
| : manager_(manager), connection_(connection) {}
|
|
|
| ServerConnectionManager::ScopedConnectionHelper::~ScopedConnectionHelper() {
|
| @@ -240,9 +242,9 @@ void ServerConnectionManager::SetServerStatus(
|
|
|
| void ServerConnectionManager::NotifyStatusChanged() {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| - FOR_EACH_OBSERVER(ServerConnectionEventListener, listeners_,
|
| - OnServerConnectionEvent(
|
| - ServerConnectionEvent(server_status_)));
|
| + FOR_EACH_OBSERVER(
|
| + ServerConnectionEventListener, listeners_,
|
| + OnServerConnectionEvent(ServerConnectionEvent(server_status_)));
|
| }
|
|
|
| bool ServerConnectionManager::PostBufferWithCachedAuth(
|
| @@ -281,8 +283,8 @@ bool ServerConnectionManager::PostBufferToPath(PostBufferParams* params,
|
|
|
| // Note that |post| may be aborted by now, which will just cause Init to fail
|
| // with CONNECTION_UNAVAILABLE.
|
| - bool ok = post.get()->Init(
|
| - path.c_str(), auth_token, params->buffer_in, ¶ms->response);
|
| + bool ok = post.get()->Init(path.c_str(), auth_token, params->buffer_in,
|
| + ¶ms->response);
|
|
|
| if (params->response.server_status == HttpResponse::SYNC_AUTH_ERROR) {
|
| InvalidateAndClearAuthToken();
|
| @@ -291,8 +293,8 @@ bool ServerConnectionManager::PostBufferToPath(PostBufferParams* params,
|
| if (!ok || net::HTTP_OK != params->response.response_code)
|
| return false;
|
|
|
| - if (post.get()->ReadBufferResponse(
|
| - ¶ms->buffer_out, ¶ms->response, true)) {
|
| + if (post.get()->ReadBufferResponse(¶ms->buffer_out, ¶ms->response,
|
| + true)) {
|
| params->response.server_status = HttpResponse::SERVER_CONNECTION_OK;
|
| return true;
|
| }
|
| @@ -326,7 +328,7 @@ void ServerConnectionManager::OnSignalReceived() {
|
| active_connection_ = NULL;
|
| }
|
|
|
| -std::ostream& operator << (std::ostream& s, const struct HttpResponse& hr) {
|
| +std::ostream& operator<<(std::ostream& s, const struct HttpResponse& hr) {
|
| s << " Response Code (bogus on error): " << hr.response_code;
|
| s << " Content-Length (bogus on error): " << hr.content_length;
|
| s << " Server Status: "
|
|
|