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

Side by Side Diff: sync/engine/get_commit_ids.cc

Issue 805633004: Enable Null Syncable ID which is different than Root ID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR feedback Created 5 years, 12 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 unified diff | Download patch
« no previous file with comments | « sync/engine/directory_update_handler_unittest.cc ('k') | sync/engine/syncer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sync/engine/get_commit_ids.h" 5 #include "sync/engine/get_commit_ids.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 if (HaveItem(item_handle)) { 342 if (HaveItem(item_handle)) {
343 // We've already added this item to the commit set, and so must have 343 // We've already added this item to the commit set, and so must have
344 // already added the predecessors as well. 344 // already added the predecessors as well.
345 return; 345 return;
346 } 346 }
347 TryAddItem(ready_unsynced_set, item, result); 347 TryAddItem(ready_unsynced_set, item, result);
348 if (item.GetIsDel()) 348 if (item.GetIsDel())
349 return; // Deleted items have no predecessors. 349 return; // Deleted items have no predecessors.
350 350
351 syncable::Id prev_id = item.GetPredecessorId(); 351 syncable::Id prev_id = item.GetPredecessorId();
352 while (!prev_id.IsRoot()) { 352 while (!prev_id.IsNull()) {
353 syncable::Entry prev(trans_, syncable::GET_BY_ID, prev_id); 353 syncable::Entry prev(trans_, syncable::GET_BY_ID, prev_id);
354 CHECK(prev.good()) << "Bad id when walking predecessors."; 354 CHECK(prev.good()) << "Bad id when walking predecessors.";
355 if (!prev.GetIsUnsynced()) { 355 if (!prev.GetIsUnsynced()) {
356 // We're interested in "runs" of unsynced items. This item breaks 356 // We're interested in "runs" of unsynced items. This item breaks
357 // the streak, so we stop traversing. 357 // the streak, so we stop traversing.
358 return; 358 return;
359 } 359 }
360 int64 handle = prev.GetMetahandle(); 360 int64 handle = prev.GetMetahandle();
361 if (HaveItem(handle)) { 361 if (HaveItem(handle)) {
362 // We've already added this item to the commit set, and so must have 362 // We've already added this item to the commit set, and so must have
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 // Add moves and creates, and prepend their uncommitted parents. 557 // Add moves and creates, and prepend their uncommitted parents.
558 traversal.AddCreatesAndMoves(ready_unsynced_set); 558 traversal.AddCreatesAndMoves(ready_unsynced_set);
559 559
560 // Add all deletes. 560 // Add all deletes.
561 traversal.AddDeletes(ready_unsynced_set); 561 traversal.AddDeletes(ready_unsynced_set);
562 } 562 }
563 563
564 } // namespace 564 } // namespace
565 565
566 } // namespace syncer 566 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/directory_update_handler_unittest.cc ('k') | sync/engine/syncer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698