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

Unified Diff: sync/syncable/directory.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/internal_api/public/base/model_type.h ('k') | sync/syncable/model_neutral_mutable_entry.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/syncable/directory.cc
diff --git a/sync/syncable/directory.cc b/sync/syncable/directory.cc
index 7eacdd0cd8471e753f9babe0fbc271bae6b9a2da..12616959984419a1c9e5cae9f412c821305460dd 100644
--- a/sync/syncable/directory.cc
+++ b/sync/syncable/directory.cc
@@ -1226,14 +1226,18 @@ bool Directory::CheckTreeInvariants(syncable::BaseTransaction* trans,
int64 base_version = e.GetBaseVersion();
int64 server_version = e.GetServerVersion();
bool using_unique_client_tag = !e.GetUniqueClientTag().empty();
- bool is_type_root_folder =
- parentid.IsRoot() &&
- e.GetUniqueServerTag() == ModelTypeToRootTag(e.GetModelType());
if (CHANGES_VERSION == base_version || 0 == base_version) {
+ ModelType model_type = e.GetModelType();
+ bool is_client_creatable_type_root_folder =
+ parentid.IsRoot() &&
+ IsTypeWithClientGeneratedRoot(model_type) &&
+ e.GetUniqueServerTag() == ModelTypeToRootTag(model_type);
if (e.GetIsUnappliedUpdate()) {
// Must be a new item, or a de-duplicated unique client tag
+ // that was created both locally and remotely, or a type root folder
// that was created both locally and remotely.
- if (!(using_unique_client_tag || is_type_root_folder)) {
+ if (!(using_unique_client_tag ||
+ is_client_creatable_type_root_folder)) {
if (!SyncAssert(e.GetIsDel(), FROM_HERE,
"The entry should have been deleted.", trans))
return false;
@@ -1252,8 +1256,8 @@ bool Directory::CheckTreeInvariants(syncable::BaseTransaction* trans,
trans))
return false;
}
- if (is_type_root_folder) {
- // This must be a locally created type root folder
+ if (is_client_creatable_type_root_folder) {
+ // This must be a locally created type root folder.
if (!SyncAssert(
!e.GetIsUnsynced(), FROM_HERE,
"Locally created type root folders should not be unsynced.",
« no previous file with comments | « sync/internal_api/public/base/model_type.h ('k') | sync/syncable/model_neutral_mutable_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698