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

Unified Diff: sync/syncable/syncable_util.cc

Issue 867793003: Remove dependency on server generated type root folders (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added extra comment about existing type root folder. Created 5 years, 11 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/syncable/syncable_id.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/syncable/syncable_util.cc
diff --git a/sync/syncable/syncable_util.cc b/sync/syncable/syncable_util.cc
index d92aa47ed46d1e633da74123d3191010c46c27de..89d1375e632af2720ec78e530dec53175cae4ecc 100644
--- a/sync/syncable/syncable_util.cc
+++ b/sync/syncable/syncable_util.cc
@@ -28,6 +28,8 @@ int GetUnsyncedEntries(BaseTransaction* trans,
bool IsLegalNewParent(BaseTransaction* trans, const Id& entry_id,
const Id& new_parent_id) {
+ DCHECK(!entry_id.IsNull());
+ DCHECK(!new_parent_id.IsNull());
if (entry_id.IsRoot())
return false;
// we have to ensure that the entry is not an ancestor of the new parent.
@@ -66,11 +68,14 @@ void ChangeEntryIDAndUpdateChildren(
while (i != children.end()) {
ModelNeutralMutableEntry child_entry(trans, GET_BY_HANDLE, *i++);
CHECK(child_entry.good());
- // Use the unchecked setter here to avoid touching the child's
- // UNIQUE_POSITION field. In this case, UNIQUE_POSITION among the
- // children will be valid after the loop, since we update all the children
- // at once.
- child_entry.PutParentIdPropertyOnly(new_id);
+ // Change the parent ID of the entry unless it was unset (implicit)
+ if (!child_entry.GetParentId().IsNull()) {
+ // Use the unchecked setter here to avoid touching the child's
+ // UNIQUE_POSITION field. In this case, UNIQUE_POSITION among the
+ // children will be valid after the loop, since we update all the
+ // children at once.
+ child_entry.PutParentIdPropertyOnly(new_id);
+ }
}
}
}
« no previous file with comments | « sync/syncable/syncable_id.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698