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

Unified Diff: chrome/browser/sync/glue/generic_change_processor.cc

Issue 217063005: Separate SyncData methods into three groups, local, remote, and common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@syncapi
Patch Set: Remove AsLocal and AsRemote methods from SyncData. Created 6 years, 9 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: chrome/browser/sync/glue/generic_change_processor.cc
diff --git a/chrome/browser/sync/glue/generic_change_processor.cc b/chrome/browser/sync/glue/generic_change_processor.cc
index 36811d4d966d232ff9634cd3e2d350b67ffd2710..bc3d58900376a201eace28c8ac6d882996c901b0 100644
--- a/chrome/browser/sync/glue/generic_change_processor.cc
+++ b/chrome/browser/sync/glue/generic_change_processor.cc
@@ -291,7 +291,7 @@ syncer::SyncError AttemptDelete(
DataTypeErrorHandler* error_handler) {
DCHECK_EQ(change.change_type(), syncer::SyncChange::ACTION_DELETE);
if (change.sync_data().IsLocal()) {
- const std::string& tag = change.sync_data().GetTag();
+ const std::string& tag = syncer::SyncDataLocal(change.sync_data()).GetTag();
if (tag.empty()) {
syncer::SyncError error(
FROM_HERE,
@@ -315,8 +315,8 @@ syncer::SyncError AttemptDelete(
type, error_handler);
}
} else {
- syncer::BaseNode::InitByLookupResult result =
- node->InitByIdLookup(change.sync_data().GetRemoteId());
+ syncer::BaseNode::InitByLookupResult result = node->InitByIdLookup(
+ syncer::SyncDataRemote(change.sync_data()).GetId());
if (result != syncer::BaseNode::INIT_OK) {
return LogLookupFailure(
result, FROM_HERE,
@@ -415,9 +415,10 @@ syncer::SyncError GenericChangeProcessor::HandleActionAdd(
return error;
}
syncer::WriteNode::InitUniqueByCreationResult result =
- sync_node->InitUniqueByCreation(change.sync_data().GetDataType(),
- root_node,
- change.sync_data().GetTag());
+ sync_node->InitUniqueByCreation(
+ change.sync_data().GetDataType(),
+ root_node,
+ syncer::SyncDataLocal(change.sync_data()).GetTag());
if (result != syncer::WriteNode::INIT_SUCCESS) {
std::string error_prefix = "Failed to create " + type_str + " node: " +
change.location().ToString() + ", ";
@@ -485,8 +486,9 @@ syncer::SyncError GenericChangeProcessor::HandleActionUpdate(
syncer::WriteNode* sync_node) {
// TODO(zea): consider having this logic for all possible changes?
syncer::BaseNode::InitByLookupResult result =
- sync_node->InitByClientTagLookup(change.sync_data().GetDataType(),
- change.sync_data().GetTag());
+ sync_node->InitByClientTagLookup(
+ change.sync_data().GetDataType(),
+ syncer::SyncDataLocal(change.sync_data()).GetTag());
if (result != syncer::BaseNode::INIT_OK) {
std::string error_prefix = "Failed to load " + type_str + " node. " +
change.location().ToString() + ", ";

Powered by Google App Engine
This is Rietveld 408576698