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

Side by Side Diff: sync/internal_api/write_node.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 6 years 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/internal_api/test/test_entry_factory.cc ('k') | sync/syncable/directory.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/internal_api/public/write_node.h" 5 #include "sync/internal_api/public/write_node.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "sync/internal_api/public/base_transaction.h" 10 #include "sync/internal_api/public/base_transaction.h"
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 if (predecessor && predecessor->GetParentId() != new_parent.GetId()) { 454 if (predecessor && predecessor->GetParentId() != new_parent.GetId()) {
455 DCHECK(false); 455 DCHECK(false);
456 return false; 456 return false;
457 } 457 }
458 458
459 syncable::Id new_parent_id = new_parent.GetEntry()->GetId(); 459 syncable::Id new_parent_id = new_parent.GetEntry()->GetId();
460 460
461 // Filter out redundant changes if both the parent and the predecessor match. 461 // Filter out redundant changes if both the parent and the predecessor match.
462 if (new_parent_id == entry_->GetParentId()) { 462 if (new_parent_id == entry_->GetParentId()) {
463 const syncable::Id& old = entry_->GetPredecessorId(); 463 const syncable::Id& old = entry_->GetPredecessorId();
464 if ((!predecessor && old.IsRoot()) || 464 if ((!predecessor && old.IsNull()) ||
465 (predecessor && (old == predecessor->GetEntry()->GetId()))) { 465 (predecessor && (old == predecessor->GetEntry()->GetId()))) {
466 return true; 466 return true;
467 } 467 }
468 } 468 }
469 469
470 entry_->PutParentId(new_parent_id); 470 entry_->PutParentId(new_parent_id);
471 471
472 // Now set the predecessor, which sets IS_UNSYNCED as necessary. 472 // Now set the predecessor, which sets IS_UNSYNCED as necessary.
473 return PutPredecessor(predecessor); 473 return PutPredecessor(predecessor);
474 } 474 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 MarkForSyncing(); 513 MarkForSyncing();
514 514
515 return true; 515 return true;
516 } 516 }
517 517
518 void WriteNode::MarkForSyncing() { 518 void WriteNode::MarkForSyncing() {
519 syncable::MarkForSyncing(entry_); 519 syncable::MarkForSyncing(entry_);
520 } 520 }
521 521
522 } // namespace syncer 522 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/test/test_entry_factory.cc ('k') | sync/syncable/directory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698