diff options
author | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-11 21:22:42 +0000 |
---|---|---|
committer | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-11 21:22:42 +0000 |
commit | 433f6af9e47312bfbe3ed4ddc2b5a3a59dc1b125 (patch) | |
tree | 2591e2a13b9bc5a7e426fc37b6e01705d9b4788f | |
parent | 3ad3579bc473d56993ba2bf0213729f8d1359937 (diff) | |
download | chromium_src-433f6af9e47312bfbe3ed4ddc2b5a3a59dc1b125.zip chromium_src-433f6af9e47312bfbe3ed4ddc2b5a3a59dc1b125.tar.gz chromium_src-433f6af9e47312bfbe3ed4ddc2b5a3a59dc1b125.tar.bz2 |
Nudge syncer when datatypes are deleted. This ensures the deletion happens in a timely manner, avoiding a subtle bug wherein enabling datatypes does not cause a resync.
BUG=56416
TEST=Disable all but one datatype, wait until last sync time is not "just now", re-enable. A resync should happen.
Review URL: http://codereview.chromium.org/3609004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62186 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/sync/glue/sync_backend_host.cc | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc index f6fe466..71bab45 100644 --- a/chrome/browser/sync/glue/sync_backend_host.cc +++ b/chrome/browser/sync/glue/sync_backend_host.cc @@ -250,6 +250,8 @@ void SyncBackendHost::ConfigureDataTypes(const syncable::ModelTypeSet& types, DCHECK(!configure_ready_task_.get()); DCHECK(syncapi_initialized_); + bool deleted_type = false; + { AutoLock lock(registrar_lock_); for (DataTypeController::TypeMap::const_iterator it = @@ -260,6 +262,7 @@ void SyncBackendHost::ConfigureDataTypes(const syncable::ModelTypeSet& types, // If a type is not specified, remove it from the routing_info. if (types.count(type) == 0) { registrar_.routing_info.erase(type); + deleted_type = true; } else { // Add a newly specified data type as GROUP_PASSIVE into the // routing_info, if it does not already exist. @@ -275,22 +278,29 @@ void SyncBackendHost::ConfigureDataTypes(const syncable::ModelTypeSet& types, if (core_->syncapi()->InitialSyncEndedForAllEnabledTypes()) { ready_task->Run(); delete ready_task; - return; + } else { + // Save the task here so we can run it when the syncer finishes + // initializing the new data types. It will be run only when the + // set of initially synced data types matches the types requested in + // this configure. + configure_ready_task_.reset(ready_task); + configure_initial_sync_types_ = types; } - // Save the task here so we can run it when the syncer finishes - // initializing the new data types. It will be run only when the - // set of initially synced data types matches the types requested in - // this configure. - configure_ready_task_.reset(ready_task); - configure_initial_sync_types_ = types; - - // Nudge the syncer. On the next sync cycle, the syncer should + // Nudge the syncer. This is necessary for both datatype addition/deletion. + // + // Deletions need a nudge in order to ensure the deletion occurs in a timely + // manner (see issue 56416). + // + // In the case of additions, on the next sync cycle, the syncer should // notice that the routing info has changed and start the process of // downloading updates for newly added data types. Once this is // complete, the configure_ready_task_ is run via an // OnInitializationComplete notification. - RequestNudge(); + if (deleted_type || !core_->syncapi()->InitialSyncEndedForAllEnabledTypes()) + // We can only nudge when we've either deleted a dataype or added one, else + // we break all the profile sync unit tests. + RequestNudge(); } void SyncBackendHost::RequestNudge() { |