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

Side by Side Diff: sync/engine/syncer_util.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/engine/syncer_unittest.cc ('k') | sync/engine/syncer_util_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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/engine/syncer_util.h" 5 #include "sync/engine/syncer_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if (local_entry.good()) { 114 if (local_entry.good()) {
115 if (local_entry.GetId().ServerKnows()) { 115 if (local_entry.GetId().ServerKnows()) {
116 if (local_entry.GetId() != update_id) { 116 if (local_entry.GetId() != update_id) {
117 // Case 2. 117 // Case 2.
118 LOG(WARNING) << "Duplicated client tag."; 118 LOG(WARNING) << "Duplicated client tag.";
119 if (local_entry.GetId() < update_id) { 119 if (local_entry.GetId() < update_id) {
120 // Signal an error; drop this update on the floor. Note that 120 // Signal an error; drop this update on the floor. Note that
121 // we don't server delete the item, because we don't allow it to 121 // we don't server delete the item, because we don't allow it to
122 // exist locally at all. So the item will remain orphaned on 122 // exist locally at all. So the item will remain orphaned on
123 // the server, and we won't pay attention to it. 123 // the server, and we won't pay attention to it.
124 return syncable::GetNullId(); 124 return syncable::Id();
125 } 125 }
126 } 126 }
127 // Target this change to the existing local entry; later, 127 // Target this change to the existing local entry; later,
128 // we'll change the ID of the local entry to update_id 128 // we'll change the ID of the local entry to update_id
129 // if needed. 129 // if needed.
130 return local_entry.GetId(); 130 return local_entry.GetId();
131 } else { 131 } else {
132 // Case 3: We have a local entry with the same client tag. 132 // Case 3: We have a local entry with the same client tag.
133 // We should change the ID of the local entry to the server entry. 133 // We should change the ID of the local entry to the server entry.
134 // This will result in an server ID with base version == 0, but that's 134 // This will result in an server ID with base version == 0, but that's
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 if (update.version() < target->GetServerVersion()) { 645 if (update.version() < target->GetServerVersion()) {
646 LOG(WARNING) << "Update older than current server version for " 646 LOG(WARNING) << "Update older than current server version for "
647 << *target << " Update:" 647 << *target << " Update:"
648 << SyncerProtoUtil::SyncEntityDebugString(update); 648 << SyncerProtoUtil::SyncEntityDebugString(update);
649 return VERIFY_SUCCESS; // Expected in new sync protocol. 649 return VERIFY_SUCCESS; // Expected in new sync protocol.
650 } 650 }
651 return VERIFY_UNDECIDED; 651 return VERIFY_UNDECIDED;
652 } 652 }
653 653
654 } // namespace syncer 654 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/syncer_unittest.cc ('k') | sync/engine/syncer_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698