summaryrefslogtreecommitdiffstats
path: root/sync/notifier/sync_notifier_factory.cc
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-31 00:39:26 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-31 00:39:26 +0000
commit0857ae0b1f18f25141e28a7b7169f497f5cdb76b (patch)
treea4adc9a4518fd41976f040e7658c15610d2a2336 /sync/notifier/sync_notifier_factory.cc
parentb790b20609a2cca60e8ab75e1f02af391c4970e0 (diff)
downloadchromium_src-0857ae0b1f18f25141e28a7b7169f497f5cdb76b.zip
chromium_src-0857ae0b1f18f25141e28a7b7169f497f5cdb76b.tar.gz
chromium_src-0857ae0b1f18f25141e28a7b7169f497f5cdb76b.tar.bz2
sync: migrate invalidation state from syncable::Directory to InvalidationStorage
Deprecates SyncNotifier::SetState, as this is needed only to plumb notification state from the syncable::Directory to notifier. It is still in use to facilitate migration. Migration for an existing sync setup works as follows: 1) normal SyncManager::Init occurs, which calls SetState on notifier. 2) The InvalidationNotifier takes the state received in SetState and echoes it back through the InvalidationStateTracker) which is the new store. It does this in addition to normal stashing, to hand to ChromeInvalidationClient when needed. 3) On a subsequent restart, the SyncNotifierFactory will see a non-empty initial invalidation state in the InvalidationStateTracker, and pass this down on creation to notifier components. 4) SetState calls will now be no-ops, as the invalidation state will be non-empty, and it can only be set once on this code path. UMA tracks the number of "worthwhile" SetStateDeprecated calls for a rough global migration progress. At some point in the future, once these bits have served all (statistically speaking) users, the SetStateDeprecated call can be removed entirely and the syncable::Directory schema updated to remove existing and unnecessary columns. I did not remove the column from DirectoryBackingStore::CreateTables, since the code doesn't really support a half-way migration and it's likely cleaner to do it in one fell swoop when we know it is safe. Open to suggestions. Built on http://codereview.chromium.org/10451058/ BUG=124140 TEST= Review URL: https://chromiumcodereview.appspot.com/10451060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139706 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/notifier/sync_notifier_factory.cc')
-rw-r--r--sync/notifier/sync_notifier_factory.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/sync/notifier/sync_notifier_factory.cc b/sync/notifier/sync_notifier_factory.cc
index ed838b1..639e4a5 100644
--- a/sync/notifier/sync_notifier_factory.cc
+++ b/sync/notifier/sync_notifier_factory.cc
@@ -18,6 +18,7 @@ namespace {
SyncNotifier* CreateDefaultSyncNotifier(
const notifier::NotifierOptions& notifier_options,
const InvalidationVersionMap& initial_max_invalidation_versions,
+ const std::string& initial_invalidation_state,
const browser_sync::WeakHandle<InvalidationStateTracker>&
invalidation_state_tracker,
const std::string& client_info) {
@@ -33,7 +34,7 @@ SyncNotifier* CreateDefaultSyncNotifier(
return new NonBlockingInvalidationNotifier(
notifier_options, initial_max_invalidation_versions,
- invalidation_state_tracker, client_info);
+ initial_invalidation_state, invalidation_state_tracker, client_info);
}
} // namespace
@@ -50,6 +51,10 @@ SyncNotifierFactory::SyncNotifierFactory(
invalidation_state_tracker.get() ?
invalidation_state_tracker->GetAllMaxVersions() :
InvalidationVersionMap()),
+ initial_invalidation_state_(
+ invalidation_state_tracker.get() ?
+ invalidation_state_tracker->GetInvalidationState() :
+ std::string()),
invalidation_state_tracker_(invalidation_state_tracker) {
}
@@ -63,6 +68,7 @@ SyncNotifier* SyncNotifierFactory::CreateSyncNotifier() {
#else
return CreateDefaultSyncNotifier(notifier_options_,
initial_max_invalidation_versions_,
+ initial_invalidation_state_,
invalidation_state_tracker_,
client_info_);
#endif