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

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

Issue 948113005: Sync: Small refactoring of Directory::CheckTreeInvariants (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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.cc ('k') | sync/internal_api/public/base/model_type.h » ('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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } 260 }
261 if (entry->GetParentId() != new_parent) { 261 if (entry->GetParentId() != new_parent) {
262 if (!entry->GetIsDel() && !IsLegalNewParent(trans, id, new_parent)) { 262 if (!entry->GetIsDel() && !IsLegalNewParent(trans, id, new_parent)) {
263 DVLOG(1) << "Not updating item " << id 263 DVLOG(1) << "Not updating item " << id
264 << ", illegal new parent (would cause loop)."; 264 << ", illegal new parent (would cause loop).";
265 return CONFLICT_HIERARCHY; 265 return CONFLICT_HIERARCHY;
266 } 266 }
267 } 267 }
268 } else { 268 } else {
269 // new_parent is unset. 269 // new_parent is unset.
270 DCHECK(!IsTypeWithServerGeneratedRoot(type)); 270 DCHECK(IsTypeWithClientGeneratedRoot(type));
271 } 271 }
272 } else if (entry->GetIsDir()) { 272 } else if (entry->GetIsDir()) {
273 Directory::Metahandles handles; 273 Directory::Metahandles handles;
274 trans->directory()->GetChildHandlesById(trans, id, &handles); 274 trans->directory()->GetChildHandlesById(trans, id, &handles);
275 if (!handles.empty()) { 275 if (!handles.empty()) {
276 // If we have still-existing children, then we need to deal with 276 // If we have still-existing children, then we need to deal with
277 // them before we can process this change. 277 // them before we can process this change.
278 DVLOG(1) << "Not deleting directory; it's not empty " << *entry; 278 DVLOG(1) << "Not deleting directory; it's not empty " << *entry;
279 return CONFLICT_HIERARCHY; 279 return CONFLICT_HIERARCHY;
280 } 280 }
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 if (update.version() < target->GetServerVersion()) { 669 if (update.version() < target->GetServerVersion()) {
670 LOG(WARNING) << "Update older than current server version for " 670 LOG(WARNING) << "Update older than current server version for "
671 << *target << " Update:" 671 << *target << " Update:"
672 << SyncerProtoUtil::SyncEntityDebugString(update); 672 << SyncerProtoUtil::SyncEntityDebugString(update);
673 return VERIFY_SUCCESS; // Expected in new sync protocol. 673 return VERIFY_SUCCESS; // Expected in new sync protocol.
674 } 674 }
675 return VERIFY_UNDECIDED; 675 return VERIFY_UNDECIDED;
676 } 676 }
677 677
678 } // namespace syncer 678 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/directory_update_handler.cc ('k') | sync/internal_api/public/base/model_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698