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

Unified Diff: chrome/browser/sync/internal_api/change_reorder_buffer.cc

Issue 8402014: [Sync] Make GetFirstChildId return a flag indicating success (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup comments Created 9 years, 2 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/internal_api/change_reorder_buffer.cc
diff --git a/chrome/browser/sync/internal_api/change_reorder_buffer.cc b/chrome/browser/sync/internal_api/change_reorder_buffer.cc
index d030e5c2c859fa25009b5790d61022cec30b601b..090f74444292d4066763ef73456f2ae479fd4ea6 100644
--- a/chrome/browser/sync/internal_api/change_reorder_buffer.cc
+++ b/chrome/browser/sync/internal_api/change_reorder_buffer.cc
@@ -121,8 +121,9 @@ ChangeReorderBuffer::ChangeReorderBuffer() {
ChangeReorderBuffer::~ChangeReorderBuffer() {
}
-ImmutableChangeRecordList ChangeReorderBuffer::GetAllChangesInTreeOrder(
- const BaseTransaction* sync_trans) {
+bool ChangeReorderBuffer::GetAllChangesInTreeOrder(
+ const BaseTransaction* sync_trans,
+ ImmutableChangeRecordList* changes) {
syncable::BaseTransaction* trans = sync_trans->GetWrappedTrans();
// Step 1: Iterate through the operations, doing three things:
@@ -200,8 +201,12 @@ ImmutableChangeRecordList ChangeReorderBuffer::GetAllChangesInTreeOrder(
// There were ordering changes on the children of this parent, so
// enumerate all the children in the sibling order.
syncable::Entry parent(trans, syncable::GET_BY_HANDLE, next);
- syncable::Id id = trans->directory()->
- GetFirstChildId(trans, parent.Get(syncable::ID));
+ syncable::Id id;
+ if (!trans->directory()->GetFirstChildId(
+ trans, parent.Get(syncable::ID), &id)) {
+ *changes = ImmutableChangeRecordList();
+ return false;
+ }
while (!id.IsRoot()) {
syncable::Entry child(trans, syncable::GET_BY_ID, id);
CHECK(child.good());
@@ -217,7 +222,8 @@ ImmutableChangeRecordList ChangeReorderBuffer::GetAllChangesInTreeOrder(
}
}
- return ImmutableChangeRecordList(&changelist);
+ *changes = ImmutableChangeRecordList(&changelist);
+ return true;
}
} // namespace sync_api

Powered by Google App Engine
This is Rietveld 408576698