From dbbec3a0133edaff11b16c6bc3fd73aac8ab4e31 Mon Sep 17 00:00:00 2001 From: "rlarocque@chromium.org" Date: Sat, 29 Jun 2013 01:45:09 +0000 Subject: Use InvalidationService (retry of r208315) 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=dcheng,satorux1,battre,rsimha,bauerb,sky,erg BUG=124137 Review URL: https://chromiumcodereview.appspot.com/17699005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209264 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/sync/test_profile_sync_service.cc | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'chrome/browser/sync/test_profile_sync_service.cc') diff --git a/chrome/browser/sync/test_profile_sync_service.cc b/chrome/browser/sync/test_profile_sync_service.cc index 11bb5e3..dac67f2 100644 --- a/chrome/browser/sync/test_profile_sync_service.cc +++ b/chrome/browser/sync/test_profile_sync_service.cc @@ -36,7 +36,6 @@ namespace browser_sync { SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest( Profile* profile, const base::WeakPtr& sync_prefs, - const base::WeakPtr& invalidator_storage, syncer::TestIdFactory& id_factory, base::Closure& callback, bool set_initial_sync_ended_on_init, @@ -44,7 +43,7 @@ SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest( bool fail_initial_download, syncer::StorageOption storage_option) : browser_sync::SyncBackendHost( - profile->GetDebugName(), profile, sync_prefs, invalidator_storage), + profile->GetDebugName(), profile, sync_prefs), weak_ptr_factory_(this), id_factory_(id_factory), callback_(callback), @@ -116,8 +115,13 @@ void SyncBackendHostForProfileSyncTest::RequestConfigureSyncer( if (fail_initial_download_) failed_configuration_types = to_download; + // The first parameter there should be the set of enabled types. That's not + // something we have access to from this strange test harness. We'll just + // send back the list of newly configured types instead and hope it doesn't + // break anything. FinishConfigureDataTypesOnFrontendLoop( syncer::Difference(to_download, failed_configuration_types), + syncer::Difference(to_download, failed_configuration_types), failed_configuration_types, ready_task); } @@ -179,16 +183,6 @@ void SyncBackendHostForProfileSyncTest } } -void SyncBackendHostForProfileSyncTest::EmitOnInvalidatorStateChange( - syncer::InvalidatorState state) { - frontend()->OnInvalidatorStateChange(state); -} - -void SyncBackendHostForProfileSyncTest::EmitOnIncomingInvalidation( - const syncer::ObjectIdInvalidationMap& invalidation_map) { - frontend()->OnIncomingInvalidation(invalidation_map); -} - void SyncBackendHostForProfileSyncTest::ContinueInitialization( const syncer::WeakHandle& js_backend, const syncer::WeakHandle& @@ -311,7 +305,6 @@ void TestProfileSyncService::CreateBackend() { backend_.reset(new browser_sync::SyncBackendHostForProfileSyncTest( profile(), sync_prefs_.AsWeakPtr(), - invalidator_storage_.AsWeakPtr(), id_factory_, callback_, set_initial_sync_ended_on_init_, -- cgit v1.1