Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Unified Diff: components/sync/engine_impl/syncer_proto_util.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/sync/engine_impl/syncer_proto_util.cc
diff --git a/sync/engine/syncer_proto_util.cc b/components/sync/engine_impl/syncer_proto_util.cc
similarity index 92%
rename from sync/engine/syncer_proto_util.cc
rename to components/sync/engine_impl/syncer_proto_util.cc
index 66c40130e2d4b8d8b6456f7010032a68eea03cdd..f39811a2eb33003ff9c9e6111e54731a0f2d77a8 100644
--- a/sync/engine/syncer_proto_util.cc
+++ b/components/sync/engine_impl/syncer_proto_util.cc
@@ -2,26 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sync/engine/syncer_proto_util.h"
+#include "components/sync/engine_impl/syncer_proto_util.h"
#include <map>
#include "base/format_macros.h"
#include "base/strings/stringprintf.h"
+#include "components/sync/base/model_type.h"
+#include "components/sync/base/time.h"
+#include "components/sync/engine_impl/net/server_connection_manager.h"
+#include "components/sync/engine_impl/syncer.h"
+#include "components/sync/engine_impl/syncer_types.h"
+#include "components/sync/engine_impl/traffic_logger.h"
+#include "components/sync/protocol/sync_enums.pb.h"
+#include "components/sync/protocol/sync_protocol_error.h"
+#include "components/sync/sessions_impl/sync_session.h"
+#include "components/sync/syncable/directory.h"
+#include "components/sync/syncable/entry.h"
+#include "components/sync/syncable/syncable-inl.h"
+#include "components/sync/syncable/syncable_proto_util.h"
#include "google_apis/google_api_keys.h"
-#include "sync/engine/net/server_connection_manager.h"
-#include "sync/engine/syncer.h"
-#include "sync/engine/syncer_types.h"
-#include "sync/engine/traffic_logger.h"
-#include "sync/internal_api/public/base/model_type.h"
-#include "sync/protocol/sync_enums.pb.h"
-#include "sync/protocol/sync_protocol_error.h"
-#include "sync/sessions/sync_session.h"
-#include "sync/syncable/directory.h"
-#include "sync/syncable/entry.h"
-#include "sync/syncable/syncable-inl.h"
-#include "sync/syncable/syncable_proto_util.h"
-#include "sync/util/time.h"
using std::string;
using std::stringstream;
@@ -226,8 +226,7 @@ SyncProtocolError ConvertErrorPBToSyncProtocolError(
// In both cases, |error_data_types| are throttled.
for (int i = 0; i < error.error_data_type_ids_size(); ++i) {
int field_number = error.error_data_type_ids(i);
- ModelType model_type =
- GetModelTypeFromSpecificsFieldNumber(field_number);
+ ModelType model_type = GetModelTypeFromSpecificsFieldNumber(field_number);
if (!IsRealDataType(model_type)) {
DLOG(WARNING) << "Unknown field number " << field_number;
continue;
@@ -243,7 +242,6 @@ SyncProtocolError ConvertErrorPBToSyncProtocolError(
bool SyncerProtoUtil::VerifyResponseBirthday(
const ClientToServerResponse& response,
syncable::Directory* dir) {
-
std::string local_birthday = dir->store_birthday();
if (local_birthday.empty()) {
@@ -369,7 +367,7 @@ SyncerError SyncerProtoUtil::PostClientToServerMessage(
SyncSession* session,
ModelTypeSet* partial_failure_data_types) {
CHECK(response);
- DCHECK(!msg->get_updates().has_from_timestamp()); // Deprecated.
+ DCHECK(!msg->get_updates().has_from_timestamp()); // Deprecated.
DCHECK(!msg->get_updates().has_requested_types()); // Deprecated.
// Add must-have fields.
@@ -476,8 +474,7 @@ SyncerError SyncerProtoUtil::PostClientToServerMessage(
} else {
DLOG(WARNING) << "Some types throttled by syncer.";
session->delegate()->OnTypesThrottled(
- sync_protocol_error.error_data_types,
- GetThrottleDelay(*response));
+ sync_protocol_error.error_data_types, GetThrottleDelay(*response));
}
return SERVER_RETURN_THROTTLED;
case TRANSIENT_ERROR:
@@ -518,8 +515,8 @@ bool SyncerProtoUtil::ShouldMaintainPosition(
const sync_pb::SyncEntity& sync_entity) {
// Maintain positions for bookmarks that are not server-defined top-level
// folders.
- return GetModelType(sync_entity) == BOOKMARKS
- && !(sync_entity.folder() &&
+ return GetModelType(sync_entity) == BOOKMARKS &&
+ !(sync_entity.folder() &&
!sync_entity.server_defined_unique_tag().empty());
}
@@ -548,7 +545,8 @@ const std::string& SyncerProtoUtil::NameFromCommitEntryResponse(
}
// static
-void SyncerProtoUtil::PersistBagOfChips(syncable::Directory* dir,
+void SyncerProtoUtil::PersistBagOfChips(
+ syncable::Directory* dir,
const sync_pb::ClientToServerResponse& response) {
if (!response.has_new_bag_of_chips())
return;
@@ -565,18 +563,19 @@ std::string SyncerProtoUtil::SyncEntityDebugString(
GetTimeDebugString(ProtoTimeToTime(entry.ctime()));
return base::StringPrintf(
"id: %s, parent_id: %s, "
- "version: %" PRId64"d, "
- "mtime: %" PRId64"d (%s), "
- "ctime: %" PRId64"d (%s), "
- "name: %s, sync_timestamp: %" PRId64"d, "
+ "version: %" PRId64
+ "d, "
+ "mtime: %" PRId64
+ "d (%s), "
+ "ctime: %" PRId64
+ "d (%s), "
+ "name: %s, sync_timestamp: %" PRId64
+ "d, "
"%s ",
- entry.id_string().c_str(),
- entry.parent_id_string().c_str(),
- entry.version(),
- entry.mtime(), mtime_str.c_str(),
- entry.ctime(), ctime_str.c_str(),
- entry.name().c_str(), entry.sync_timestamp(),
- entry.deleted() ? "deleted, ":"");
+ entry.id_string().c_str(), entry.parent_id_string().c_str(),
+ entry.version(), entry.mtime(), mtime_str.c_str(), entry.ctime(),
+ ctime_str.c_str(), entry.name().c_str(), entry.sync_timestamp(),
+ entry.deleted() ? "deleted, " : "");
}
namespace {
« no previous file with comments | « components/sync/engine_impl/syncer_proto_util.h ('k') | components/sync/engine_impl/syncer_proto_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698