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

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

Issue 14667013: sync: Better iteration in GenericChangeProcessor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Undo unnecessary change Created 7 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: 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 38d952c8aba976adac574958237e1b2ade32a48f..41a14110f8d9dbf9c70050bb667b523d835c5033 100644
--- a/chrome/browser/sync/glue/generic_change_processor.cc
+++ b/chrome/browser/sync/glue/generic_change_processor.cc
@@ -116,10 +116,13 @@ syncer::SyncError GenericChangeProcessor::GetSyncDataForType(
// TODO(akalin): We'll have to do a tree traversal for bookmarks.
DCHECK_NE(type, syncer::BOOKMARKS);
- int64 sync_child_id = root.GetFirstChildId();
- while (sync_child_id != syncer::kInvalidId) {
+ std::vector<int64> child_ids;
+ root.GetChildIds(&child_ids);
+
+ for (std::vector<int64>::iterator it = child_ids.begin();
+ it != child_ids.end(); ++it) {
syncer::ReadNode sync_child_node(&trans);
- if (sync_child_node.InitByIdLookup(sync_child_id) !=
+ if (sync_child_node.InitByIdLookup(*it) !=
syncer::BaseNode::INIT_OK) {
syncer::SyncError error(FROM_HERE,
"Failed to fetch child node for type " + type_name + ".",
@@ -128,7 +131,6 @@ syncer::SyncError GenericChangeProcessor::GetSyncDataForType(
}
current_sync_data->push_back(syncer::SyncData::CreateRemoteData(
sync_child_node.GetId(), sync_child_node.GetEntitySpecifics()));
- sync_child_id = sync_child_node.GetSuccessorId();
}
return syncer::SyncError();
}

Powered by Google App Engine
This is Rietveld 408576698