From 1691f004283eca700aa101b784bdec5a8c3b24cb Mon Sep 17 00:00:00 2001 From: "rlarocque@chromium.org" Date: Tue, 25 Jun 2013 01:47:46 +0000 Subject: Revert 208315 "Make use of InvalidationService" > Make use of InvalidationService > > The InvalidationService was introduced r199520. That commit added the > InvalidationService interface and several implementations of it, but > made no use of the new code. This commit builds on that work. > > Up until now, TICL invalidations were handled on the sync thread. The > related objects were instantiated and owned by the SyncBackendHost and > SyncManager. All requests to update the set of object registrations had > to be passed to the sync thread. Components that wanted to receive > invalidations but were not part of sync had to route their communication > with the invalidations server through ProfileSyncService to get to the > sync thread. Things were a bit different on Android, but the system > still tried to pretend that invalidations were owned by the sync thread. > > The new InvalidationService implementation is a ProfileKeyedService that > is mostly independent from sync. It still relies on sync to manage sign > in and fetch the appropriate auth tokens. However, it's now much easier > for components outside of sync to communication with the invalidations > server. > > The new system allows us to remove a lot of invalidations-related code > from the ProfileSyncService, SyncBackendHost and SyncManager. Sync is > now just one of many clients of the InvalidationService. The > SyncBackendHost is responsible for forwarding messages back and forth > between the InvalidationService and the sync thread. > > TBR=sky,erg > BUG=124137 > > Review URL: https://chromiumcodereview.appspot.com/15580002 TBR=rlarocque@chromium.org Review URL: https://codereview.chromium.org/17610004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208347 0039d316-1c4b-4281-b951-d872f2087c98 --- sync/internal_api/sync_manager_impl.h | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'sync/internal_api/sync_manager_impl.h') diff --git a/sync/internal_api/sync_manager_impl.h b/sync/internal_api/sync_manager_impl.h index 153df81..c12eea7 100644 --- a/sync/internal_api/sync_manager_impl.h +++ b/sync/internal_api/sync_manager_impl.h @@ -51,6 +51,7 @@ class SYNC_EXPORT_PRIVATE SyncManagerImpl : public SyncManager, public net::NetworkChangeNotifier::IPAddressObserver, public net::NetworkChangeNotifier::ConnectionTypeObserver, + public InvalidationHandler, public JsBackend, public SyncEngineEventListener, public ServerConnectionEventListener, @@ -73,6 +74,7 @@ class SYNC_EXPORT_PRIVATE SyncManagerImpl : ExtensionsActivityMonitor* extensions_activity_monitor, SyncManager::ChangeDelegate* change_delegate, const SyncCredentials& credentials, + scoped_ptr invalidator, const std::string& invalidator_client_id, const std::string& restored_key_for_bootstrapping, const std::string& restored_keystore_key_for_bootstrapping, @@ -88,6 +90,17 @@ class SYNC_EXPORT_PRIVATE SyncManagerImpl : ModelTypeSet types) OVERRIDE; virtual bool PurgePartiallySyncedTypes() OVERRIDE; virtual void UpdateCredentials(const SyncCredentials& credentials) OVERRIDE; + virtual void UpdateEnabledTypes(ModelTypeSet enabled_types) OVERRIDE; + virtual void RegisterInvalidationHandler( + InvalidationHandler* handler) OVERRIDE; + virtual void UpdateRegisteredInvalidationIds( + InvalidationHandler* handler, + const ObjectIdSet& ids) OVERRIDE; + virtual void UnregisterInvalidationHandler( + InvalidationHandler* handler) OVERRIDE; + virtual void AcknowledgeInvalidation( + const invalidation::ObjectId& id, + const syncer::AckHandle& ack_handle) OVERRIDE; virtual void StartSyncingNormally( const ModelSafeRoutingInfo& routing_info) OVERRIDE; virtual void ConfigureSyncer( @@ -99,9 +112,6 @@ class SYNC_EXPORT_PRIVATE SyncManagerImpl : const ModelSafeRoutingInfo& new_routing_info, const base::Closure& ready_task, const base::Closure& retry_task) OVERRIDE; - virtual void OnInvalidatorStateChange(InvalidatorState state) OVERRIDE; - virtual void OnIncomingInvalidation( - const ObjectIdInvalidationMap& invalidation_map) OVERRIDE; virtual void AddObserver(SyncManager::Observer* observer) OVERRIDE; virtual void RemoveObserver(SyncManager::Observer* observer) OVERRIDE; virtual SyncStatus GetDetailedStatus() const OVERRIDE; @@ -167,6 +177,11 @@ class SYNC_EXPORT_PRIVATE SyncManagerImpl : syncable::BaseTransaction* trans, std::vector* entries_changed) OVERRIDE; + // InvalidationHandler implementation. + virtual void OnInvalidatorStateChange(InvalidatorState state) OVERRIDE; + virtual void OnIncomingInvalidation( + const ObjectIdInvalidationMap& invalidation_map) OVERRIDE; + // Handle explicit requests to fetch updates for the given types. virtual void RefreshTypes(ModelTypeSet types) OVERRIDE; @@ -321,6 +336,9 @@ class SYNC_EXPORT_PRIVATE SyncManagerImpl : // Start()ed. scoped_ptr scheduler_; + // The Invalidator which notifies us when updates need to be downloaded. + scoped_ptr invalidator_; + // A multi-purpose status watch object that aggregates stats from various // sync components. AllStatus allstatus_; -- cgit v1.1