diff options
author | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-29 01:45:09 +0000 |
---|---|---|
committer | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-29 01:45:09 +0000 |
commit | dbbec3a0133edaff11b16c6bc3fd73aac8ab4e31 (patch) | |
tree | 20b4a2df530ac7c83bcc5e7d460137e97846685e /sync/internal_api | |
parent | c146a323f91c8376afe55c93c6a31df0075be62b (diff) | |
download | chromium_src-dbbec3a0133edaff11b16c6bc3fd73aac8ab4e31.zip chromium_src-dbbec3a0133edaff11b16c6bc3fd73aac8ab4e31.tar.gz chromium_src-dbbec3a0133edaff11b16c6bc3fd73aac8ab4e31.tar.bz2 |
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
Diffstat (limited to 'sync/internal_api')
-rw-r--r-- | sync/internal_api/public/sync_manager.h | 35 | ||||
-rw-r--r-- | sync/internal_api/public/test/fake_sync_manager.h | 21 | ||||
-rw-r--r-- | sync/internal_api/sync_manager_impl.cc | 82 | ||||
-rw-r--r-- | sync/internal_api/sync_manager_impl.h | 24 | ||||
-rw-r--r-- | sync/internal_api/sync_manager_impl_unittest.cc | 62 | ||||
-rw-r--r-- | sync/internal_api/test/fake_sync_manager.cc | 64 |
6 files changed, 28 insertions, 260 deletions
diff --git a/sync/internal_api/public/sync_manager.h b/sync/internal_api/public/sync_manager.h index b3f03b0..bc6a137 100644 --- a/sync/internal_api/public/sync_manager.h +++ b/sync/internal_api/public/sync_manager.h @@ -23,7 +23,7 @@ #include "sync/internal_api/public/sync_encryption_handler.h" #include "sync/internal_api/public/util/report_unrecoverable_error_function.h" #include "sync/internal_api/public/util/weak_handle.h" -#include "sync/notifier/invalidation_util.h" +#include "sync/notifier/invalidation_handler.h" #include "sync/protocol/sync_protocol_error.h" namespace sync_pb { @@ -39,8 +39,6 @@ struct Experiments; class ExtensionsActivityMonitor; class HttpPostProviderFactory; class InternalComponentsFactory; -class InvalidationHandler; -class Invalidator; class JsBackend; class JsEventHandler; class SyncEncryptionHandler; @@ -75,7 +73,7 @@ struct SyncCredentials { // // Unless stated otherwise, all methods of SyncManager should be called on the // same thread. -class SYNC_EXPORT SyncManager { +class SYNC_EXPORT SyncManager : public syncer::InvalidationHandler { public: // An interface the embedding application implements to be notified // on change events. Note that these methods may be called on *any* @@ -315,7 +313,6 @@ class SYNC_EXPORT SyncManager { ExtensionsActivityMonitor* extensions_activity_monitor, ChangeDelegate* change_delegate, const SyncCredentials& credentials, - scoped_ptr<Invalidator> invalidator, const std::string& invalidator_client_id, const std::string& restored_key_for_bootstrapping, const std::string& restored_keystore_key_for_bootstrapping, @@ -344,27 +341,6 @@ class SYNC_EXPORT SyncManager { // Update tokens that we're using in Sync. Email must stay the same. virtual void UpdateCredentials(const SyncCredentials& credentials) = 0; - // Called when the user disables or enables a sync type. - virtual void UpdateEnabledTypes(ModelTypeSet enabled_types) = 0; - - // Forwards to the underlying invalidator (see comments in invalidator.h). - virtual void RegisterInvalidationHandler( - InvalidationHandler* handler) = 0; - - // Forwards to the underlying notifier (see comments in invalidator.h). - virtual void UpdateRegisteredInvalidationIds( - InvalidationHandler* handler, - const ObjectIdSet& ids) = 0; - - // Forwards to the underlying notifier (see comments in invalidator.h). - virtual void UnregisterInvalidationHandler( - InvalidationHandler* handler) = 0; - - // Forwards to the underlying notifier (see comments in invalidator.h). - virtual void AcknowledgeInvalidation( - const invalidation::ObjectId& id, - const syncer::AckHandle& ack_handle) = 0; - // Put the syncer in normal mode ready to perform nudges and polls. virtual void StartSyncingNormally( const ModelSafeRoutingInfo& routing_info) = 0; @@ -392,6 +368,13 @@ class SYNC_EXPORT SyncManager { const base::Closure& ready_task, const base::Closure& retry_task) = 0; + // Inform the syncer of a change in the invalidator's state. + virtual void OnInvalidatorStateChange(InvalidatorState state) = 0; + + // Inform the syncer that its cached information about a type is obsolete. + virtual void OnIncomingInvalidation( + const ObjectIdInvalidationMap& invalidation_map) = 0; + // Adds a listener to be notified of sync events. // NOTE: It is OK (in fact, it's probably a good idea) to call this before // having received OnInitializationCompleted. diff --git a/sync/internal_api/public/test/fake_sync_manager.h b/sync/internal_api/public/test/fake_sync_manager.h index ba38ac6..ed69a52 100644 --- a/sync/internal_api/public/test/fake_sync_manager.h +++ b/sync/internal_api/public/test/fake_sync_manager.h @@ -62,10 +62,11 @@ class FakeSyncManager : public SyncManager { ConfigureReason GetAndResetConfigureReason(); // Posts a method to invalidate the given IDs on the sync thread. - void Invalidate(const ObjectIdInvalidationMap& invalidation_map); + virtual void OnIncomingInvalidation( + const ObjectIdInvalidationMap& invalidation_map) OVERRIDE; // Posts a method to update the invalidator state on the sync thread. - void UpdateInvalidatorState(InvalidatorState state); + virtual void OnInvalidatorStateChange(InvalidatorState state) OVERRIDE; // Block until the sync thread has finished processing any pending messages. void WaitForSyncThread(); @@ -84,7 +85,6 @@ class FakeSyncManager : public SyncManager { ExtensionsActivityMonitor* extensions_activity_monitor, ChangeDelegate* change_delegate, const SyncCredentials& credentials, - scoped_ptr<Invalidator> invalidator, const std::string& invalidator_client_id, const std::string& restored_key_for_bootstrapping, const std::string& restored_keystore_key_for_bootstrapping, @@ -100,17 +100,6 @@ class FakeSyncManager : public SyncManager { ModelTypeSet types) OVERRIDE; virtual bool PurgePartiallySyncedTypes() OVERRIDE; virtual void UpdateCredentials(const SyncCredentials& credentials) OVERRIDE; - virtual void UpdateEnabledTypes(ModelTypeSet 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( @@ -136,10 +125,6 @@ class FakeSyncManager : public SyncManager { virtual void RefreshTypes(ModelTypeSet types) OVERRIDE; private: - void InvalidateOnSyncThread( - const ObjectIdInvalidationMap& invalidation_map); - void UpdateInvalidatorStateOnSyncThread(InvalidatorState state); - scoped_refptr<base::SequencedTaskRunner> sync_task_runner_; ObserverList<SyncManager::Observer> observers_; diff --git a/sync/internal_api/sync_manager_impl.cc b/sync/internal_api/sync_manager_impl.cc index 68f68f8..7b0e549 100644 --- a/sync/internal_api/sync_manager_impl.cc +++ b/sync/internal_api/sync_manager_impl.cc @@ -349,7 +349,6 @@ void SyncManagerImpl::Init( ExtensionsActivityMonitor* extensions_activity_monitor, SyncManager::ChangeDelegate* change_delegate, const SyncCredentials& credentials, - scoped_ptr<Invalidator> invalidator, const std::string& invalidator_client_id, const std::string& restored_key_for_bootstrapping, const std::string& restored_keystore_key_for_bootstrapping, @@ -369,9 +368,6 @@ void SyncManagerImpl::Init( change_delegate_ = change_delegate; - invalidator_ = invalidator.Pass(); - invalidator_->RegisterHandler(this); - AddObserver(&js_sync_manager_observer_); SetJsEventHandler(event_handler); @@ -609,49 +605,11 @@ void SyncManagerImpl::UpdateCredentials(const SyncCredentials& credentials) { if (!connection_manager_->SetAuthToken(credentials.sync_token)) return; // Auth token is known to be invalid, so exit early. - invalidator_->UpdateCredentials(credentials.email, credentials.sync_token); scheduler_->OnCredentialsUpdated(); // TODO(zea): pass the credential age to the debug info event listener. } -void SyncManagerImpl::UpdateEnabledTypes(ModelTypeSet enabled_types) { - DCHECK(thread_checker_.CalledOnValidThread()); - DCHECK(initialized_); - invalidator_->UpdateRegisteredIds( - this, - ModelTypeSetToObjectIdSet(enabled_types)); -} - -void SyncManagerImpl::RegisterInvalidationHandler( - InvalidationHandler* handler) { - DCHECK(thread_checker_.CalledOnValidThread()); - DCHECK(initialized_); - invalidator_->RegisterHandler(handler); -} - -void SyncManagerImpl::UpdateRegisteredInvalidationIds( - InvalidationHandler* handler, - const ObjectIdSet& ids) { - DCHECK(thread_checker_.CalledOnValidThread()); - DCHECK(initialized_); - invalidator_->UpdateRegisteredIds(handler, ids); -} - -void SyncManagerImpl::UnregisterInvalidationHandler( - InvalidationHandler* handler) { - DCHECK(thread_checker_.CalledOnValidThread()); - DCHECK(initialized_); - invalidator_->UnregisterHandler(handler); -} - -void SyncManagerImpl::AcknowledgeInvalidation( - const invalidation::ObjectId& id, const syncer::AckHandle& ack_handle) { - DCHECK(thread_checker_.CalledOnValidThread()); - DCHECK(initialized_); - invalidator_->Acknowledge(id, ack_handle); -} - void SyncManagerImpl::AddObserver(SyncManager::Observer* observer) { DCHECK(thread_checker_.CalledOnValidThread()); observers_.AddObserver(observer); @@ -690,15 +648,10 @@ void SyncManagerImpl::ShutdownOnSyncThread() { RemoveObserver(&debug_info_event_listener_); - // |invalidator_| and |connection_manager_| may end up being NULL here in - // tests (in synchronous initialization mode). + // |connection_manager_| may end up being NULL here in tests (in synchronous + // initialization mode). // // TODO(akalin): Fix this behavior. - - if (invalidator_) - invalidator_->UnregisterHandler(this); - invalidator_.reset(); - if (connection_manager_) connection_manager_->RemoveListener(this); connection_manager_.reset(); @@ -988,20 +941,6 @@ void SyncManagerImpl::OnSyncEngineEvent(const SyncEngineEvent& event) { DVLOG(1) << "Sending OnSyncCycleCompleted"; FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnSyncCycleCompleted(event.snapshot)); - - // This is here for tests, which are still using p2p notifications. - bool is_notifiable_commit = - (event.snapshot.model_neutral_state().num_successful_commits > 0); - if (is_notifiable_commit) { - if (invalidator_) { - const ObjectIdInvalidationMap& invalidation_map = - ModelTypeInvalidationMapToObjectIdInvalidationMap( - event.snapshot.source().types); - invalidator_->SendInvalidation(invalidation_map); - } else { - DVLOG(1) << "Not sending invalidation: invalidator_ is NULL"; - } - } } if (event.what_happened == SyncEngineEvent::STOP_SYNCING_PERMANENTLY) { @@ -1224,6 +1163,8 @@ void SyncManagerImpl::UpdateNotificationInfo( } void SyncManagerImpl::OnInvalidatorStateChange(InvalidatorState state) { + DCHECK(thread_checker_.CalledOnValidThread()); + const std::string& state_str = InvalidatorStateToString(state); invalidator_state_ = state; DVLOG(1) << "Invalidator state changed to: " << state_str; @@ -1232,12 +1173,6 @@ void SyncManagerImpl::OnInvalidatorStateChange(InvalidatorState state) { allstatus_.SetNotificationsEnabled(notifications_enabled); scheduler_->SetNotificationsEnabled(notifications_enabled); - if (invalidator_state_ == syncer::INVALIDATION_CREDENTIALS_REJECTED) { - // If the invalidator's credentials were rejected, that means that - // our sync credentials are also bad, so invalidate those. - connection_manager_->OnInvalidationCredentialsRejected(); - } - if (js_event_handler_.IsInitialized()) { base::DictionaryValue details; details.SetString("state", state_str); @@ -1252,15 +1187,6 @@ void SyncManagerImpl::OnIncomingInvalidation( const ObjectIdInvalidationMap& invalidation_map) { DCHECK(thread_checker_.CalledOnValidThread()); - // TODO(dcheng): Acknowledge immediately for now. Fix this once the - // invalidator doesn't repeatedly ping for unacknowledged invaliations, since - // it conflicts with the sync scheduler's internal backoff algorithm. - // See http://crbug.com/124149 for more information. - for (ObjectIdInvalidationMap::const_iterator it = invalidation_map.begin(); - it != invalidation_map.end(); ++it) { - invalidator_->Acknowledge(it->first, it->second.ack_handle); - } - const ModelTypeInvalidationMap& type_invalidation_map = ObjectIdInvalidationMapToModelTypeInvalidationMap(invalidation_map); if (type_invalidation_map.empty()) { diff --git a/sync/internal_api/sync_manager_impl.h b/sync/internal_api/sync_manager_impl.h index c12eea7..153df81 100644 --- a/sync/internal_api/sync_manager_impl.h +++ b/sync/internal_api/sync_manager_impl.h @@ -51,7 +51,6 @@ class SYNC_EXPORT_PRIVATE SyncManagerImpl : public SyncManager, public net::NetworkChangeNotifier::IPAddressObserver, public net::NetworkChangeNotifier::ConnectionTypeObserver, - public InvalidationHandler, public JsBackend, public SyncEngineEventListener, public ServerConnectionEventListener, @@ -74,7 +73,6 @@ class SYNC_EXPORT_PRIVATE SyncManagerImpl : ExtensionsActivityMonitor* extensions_activity_monitor, SyncManager::ChangeDelegate* change_delegate, const SyncCredentials& credentials, - scoped_ptr<Invalidator> invalidator, const std::string& invalidator_client_id, const std::string& restored_key_for_bootstrapping, const std::string& restored_keystore_key_for_bootstrapping, @@ -90,17 +88,6 @@ 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( @@ -112,6 +99,9 @@ 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; @@ -177,11 +167,6 @@ class SYNC_EXPORT_PRIVATE SyncManagerImpl : syncable::BaseTransaction* trans, std::vector<int64>* 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; @@ -336,9 +321,6 @@ class SYNC_EXPORT_PRIVATE SyncManagerImpl : // Start()ed. scoped_ptr<SyncScheduler> scheduler_; - // The Invalidator which notifies us when updates need to be downloaded. - scoped_ptr<Invalidator> invalidator_; - // A multi-purpose status watch object that aggregates stats from various // sync components. AllStatus allstatus_; diff --git a/sync/internal_api/sync_manager_impl_unittest.cc b/sync/internal_api/sync_manager_impl_unittest.cc index a1ddd7f..2085ec3 100644 --- a/sync/internal_api/sync_manager_impl_unittest.cc +++ b/sync/internal_api/sync_manager_impl_unittest.cc @@ -46,7 +46,6 @@ #include "sync/js/js_reply_handler.h" #include "sync/js/js_test_util.h" #include "sync/notifier/fake_invalidation_handler.h" -#include "sync/notifier/fake_invalidator.h" #include "sync/notifier/invalidation_handler.h" #include "sync/notifier/invalidator.h" #include "sync/protocol/bookmark_specifics.pb.h" @@ -789,14 +788,12 @@ class SyncManagerTest : public testing::Test, }; SyncManagerTest() - : fake_invalidator_(NULL), - sync_manager_("Test sync manager") { + : sync_manager_("Test sync manager") { switches_.encryption_method = InternalComponentsFactory::ENCRYPTION_KEYSTORE; } virtual ~SyncManagerTest() { - EXPECT_FALSE(fake_invalidator_); } // Test implementation. @@ -807,8 +804,6 @@ class SyncManagerTest : public testing::Test, credentials.email = "foo@bar.com"; credentials.sync_token = "sometoken"; - fake_invalidator_ = new FakeInvalidator(); - sync_manager_.AddObserver(&manager_observer_); EXPECT_CALL(manager_observer_, OnInitializationComplete(_, _, _, _)). WillOnce(SaveArg<0>(&js_backend_)); @@ -831,7 +826,6 @@ class SyncManagerTest : public testing::Test, &extensions_activity_monitor_, this, credentials, - scoped_ptr<Invalidator>(fake_invalidator_), "fake_invalidator_client_id", std::string(), std::string(), // bootstrap tokens @@ -851,17 +845,11 @@ class SyncManagerTest : public testing::Test, sync_manager_.GetUserShare(), i->first); } PumpLoop(); - - EXPECT_TRUE(fake_invalidator_->IsHandlerRegistered(&sync_manager_)); } void TearDown() { sync_manager_.RemoveObserver(&manager_observer_); sync_manager_.ShutdownOnSyncThread(); - // We can't assert that |sync_manager_| isn't registered with - // |fake_invalidator_| anymore because |fake_invalidator_| is now - // destroyed. - fake_invalidator_ = NULL; PumpLoop(); } @@ -1027,7 +1015,6 @@ class SyncManagerTest : public testing::Test, protected: FakeEncryptor encryptor_; TestUnrecoverableErrorHandler handler_; - FakeInvalidator* fake_invalidator_; SyncManagerImpl sync_manager_; WeakHandle<JsBackend> js_backend_; StrictMock<SyncManagerObserverMock> manager_observer_; @@ -1035,29 +1022,6 @@ class SyncManagerTest : public testing::Test, InternalComponentsFactory::Switches switches_; }; -TEST_F(SyncManagerTest, UpdateEnabledTypes) { - ModelSafeRoutingInfo routes; - GetModelSafeRoutingInfo(&routes); - const ModelTypeSet enabled_types = GetRoutingInfoTypes(routes); - sync_manager_.UpdateEnabledTypes(enabled_types); - EXPECT_EQ(ModelTypeSetToObjectIdSet(enabled_types), - fake_invalidator_->GetRegisteredIds(&sync_manager_)); -} - -TEST_F(SyncManagerTest, RegisterInvalidationHandler) { - FakeInvalidationHandler fake_handler; - sync_manager_.RegisterInvalidationHandler(&fake_handler); - EXPECT_TRUE(fake_invalidator_->IsHandlerRegistered(&fake_handler)); - - const ObjectIdSet& ids = - ModelTypeSetToObjectIdSet(ModelTypeSet(BOOKMARKS, PREFERENCES)); - sync_manager_.UpdateRegisteredInvalidationIds(&fake_handler, ids); - EXPECT_EQ(ids, fake_invalidator_->GetRegisteredIds(&fake_handler)); - - sync_manager_.UnregisterInvalidationHandler(&fake_handler); - EXPECT_FALSE(fake_invalidator_->IsHandlerRegistered(&fake_handler)); -} - TEST_F(SyncManagerTest, ProcessJsMessage) { const JsArgList kNoArgs; @@ -1362,14 +1326,6 @@ TEST_F(SyncManagerTest, OnInvalidatorStateChangeJsEvents) { base::DictionaryValue auth_error_details; auth_error_details.SetString("status", "CONNECTION_AUTH_ERROR"); - EXPECT_CALL(manager_observer_, - OnConnectionStatusChange(CONNECTION_AUTH_ERROR)); - - EXPECT_CALL( - event_handler, - HandleJsEvent("onConnectionStatusChange", - HasDetailsAsDictionary(auth_error_details))); - EXPECT_CALL(event_handler, HandleJsEvent("onNotificationStateChange", HasDetailsAsDictionary(enabled_details))); @@ -1410,22 +1366,6 @@ TEST_F(SyncManagerTest, OnInvalidatorStateChangeJsEvents) { PumpLoop(); } -// Simulate the invalidator's credentials being rejected. That should -// also clear the sync token. -TEST_F(SyncManagerTest, OnInvalidatorStateChangeCredentialsRejected) { - EXPECT_CALL(manager_observer_, - OnConnectionStatusChange(CONNECTION_AUTH_ERROR)); - - EXPECT_FALSE(sync_manager_.GetHasInvalidAuthTokenForTest()); - - SimulateInvalidatorStateChangeForTest(INVALIDATION_CREDENTIALS_REJECTED); - - EXPECT_TRUE(sync_manager_.GetHasInvalidAuthTokenForTest()); - - // Should trigger the replies. - PumpLoop(); -} - TEST_F(SyncManagerTest, OnIncomingNotification) { StrictMock<MockJsEventHandler> event_handler; diff --git a/sync/internal_api/test/fake_sync_manager.cc b/sync/internal_api/test/fake_sync_manager.cc index 3a9beca..7a6d6a4 100644 --- a/sync/internal_api/test/fake_sync_manager.cc +++ b/sync/internal_api/test/fake_sync_manager.cc @@ -61,25 +61,6 @@ ConfigureReason FakeSyncManager::GetAndResetConfigureReason() { return reason; } -void FakeSyncManager::Invalidate( - const ObjectIdInvalidationMap& invalidation_map) { - if (!sync_task_runner_->PostTask( - FROM_HERE, - base::Bind(&FakeSyncManager::InvalidateOnSyncThread, - base::Unretained(this), invalidation_map))) { - NOTREACHED(); - } -} - -void FakeSyncManager::UpdateInvalidatorState(InvalidatorState state) { - if (!sync_task_runner_->PostTask( - FROM_HERE, - base::Bind(&FakeSyncManager::UpdateInvalidatorStateOnSyncThread, - base::Unretained(this), state))) { - NOTREACHED(); - } -} - void FakeSyncManager::WaitForSyncThread() { // Post a task to |sync_task_runner_| and block until it runs. base::RunLoop run_loop; @@ -103,7 +84,6 @@ void FakeSyncManager::Init( ExtensionsActivityMonitor* extensions_activity_monitor, ChangeDelegate* change_delegate, const SyncCredentials& credentials, - scoped_ptr<Invalidator> invalidator, const std::string& invalidator_client_id, const std::string& restored_key_for_bootstrapping, const std::string& restored_keystore_key_for_bootstrapping, @@ -161,31 +141,6 @@ void FakeSyncManager::UpdateCredentials(const SyncCredentials& credentials) { NOTIMPLEMENTED(); } -void FakeSyncManager::UpdateEnabledTypes(ModelTypeSet types) { - enabled_types_ = types; -} - -void FakeSyncManager::RegisterInvalidationHandler( - InvalidationHandler* handler) { - registrar_.RegisterHandler(handler); -} - -void FakeSyncManager::UpdateRegisteredInvalidationIds( - InvalidationHandler* handler, - const ObjectIdSet& ids) { - registrar_.UpdateRegisteredIds(handler, ids); -} - -void FakeSyncManager::UnregisterInvalidationHandler( - InvalidationHandler* handler) { - registrar_.UnregisterHandler(handler); -} - -void FakeSyncManager::AcknowledgeInvalidation(const invalidation::ObjectId& id, - const AckHandle& ack_handle) { - // Do nothing. -} - void FakeSyncManager::StartSyncingNormally( const ModelSafeRoutingInfo& routing_info) { // Do nothing. @@ -201,7 +156,7 @@ void FakeSyncManager::ConfigureSyncer( const base::Closure& ready_task, const base::Closure& retry_task) { last_configure_reason_ = reason; - ModelTypeSet enabled_types = GetRoutingInfoTypes(new_routing_info); + enabled_types_ = GetRoutingInfoTypes(new_routing_info); ModelTypeSet success_types = to_download; success_types.RemoveAll(configure_fail_types_); @@ -291,20 +246,17 @@ void FakeSyncManager::RefreshTypes(ModelTypeSet types) { last_refresh_request_types_ = types; } -void FakeSyncManager::InvalidateOnSyncThread( - const ObjectIdInvalidationMap& invalidation_map) { - DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); - registrar_.DispatchInvalidationsToHandlers(invalidation_map); -} - -void FakeSyncManager::UpdateInvalidatorStateOnSyncThread( - InvalidatorState state) { - DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); - registrar_.UpdateInvalidatorState(state); +void FakeSyncManager::OnIncomingInvalidation( + const ObjectIdInvalidationMap& invalidation_map) { + // Do nothing. } ModelTypeSet FakeSyncManager::GetLastRefreshRequestTypes() { return last_refresh_request_types_; } +void FakeSyncManager::OnInvalidatorStateChange(InvalidatorState state) { + // Do nothing. +} + } // namespace syncer |