summaryrefslogtreecommitdiffstats
path: root/sync/internal_api
diff options
context:
space:
mode:
authordcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-28 03:17:58 +0000
committerdcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-28 03:17:58 +0000
commita329cb82a4627bea79c0db5dabe09698ad83c27e (patch)
treeca12b48cef0de11d3058bee683e082281f5061ec /sync/internal_api
parent3c6babd32ae5b7e8125ac16ee4e686654bcf59d6 (diff)
downloadchromium_src-a329cb82a4627bea79c0db5dabe09698ad83c27e.zip
chromium_src-a329cb82a4627bea79c0db5dabe09698ad83c27e.tar.gz
chromium_src-a329cb82a4627bea79c0db5dabe09698ad83c27e.tar.bz2
Rename SyncNotifier->Invalidator and SyncNotifierObserver->InvalidationHandler.
This makes the naming more consistent with how the various classes and interfaces are used, since they are not sync-specific anymore. BUG=none TBR=sky Review URL: https://chromiumcodereview.appspot.com/10875064 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153619 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api')
-rw-r--r--sync/internal_api/public/sync_manager.h20
-rw-r--r--sync/internal_api/public/test/fake_sync_manager.h14
-rw-r--r--sync/internal_api/sync_manager_impl.cc42
-rw-r--r--sync/internal_api/sync_manager_impl.h18
-rw-r--r--sync/internal_api/sync_manager_impl_unittest.cc42
-rw-r--r--sync/internal_api/test/fake_sync_manager.cc10
6 files changed, 73 insertions, 73 deletions
diff --git a/sync/internal_api/public/sync_manager.h b/sync/internal_api/public/sync_manager.h
index 5facc1e..dfd3cb3 100644
--- a/sync/internal_api/public/sync_manager.h
+++ b/sync/internal_api/public/sync_manager.h
@@ -38,11 +38,11 @@ struct Experiments;
class ExtensionsActivityMonitor;
class HttpPostProviderFactory;
class InternalComponentsFactory;
+class InvalidationHandler;
+class Invalidator;
class JsBackend;
class JsEventHandler;
class SyncEncryptionHandler;
-class SyncNotifier;
-class SyncNotifierObserver;
class SyncScheduler;
class UnrecoverableErrorHandler;
struct UserShare;
@@ -290,7 +290,7 @@ class SyncManager {
// |model_safe_worker| ownership is given to the SyncManager.
// |user_agent| is a 7-bit ASCII string suitable for use as the User-Agent
// HTTP header. Used internally when collecting stats to classify clients.
- // |sync_notifier| is owned and used to listen for notifications.
+ // |invalidator| is owned and used to listen for invalidations.
// |restored_key_for_bootstrapping| is the key used to boostrap the
// cryptographer
// |keystore_encryption_enabled| determines whether we enable the keystore
@@ -311,7 +311,7 @@ class SyncManager {
ExtensionsActivityMonitor* extensions_activity_monitor,
ChangeDelegate* change_delegate,
const SyncCredentials& credentials,
- scoped_ptr<SyncNotifier> sync_notifier,
+ scoped_ptr<Invalidator> invalidator,
const std::string& restored_key_for_bootstrapping,
const std::string& restored_keystore_key_for_bootstrapping,
scoped_ptr<InternalComponentsFactory> internal_components_factory,
@@ -342,18 +342,18 @@ class SyncManager {
virtual void UpdateEnabledTypes(
const ModelTypeSet& enabled_types) = 0;
- // Forwards to the underlying notifier (see comments in sync_notifier.h).
+ // Forwards to the underlying invalidator (see comments in invalidator.h).
virtual void RegisterInvalidationHandler(
- SyncNotifierObserver* handler) = 0;
+ InvalidationHandler* handler) = 0;
- // Forwards to the underlying notifier (see comments in sync_notifier.h).
+ // Forwards to the underlying notifier (see comments in invalidator.h).
virtual void UpdateRegisteredInvalidationIds(
- SyncNotifierObserver* handler,
+ InvalidationHandler* handler,
const ObjectIdSet& ids) = 0;
- // Forwards to the underlying notifier (see comments in sync_notifier.h).
+ // Forwards to the underlying notifier (see comments in invalidator.h).
virtual void UnregisterInvalidationHandler(
- SyncNotifierObserver* handler) = 0;
+ InvalidationHandler* handler) = 0;
// Put the syncer in normal mode ready to perform nudges and polls.
virtual void StartSyncingNormally(
diff --git a/sync/internal_api/public/test/fake_sync_manager.h b/sync/internal_api/public/test/fake_sync_manager.h
index 604429f..9661659 100644
--- a/sync/internal_api/public/test/fake_sync_manager.h
+++ b/sync/internal_api/public/test/fake_sync_manager.h
@@ -10,7 +10,7 @@
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
#include "sync/internal_api/public/sync_manager.h"
-#include "sync/notifier/sync_notifier_registrar.h"
+#include "sync/notifier/invalidator_registrar.h"
namespace base {
class SequencedTaskRunner;
@@ -81,7 +81,7 @@ class FakeSyncManager : public SyncManager {
ExtensionsActivityMonitor* extensions_activity_monitor,
ChangeDelegate* change_delegate,
const SyncCredentials& credentials,
- scoped_ptr<SyncNotifier> sync_notifier,
+ scoped_ptr<Invalidator> invalidator,
const std::string& restored_key_for_bootstrapping,
const std::string& restored_keystore_key_for_bootstrapping,
scoped_ptr<InternalComponentsFactory> internal_components_factory,
@@ -97,12 +97,12 @@ class FakeSyncManager : public SyncManager {
virtual void UpdateCredentials(const SyncCredentials& credentials) OVERRIDE;
virtual void UpdateEnabledTypes(const ModelTypeSet& types) OVERRIDE;
virtual void RegisterInvalidationHandler(
- SyncNotifierObserver* handler) OVERRIDE;
+ InvalidationHandler* handler) OVERRIDE;
virtual void UpdateRegisteredInvalidationIds(
- SyncNotifierObserver* handler,
+ InvalidationHandler* handler,
const ObjectIdSet& ids) OVERRIDE;
virtual void UnregisterInvalidationHandler(
- SyncNotifierObserver* handler) OVERRIDE;
+ InvalidationHandler* handler) OVERRIDE;
virtual void StartSyncingNormally(
const ModelSafeRoutingInfo& routing_info) OVERRIDE;
virtual void ConfigureSyncer(
@@ -149,8 +149,8 @@ class FakeSyncManager : public SyncManager {
// The set of types that have been enabled.
ModelTypeSet enabled_types_;
- // Faked notifier state.
- SyncNotifierRegistrar registrar_;
+ // Faked invalidator state.
+ InvalidatorRegistrar registrar_;
scoped_ptr<FakeSyncEncryptionHandler> fake_encryption_handler_;
diff --git a/sync/internal_api/sync_manager_impl.cc b/sync/internal_api/sync_manager_impl.cc
index 9e832e7..13f2ae4 100644
--- a/sync/internal_api/sync_manager_impl.cc
+++ b/sync/internal_api/sync_manager_impl.cc
@@ -40,7 +40,7 @@
#include "sync/js/js_event_handler.h"
#include "sync/js/js_reply_handler.h"
#include "sync/notifier/invalidation_util.h"
-#include "sync/notifier/sync_notifier.h"
+#include "sync/notifier/invalidator.h"
#include "sync/protocol/proto_value_conversions.h"
#include "sync/protocol/sync.pb.h"
#include "sync/syncable/directory.h"
@@ -349,7 +349,7 @@ void SyncManagerImpl::Init(
ExtensionsActivityMonitor* extensions_activity_monitor,
SyncManager::ChangeDelegate* change_delegate,
const SyncCredentials& credentials,
- scoped_ptr<SyncNotifier> sync_notifier,
+ scoped_ptr<Invalidator> invalidator,
const std::string& restored_key_for_bootstrapping,
const std::string& restored_keystore_key_for_bootstrapping,
scoped_ptr<InternalComponentsFactory> internal_components_factory,
@@ -369,8 +369,8 @@ void SyncManagerImpl::Init(
change_delegate_ = change_delegate;
- sync_notifier_ = sync_notifier.Pass();
- sync_notifier_->RegisterHandler(this);
+ invalidator_ = invalidator.Pass();
+ invalidator_->RegisterHandler(this);
AddObserver(&js_sync_manager_observer_);
SetJsEventHandler(event_handler);
@@ -425,7 +425,7 @@ void SyncManagerImpl::Init(
std::string unique_id = directory()->cache_guid();
DVLOG(1) << "Read notification unique ID: " << unique_id;
allstatus_.SetUniqueId(unique_id);
- sync_notifier_->SetUniqueId(unique_id);
+ invalidator_->SetUniqueId(unique_id);
std::string state = directory()->GetNotificationState();
if (VLOG_IS_ON(1)) {
@@ -436,7 +436,7 @@ void SyncManagerImpl::Init(
// TODO(tim): Remove once invalidation state has been migrated to new
// InvalidationStateTracker store. Bug 124140.
- sync_notifier_->SetStateDeprecated(state);
+ invalidator_->SetStateDeprecated(state);
// Build a SyncSessionContext and store the worker in it.
DVLOG(1) << "Sync is bringing up SyncSessionContext.";
@@ -653,7 +653,7 @@ void SyncManagerImpl::UpdateCredentials(
if (!connection_manager_->set_auth_token(credentials.sync_token))
return; // Auth token is known to be invalid, so exit early.
- sync_notifier_->UpdateCredentials(credentials.email, credentials.sync_token);
+ invalidator_->UpdateCredentials(credentials.email, credentials.sync_token);
scheduler_->OnCredentialsUpdated();
}
@@ -661,31 +661,31 @@ void SyncManagerImpl::UpdateEnabledTypes(
const ModelTypeSet& enabled_types) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(initialized_);
- sync_notifier_->UpdateRegisteredIds(
+ invalidator_->UpdateRegisteredIds(
this,
ModelTypeSetToObjectIdSet(enabled_types));
}
void SyncManagerImpl::RegisterInvalidationHandler(
- SyncNotifierObserver* handler) {
+ InvalidationHandler* handler) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(initialized_);
- sync_notifier_->RegisterHandler(handler);
+ invalidator_->RegisterHandler(handler);
}
void SyncManagerImpl::UpdateRegisteredInvalidationIds(
- SyncNotifierObserver* handler,
+ InvalidationHandler* handler,
const ObjectIdSet& ids) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(initialized_);
- sync_notifier_->UpdateRegisteredIds(handler, ids);
+ invalidator_->UpdateRegisteredIds(handler, ids);
}
void SyncManagerImpl::UnregisterInvalidationHandler(
- SyncNotifierObserver* handler) {
+ InvalidationHandler* handler) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(initialized_);
- sync_notifier_->UnregisterHandler(handler);
+ invalidator_->UnregisterHandler(handler);
}
bool SyncManagerImpl::GetKeystoreKeyBootstrapToken(std::string* token) {
@@ -731,14 +731,14 @@ void SyncManagerImpl::ShutdownOnSyncThread() {
RemoveObserver(&debug_info_event_listener_);
- // |sync_notifier_| and |connection_manager_| may end up being NULL here in
+ // |invalidator_| and |connection_manager_| may end up being NULL here in
// tests (in synchronous initialization mode).
//
// TODO(akalin): Fix this behavior.
- if (sync_notifier_.get())
- sync_notifier_->UnregisterHandler(this);
- sync_notifier_.reset();
+ if (invalidator_.get())
+ invalidator_->UnregisterHandler(this);
+ invalidator_.reset();
if (connection_manager_.get())
connection_manager_->RemoveListener(this);
@@ -1019,12 +1019,12 @@ void SyncManagerImpl::OnSyncEngineEvent(const SyncEngineEvent& event) {
bool is_notifiable_commit =
(event.snapshot.model_neutral_state().num_successful_commits > 0);
if (is_notifiable_commit) {
- if (sync_notifier_.get()) {
+ if (invalidator_.get()) {
const ModelTypeSet changed_types =
ModelTypeStateMapToSet(event.snapshot.source().types);
- sync_notifier_->SendNotification(changed_types);
+ invalidator_->SendNotification(changed_types);
} else {
- DVLOG(1) << "Not sending notification: sync_notifier_ is NULL";
+ DVLOG(1) << "Not sending notification: invalidator_ is NULL";
}
}
}
diff --git a/sync/internal_api/sync_manager_impl.h b/sync/internal_api/sync_manager_impl.h
index 3a44969..7fa917e7 100644
--- a/sync/internal_api/sync_manager_impl.h
+++ b/sync/internal_api/sync_manager_impl.h
@@ -22,8 +22,8 @@
#include "sync/internal_api/public/sync_manager.h"
#include "sync/internal_api/sync_encryption_handler_impl.h"
#include "sync/js/js_backend.h"
+#include "sync/notifier/invalidation_handler.h"
#include "sync/notifier/notifications_disabled_reason.h"
-#include "sync/notifier/sync_notifier_observer.h"
#include "sync/syncable/directory_change_delegate.h"
#include "sync/util/cryptographer.h"
#include "sync/util/time.h"
@@ -48,7 +48,7 @@ class SyncSessionContext;
// same thread.
class SyncManagerImpl : public SyncManager,
public net::NetworkChangeNotifier::IPAddressObserver,
- public SyncNotifierObserver,
+ public InvalidationHandler,
public JsBackend,
public SyncEngineEventListener,
public ServerConnectionEventListener,
@@ -72,7 +72,7 @@ class SyncManagerImpl : public SyncManager,
ExtensionsActivityMonitor* extensions_activity_monitor,
SyncManager::ChangeDelegate* change_delegate,
const SyncCredentials& credentials,
- scoped_ptr<SyncNotifier> sync_notifier,
+ scoped_ptr<Invalidator> invalidator,
const std::string& restored_key_for_bootstrapping,
const std::string& restored_keystore_key_for_bootstrapping,
scoped_ptr<InternalComponentsFactory> internal_components_factory,
@@ -89,12 +89,12 @@ class SyncManagerImpl : public SyncManager,
virtual void UpdateEnabledTypes(
const ModelTypeSet& enabled_types) OVERRIDE;
virtual void RegisterInvalidationHandler(
- SyncNotifierObserver* handler) OVERRIDE;
+ InvalidationHandler* handler) OVERRIDE;
virtual void UpdateRegisteredInvalidationIds(
- SyncNotifierObserver* handler,
+ InvalidationHandler* handler,
const ObjectIdSet& ids) OVERRIDE;
virtual void UnregisterInvalidationHandler(
- SyncNotifierObserver* handler) OVERRIDE;
+ InvalidationHandler* handler) OVERRIDE;
virtual void StartSyncingNormally(
const ModelSafeRoutingInfo& routing_info) OVERRIDE;
virtual void ConfigureSyncer(
@@ -167,7 +167,7 @@ class SyncManagerImpl : public SyncManager,
const syncable::ImmutableWriteTransactionInfo& write_transaction_info,
syncable::BaseTransaction* trans) OVERRIDE;
- // SyncNotifierObserver implementation.
+ // InvalidationHandler implementation.
virtual void OnNotificationsEnabled() OVERRIDE;
virtual void OnNotificationsDisabled(
NotificationsDisabledReason reason) OVERRIDE;
@@ -332,8 +332,8 @@ class SyncManagerImpl : public SyncManager,
// Start()ed.
scoped_ptr<SyncScheduler> scheduler_;
- // The SyncNotifier which notifies us when updates need to be downloaded.
- scoped_ptr<SyncNotifier> sync_notifier_;
+ // 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.
diff --git a/sync/internal_api/sync_manager_impl_unittest.cc b/sync/internal_api/sync_manager_impl_unittest.cc
index b64ecc3..2d133a1 100644
--- a/sync/internal_api/sync_manager_impl_unittest.cc
+++ b/sync/internal_api/sync_manager_impl_unittest.cc
@@ -44,10 +44,10 @@
#include "sync/js/js_event_handler.h"
#include "sync/js/js_reply_handler.h"
#include "sync/js/js_test_util.h"
-#include "sync/notifier/fake_sync_notifier.h"
-#include "sync/notifier/fake_sync_notifier_observer.h"
-#include "sync/notifier/sync_notifier.h"
-#include "sync/notifier/sync_notifier_observer.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"
#include "sync/protocol/encryption.pb.h"
#include "sync/protocol/extension_specifics.pb.h"
@@ -718,14 +718,14 @@ class SyncManagerTest : public testing::Test,
};
SyncManagerTest()
- : fake_notifier_(NULL),
+ : fake_invalidator_(NULL),
sync_manager_("Test sync manager") {
switches_.encryption_method =
InternalComponentsFactory::ENCRYPTION_KEYSTORE;
}
virtual ~SyncManagerTest() {
- EXPECT_FALSE(fake_notifier_);
+ EXPECT_FALSE(fake_invalidator_);
}
// Test implementation.
@@ -736,7 +736,7 @@ class SyncManagerTest : public testing::Test,
credentials.email = "foo@bar.com";
credentials.sync_token = "sometoken";
- fake_notifier_ = new FakeSyncNotifier();
+ fake_invalidator_ = new FakeInvalidator();
sync_manager_.AddObserver(&manager_observer_);
EXPECT_CALL(manager_observer_, OnInitializationComplete(_, _, _)).
@@ -748,7 +748,7 @@ class SyncManagerTest : public testing::Test,
ModelSafeRoutingInfo routing_info;
GetModelSafeRoutingInfo(&routing_info);
- // Takes ownership of |fake_notifier_|.
+ // Takes ownership of |fake_invalidator_|.
sync_manager_.Init(temp_dir_.path(),
WeakHandle<JsEventHandler>(),
"bogus", 0, false,
@@ -757,7 +757,7 @@ class SyncManagerTest : public testing::Test,
new TestHttpPostProviderFactory()),
workers, &extensions_activity_monitor_, this,
credentials,
- scoped_ptr<SyncNotifier>(fake_notifier_),
+ scoped_ptr<Invalidator>(fake_invalidator_),
"", "", // bootstrap tokens
scoped_ptr<InternalComponentsFactory>(GetFactory()),
&encryptor_,
@@ -775,16 +775,16 @@ class SyncManagerTest : public testing::Test,
}
PumpLoop();
- EXPECT_TRUE(fake_notifier_->IsHandlerRegistered(&sync_manager_));
+ 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_notifier_| anymore because |fake_notifier_| is now
+ // |fake_invalidator_| anymore because |fake_invalidator_| is now
// destroyed.
- fake_notifier_ = NULL;
+ fake_invalidator_ = NULL;
PumpLoop();
}
@@ -957,7 +957,7 @@ class SyncManagerTest : public testing::Test,
protected:
FakeEncryptor encryptor_;
TestUnrecoverableErrorHandler handler_;
- FakeSyncNotifier* fake_notifier_;
+ FakeInvalidator* fake_invalidator_;
SyncManagerImpl sync_manager_;
WeakHandle<JsBackend> js_backend_;
StrictMock<SyncManagerObserverMock> manager_observer_;
@@ -971,21 +971,21 @@ TEST_F(SyncManagerTest, UpdateEnabledTypes) {
const ModelTypeSet enabled_types = GetRoutingInfoTypes(routes);
sync_manager_.UpdateEnabledTypes(enabled_types);
EXPECT_EQ(ModelTypeSetToObjectIdSet(enabled_types),
- fake_notifier_->GetRegisteredIds(&sync_manager_));
+ fake_invalidator_->GetRegisteredIds(&sync_manager_));
}
TEST_F(SyncManagerTest, RegisterInvalidationHandler) {
- FakeSyncNotifierObserver fake_observer;
- sync_manager_.RegisterInvalidationHandler(&fake_observer);
- EXPECT_TRUE(fake_notifier_->IsHandlerRegistered(&fake_observer));
+ 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_observer, ids);
- EXPECT_EQ(ids, fake_notifier_->GetRegisteredIds(&fake_observer));
+ sync_manager_.UpdateRegisteredInvalidationIds(&fake_handler, ids);
+ EXPECT_EQ(ids, fake_invalidator_->GetRegisteredIds(&fake_handler));
- sync_manager_.UnregisterInvalidationHandler(&fake_observer);
- EXPECT_FALSE(fake_notifier_->IsHandlerRegistered(&fake_observer));
+ sync_manager_.UnregisterInvalidationHandler(&fake_handler);
+ EXPECT_FALSE(fake_invalidator_->IsHandlerRegistered(&fake_handler));
}
TEST_F(SyncManagerTest, ProcessJsMessage) {
diff --git a/sync/internal_api/test/fake_sync_manager.cc b/sync/internal_api/test/fake_sync_manager.cc
index 6bf55fc..299bb41 100644
--- a/sync/internal_api/test/fake_sync_manager.cc
+++ b/sync/internal_api/test/fake_sync_manager.cc
@@ -17,8 +17,8 @@
#include "sync/internal_api/public/internal_components_factory.h"
#include "sync/internal_api/public/util/weak_handle.h"
#include "sync/notifier/notifications_disabled_reason.h"
+#include "sync/notifier/invalidator.h"
#include "sync/notifier/object_id_state_map.h"
-#include "sync/notifier/sync_notifier.h"
#include "sync/test/fake_sync_encryption_handler.h"
namespace syncer {
@@ -111,7 +111,7 @@ void FakeSyncManager::Init(
ExtensionsActivityMonitor* extensions_activity_monitor,
ChangeDelegate* change_delegate,
const SyncCredentials& credentials,
- scoped_ptr<SyncNotifier> sync_notifier,
+ scoped_ptr<Invalidator> invalidator,
const std::string& restored_key_for_bootstrapping,
const std::string& restored_keystore_key_for_bootstrapping,
scoped_ptr<InternalComponentsFactory> internal_components_factory,
@@ -163,18 +163,18 @@ void FakeSyncManager::UpdateEnabledTypes(const ModelTypeSet& types) {
}
void FakeSyncManager::RegisterInvalidationHandler(
- SyncNotifierObserver* handler) {
+ InvalidationHandler* handler) {
registrar_.RegisterHandler(handler);
}
void FakeSyncManager::UpdateRegisteredInvalidationIds(
- SyncNotifierObserver* handler,
+ InvalidationHandler* handler,
const ObjectIdSet& ids) {
registrar_.UpdateRegisteredIds(handler, ids);
}
void FakeSyncManager::UnregisterInvalidationHandler(
- SyncNotifierObserver* handler) {
+ InvalidationHandler* handler) {
registrar_.UnregisterHandler(handler);
}