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

Unified Diff: components/sync_driver/generic_change_processor.cc

Issue 302173004: sync: Specialize functions that fetch type root (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/GET_BY_SERVER_TAG_DEPRECATED/GET_BY_SERVER_TAG/ Created 6 years, 7 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_driver/generic_change_processor.cc
diff --git a/components/sync_driver/generic_change_processor.cc b/components/sync_driver/generic_change_processor.cc
index 6341ab296c2d8733dc88156fe0c1905ac098c380..7d8ef4d82801977a079dcf48bfc7f8a061a3645d 100644
--- a/components/sync_driver/generic_change_processor.cc
+++ b/components/sync_driver/generic_change_processor.cc
@@ -223,8 +223,7 @@ syncer::SyncError GenericChangeProcessor::GetAllSyncDataReturnError(
std::string type_name = syncer::ModelTypeToString(type);
syncer::ReadTransaction trans(FROM_HERE, share_handle());
syncer::ReadNode root(&trans);
- if (root.InitByTagLookup(syncer::ModelTypeToRootTag(type)) !=
- syncer::BaseNode::INIT_OK) {
+ if (root.InitTypeRoot(type) != syncer::BaseNode::INIT_OK) {
syncer::SyncError error(FROM_HERE,
syncer::SyncError::DATATYPE_ERROR,
"Server did not create the top-level " + type_name +
@@ -276,8 +275,7 @@ bool GenericChangeProcessor::GetDataTypeContext(syncer::ModelType type,
int GenericChangeProcessor::GetSyncCountForType(syncer::ModelType type) {
syncer::ReadTransaction trans(FROM_HERE, share_handle());
syncer::ReadNode root(&trans);
- if (root.InitByTagLookup(syncer::ModelTypeToRootTag(type)) !=
- syncer::BaseNode::INIT_OK)
+ if (root.InitTypeRoot(type) != syncer::BaseNode::INIT_OK)
return 0;
// Subtract one to account for type's root node.
@@ -495,8 +493,8 @@ syncer::SyncError GenericChangeProcessor::HandleActionAdd(
// etc.).
syncer::ReadNode root_node(&trans);
const syncer::SyncDataLocal sync_data_local(change.sync_data());
- if (root_node.InitByTagLookup(syncer::ModelTypeToRootTag(
- sync_data_local.GetDataType())) != syncer::BaseNode::INIT_OK) {
+ if (root_node.InitTypeRoot(sync_data_local.GetDataType()) !=
+ syncer::BaseNode::INIT_OK) {
syncer::SyncError error(FROM_HERE,
syncer::SyncError::DATATYPE_ERROR,
"Failed to look up root node for type " + type_str,
@@ -704,8 +702,7 @@ bool GenericChangeProcessor::SyncModelHasUserCreatedNodes(
*has_nodes = false;
syncer::ReadTransaction trans(FROM_HERE, share_handle());
syncer::ReadNode type_root_node(&trans);
- if (type_root_node.InitByTagLookup(syncer::ModelTypeToRootTag(type)) !=
- syncer::BaseNode::INIT_OK) {
+ if (type_root_node.InitTypeRoot(type) != syncer::BaseNode::INIT_OK) {
LOG(ERROR) << err_str;
return false;
}

Powered by Google App Engine
This is Rietveld 408576698