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

Unified Diff: sync/engine/apply_control_data_updates.cc

Issue 1393633003: Sync: fix for the code that checks whether the initial download has completed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed control data types and added unit tests Created 5 years, 2 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
Index: sync/engine/apply_control_data_updates.cc
diff --git a/sync/engine/apply_control_data_updates.cc b/sync/engine/apply_control_data_updates.cc
index 3e167b1e547aafddbe5e0da498212ea2271f9f5d..49825b8385aa0dd9baf45d748bd9ac0c39ebc635 100644
--- a/sync/engine/apply_control_data_updates.cc
+++ b/sync/engine/apply_control_data_updates.cc
@@ -32,13 +32,25 @@ void ApplyControlDataUpdates(syncable::Directory* dir) {
ModelTypeSet control_types = ControlTypes();
for (ModelTypeSet::Iterator iter = control_types.First(); iter.Good();
iter.Inc()) {
- syncable::MutableEntry entry(&trans, syncable::GET_TYPE_ROOT, iter.Get());
+ ModelType type = iter.Get();
+ syncable::MutableEntry entry(&trans, syncable::GET_TYPE_ROOT, type);
if (!entry.good())
continue;
- if (!entry.GetIsUnappliedUpdate())
+
+ if (!entry.GetIsUnappliedUpdate()) {
Nicolas Zea 2015/10/09 22:23:33 Is this the right condition? The first time we dow
stanisc 2015/10/10 00:44:18 This case is to handle only locally created root n
+ // If this is a type with client generated root, the root node has been
+ // created locally and might never be updated by the server. In that case
+ // it has to be marked as having the initial download completed (which is
+ // done by changing the root's base version to a value other than
+ // CHANGES_VERSION). This does nothing if the root's base version is
+ // already other than CHANGES_VERSION.
+ if (IsTypeWithClientGeneratedRoot(type)) {
+ dir->MarkInitialSyncEndedForType(&trans, type);
+ }
continue;
+ }
- ModelType type = entry.GetServerModelType();
+ DCHECK_EQ(type, entry.GetServerModelType());
if (type == NIGORI) {
// Nigori node applications never fail.
ApplyNigoriUpdate(&trans,
« no previous file with comments | « no previous file | sync/engine/apply_control_data_updates_unittest.cc » ('j') | sync/engine/apply_control_data_updates_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698