summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
Diffstat (limited to 'sync')
-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
-rw-r--r--sync/notifier/fake_invalidation_handler.cc (renamed from sync/notifier/fake_sync_notifier_observer.cc)20
-rw-r--r--sync/notifier/fake_invalidation_handler.h (renamed from sync/notifier/fake_sync_notifier_observer.h)10
-rw-r--r--sync/notifier/fake_invalidator.cc73
-rw-r--r--sync/notifier/fake_invalidator.h (renamed from sync/notifier/fake_sync_notifier.h)28
-rw-r--r--sync/notifier/fake_sync_notifier.cc74
-rw-r--r--sync/notifier/invalidation_handler.h (renamed from sync/notifier/sync_notifier_observer.h)10
-rw-r--r--sync/notifier/invalidation_notifier.cc8
-rw-r--r--sync/notifier/invalidation_notifier.h19
-rw-r--r--sync/notifier/invalidation_notifier_unittest.cc22
-rw-r--r--sync/notifier/invalidator.h (renamed from sync/notifier/sync_notifier.h)38
-rw-r--r--sync/notifier/invalidator_factory.cc (renamed from sync/notifier/sync_notifier_factory.cc)30
-rw-r--r--sync/notifier/invalidator_factory.h (renamed from sync/notifier/sync_notifier_factory.h)20
-rw-r--r--sync/notifier/invalidator_factory_unittest.cc (renamed from sync/notifier/sync_notifier_factory_unittest.cc)46
-rw-r--r--sync/notifier/invalidator_registrar.cc (renamed from sync/notifier/sync_notifier_registrar.cc)46
-rw-r--r--sync/notifier/invalidator_registrar.h (renamed from sync/notifier/sync_notifier_registrar.h)35
-rw-r--r--sync/notifier/invalidator_registrar_unittest.cc (renamed from sync/notifier/sync_notifier_registrar_unittest.cc)42
-rw-r--r--sync/notifier/non_blocking_invalidator.cc (renamed from sync/notifier/non_blocking_invalidation_notifier.cc)98
-rw-r--r--sync/notifier/non_blocking_invalidator.h (renamed from sync/notifier/non_blocking_invalidation_notifier.h)46
-rw-r--r--sync/notifier/non_blocking_invalidator_unittest.cc (renamed from sync/notifier/non_blocking_invalidation_notifier_unittest.cc)32
-rw-r--r--sync/notifier/p2p_invalidator.cc (renamed from sync/notifier/p2p_notifier.cc)34
-rw-r--r--sync/notifier/p2p_invalidator.h (renamed from sync/notifier/p2p_notifier.h)34
-rw-r--r--sync/notifier/p2p_invalidator_unittest.cc (renamed from sync/notifier/p2p_notifier_unittest.cc)86
-rw-r--r--sync/sync.gyp36
-rw-r--r--sync/tools/sync_client.cc10
-rw-r--r--sync/tools/sync_listen_notifications.cc24
31 files changed, 530 insertions, 537 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);
}
diff --git a/sync/notifier/fake_sync_notifier_observer.cc b/sync/notifier/fake_invalidation_handler.cc
index b95f9a9..6c06587 100644
--- a/sync/notifier/fake_sync_notifier_observer.cc
+++ b/sync/notifier/fake_invalidation_handler.cc
@@ -2,46 +2,46 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sync/notifier/fake_sync_notifier_observer.h"
+#include "sync/notifier/fake_invalidation_handler.h"
namespace syncer {
-FakeSyncNotifierObserver::FakeSyncNotifierObserver()
+FakeInvalidationHandler::FakeInvalidationHandler()
: reason_(TRANSIENT_NOTIFICATION_ERROR),
last_source_(LOCAL_NOTIFICATION),
notification_count_(0) {}
-FakeSyncNotifierObserver::~FakeSyncNotifierObserver() {}
+FakeInvalidationHandler::~FakeInvalidationHandler() {}
NotificationsDisabledReason
-FakeSyncNotifierObserver::GetNotificationsDisabledReason() const {
+FakeInvalidationHandler::GetNotificationsDisabledReason() const {
return reason_;
}
const ObjectIdStateMap&
-FakeSyncNotifierObserver::GetLastNotificationIdStateMap() const {
+FakeInvalidationHandler::GetLastNotificationIdStateMap() const {
return last_id_state_map_;
}
IncomingNotificationSource
-FakeSyncNotifierObserver::GetLastNotificationSource() const {
+FakeInvalidationHandler::GetLastNotificationSource() const {
return last_source_;
}
-int FakeSyncNotifierObserver::GetNotificationCount() const {
+int FakeInvalidationHandler::GetNotificationCount() const {
return notification_count_;
}
-void FakeSyncNotifierObserver::OnNotificationsEnabled() {
+void FakeInvalidationHandler::OnNotificationsEnabled() {
reason_ = NO_NOTIFICATION_ERROR;
}
-void FakeSyncNotifierObserver::OnNotificationsDisabled(
+void FakeInvalidationHandler::OnNotificationsDisabled(
NotificationsDisabledReason reason) {
reason_ = reason;
}
-void FakeSyncNotifierObserver::OnIncomingNotification(
+void FakeInvalidationHandler::OnIncomingNotification(
const ObjectIdStateMap& id_state_map,
IncomingNotificationSource source) {
last_id_state_map_ = id_state_map;
diff --git a/sync/notifier/fake_sync_notifier_observer.h b/sync/notifier/fake_invalidation_handler.h
index e1195d9..1d9dcfbd 100644
--- a/sync/notifier/fake_sync_notifier_observer.h
+++ b/sync/notifier/fake_invalidation_handler.h
@@ -8,21 +8,21 @@
#include <string>
#include "base/compiler_specific.h"
-#include "sync/notifier/sync_notifier_observer.h"
+#include "sync/notifier/invalidation_handler.h"
namespace syncer {
-class FakeSyncNotifierObserver : public SyncNotifierObserver {
+class FakeInvalidationHandler : public InvalidationHandler {
public:
- FakeSyncNotifierObserver();
- virtual ~FakeSyncNotifierObserver();
+ FakeInvalidationHandler();
+ virtual ~FakeInvalidationHandler();
NotificationsDisabledReason GetNotificationsDisabledReason() const;
const ObjectIdStateMap& GetLastNotificationIdStateMap() const;
IncomingNotificationSource GetLastNotificationSource() const;
int GetNotificationCount() const;
- // SyncNotifierObserver implementation.
+ // InvalidationHandler implementation.
virtual void OnNotificationsEnabled() OVERRIDE;
virtual void OnNotificationsDisabled(
NotificationsDisabledReason reason) OVERRIDE;
diff --git a/sync/notifier/fake_invalidator.cc b/sync/notifier/fake_invalidator.cc
new file mode 100644
index 0000000..85696ad
--- /dev/null
+++ b/sync/notifier/fake_invalidator.cc
@@ -0,0 +1,73 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "sync/notifier/fake_invalidator.h"
+
+namespace syncer {
+
+FakeInvalidator::FakeInvalidator() {}
+
+FakeInvalidator::~FakeInvalidator() {}
+
+bool FakeInvalidator::IsHandlerRegistered(InvalidationHandler* handler) const {
+ return registrar_.IsHandlerRegisteredForTest(handler);
+}
+
+ObjectIdSet FakeInvalidator::GetRegisteredIds(
+ InvalidationHandler* handler) const {
+ return registrar_.GetRegisteredIdsForTest(handler);
+}
+
+void FakeInvalidator::RegisterHandler(InvalidationHandler* handler) {
+ registrar_.RegisterHandler(handler);
+}
+
+const std::string& FakeInvalidator::GetUniqueId() const {
+ return unique_id_;
+}
+
+const std::string& FakeInvalidator::GetStateDeprecated() const {
+ return state_;
+}
+
+const std::string& FakeInvalidator::GetCredentialsEmail() const {
+ return email_;
+}
+
+const std::string& FakeInvalidator::GetCredentialsToken() const {
+ return token_;
+}
+
+ModelTypeSet FakeInvalidator::GetLastChangedTypes() const {
+ return last_changed_types_;
+}
+
+void FakeInvalidator::UpdateRegisteredIds(InvalidationHandler* handler,
+ const ObjectIdSet& ids) {
+ registrar_.UpdateRegisteredIds(handler, ids);
+}
+
+void FakeInvalidator::UnregisterHandler(InvalidationHandler* handler) {
+ registrar_.UnregisterHandler(handler);
+}
+
+void FakeInvalidator::SetUniqueId(const std::string& unique_id) {
+ unique_id_ = unique_id;
+}
+
+void FakeInvalidator::SetStateDeprecated(const std::string& state) {
+ state_ = state;
+}
+
+void FakeInvalidator::UpdateCredentials(
+ const std::string& email, const std::string& token) {
+ email_ = email;
+ token_ = token;
+}
+
+void FakeInvalidator::SendNotification(ModelTypeSet changed_types) {
+ last_changed_types_ = changed_types;
+}
+
+} // namespace syncer
diff --git a/sync/notifier/fake_sync_notifier.h b/sync/notifier/fake_invalidator.h
index 74cfdf1..26c5ad8 100644
--- a/sync/notifier/fake_sync_notifier.h
+++ b/sync/notifier/fake_invalidator.h
@@ -2,35 +2,35 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef SYNC_NOTIFIER_FAKE_SYNC_NOTIFIER_H_
-#define SYNC_NOTIFIER_FAKE_SYNC_NOTIFIER_H_
+#ifndef SYNC_NOTIFIER_FAKE_INVALIDATOR_H_
+#define SYNC_NOTIFIER_FAKE_INVALIDATOR_H_
#include <string>
#include "base/compiler_specific.h"
#include "sync/notifier/invalidation_util.h"
-#include "sync/notifier/sync_notifier.h"
-#include "sync/notifier/sync_notifier_registrar.h"
+#include "sync/notifier/invalidator.h"
+#include "sync/notifier/invalidator_registrar.h"
namespace syncer {
-class FakeSyncNotifier : public SyncNotifier {
+class FakeInvalidator : public Invalidator {
public:
- FakeSyncNotifier();
- virtual ~FakeSyncNotifier();
+ FakeInvalidator();
+ virtual ~FakeInvalidator();
- bool IsHandlerRegistered(SyncNotifierObserver* handler) const;
- ObjectIdSet GetRegisteredIds(SyncNotifierObserver* handler) const;
+ bool IsHandlerRegistered(InvalidationHandler* handler) const;
+ ObjectIdSet GetRegisteredIds(InvalidationHandler* handler) const;
const std::string& GetUniqueId() const;
const std::string& GetStateDeprecated() const;
const std::string& GetCredentialsEmail() const;
const std::string& GetCredentialsToken() const;
ModelTypeSet GetLastChangedTypes() const;
- virtual void RegisterHandler(SyncNotifierObserver* handler) OVERRIDE;
- virtual void UpdateRegisteredIds(SyncNotifierObserver* handler,
+ virtual void RegisterHandler(InvalidationHandler* handler) OVERRIDE;
+ virtual void UpdateRegisteredIds(InvalidationHandler* handler,
const ObjectIdSet& ids) OVERRIDE;
- virtual void UnregisterHandler(SyncNotifierObserver* handler) OVERRIDE;
+ virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE;
virtual void SetUniqueId(const std::string& unique_id) OVERRIDE;
virtual void SetStateDeprecated(const std::string& state) OVERRIDE;
virtual void UpdateCredentials(
@@ -38,7 +38,7 @@ class FakeSyncNotifier : public SyncNotifier {
virtual void SendNotification(ModelTypeSet changed_types) OVERRIDE;
private:
- SyncNotifierRegistrar registrar_;
+ InvalidatorRegistrar registrar_;
std::string unique_id_;
std::string state_;
std::string email_;
@@ -48,4 +48,4 @@ class FakeSyncNotifier : public SyncNotifier {
} // namespace syncer
-#endif // SYNC_NOTIFIER_FAKE_SYNC_NOTIFIER_H_
+#endif // SYNC_NOTIFIER_FAKE_INVALIDATOR_H_
diff --git a/sync/notifier/fake_sync_notifier.cc b/sync/notifier/fake_sync_notifier.cc
deleted file mode 100644
index 0ef5ef9..0000000
--- a/sync/notifier/fake_sync_notifier.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "sync/notifier/fake_sync_notifier.h"
-
-namespace syncer {
-
-FakeSyncNotifier::FakeSyncNotifier() {}
-
-FakeSyncNotifier::~FakeSyncNotifier() {}
-
-bool FakeSyncNotifier::IsHandlerRegistered(
- SyncNotifierObserver* handler) const {
- return registrar_.IsHandlerRegisteredForTest(handler);
-}
-
-ObjectIdSet FakeSyncNotifier::GetRegisteredIds(
- SyncNotifierObserver* handler) const {
- return registrar_.GetRegisteredIdsForTest(handler);
-}
-
-void FakeSyncNotifier::RegisterHandler(SyncNotifierObserver* handler) {
- registrar_.RegisterHandler(handler);
-}
-
-const std::string& FakeSyncNotifier::GetUniqueId() const {
- return unique_id_;
-}
-
-const std::string& FakeSyncNotifier::GetStateDeprecated() const {
- return state_;
-}
-
-const std::string& FakeSyncNotifier::GetCredentialsEmail() const {
- return email_;
-}
-
-const std::string& FakeSyncNotifier::GetCredentialsToken() const {
- return token_;
-}
-
-ModelTypeSet FakeSyncNotifier::GetLastChangedTypes() const {
- return last_changed_types_;
-}
-
-void FakeSyncNotifier::UpdateRegisteredIds(SyncNotifierObserver* handler,
- const ObjectIdSet& ids) {
- registrar_.UpdateRegisteredIds(handler, ids);
-}
-
-void FakeSyncNotifier::UnregisterHandler(SyncNotifierObserver* handler) {
- registrar_.UnregisterHandler(handler);
-}
-
-void FakeSyncNotifier::SetUniqueId(const std::string& unique_id) {
- unique_id_ = unique_id;
-}
-
-void FakeSyncNotifier::SetStateDeprecated(const std::string& state) {
- state_ = state;
-}
-
-void FakeSyncNotifier::UpdateCredentials(
- const std::string& email, const std::string& token) {
- email_ = email;
- token_ = token;
-}
-
-void FakeSyncNotifier::SendNotification(ModelTypeSet changed_types) {
- last_changed_types_ = changed_types;
-}
-
-} // namespace syncer
diff --git a/sync/notifier/sync_notifier_observer.h b/sync/notifier/invalidation_handler.h
index 1dd5ea6..c1252ac 100644
--- a/sync/notifier/sync_notifier_observer.h
+++ b/sync/notifier/invalidation_handler.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef SYNC_NOTIFIER_SYNC_NOTIFIER_OBSERVER_H_
-#define SYNC_NOTIFIER_SYNC_NOTIFIER_OBSERVER_H_
+#ifndef SYNC_NOTIFIER_INVALIDATION_HANDLER_H_
+#define SYNC_NOTIFIER_INVALIDATION_HANDLER_H_
#include "sync/notifier/object_id_state_map.h"
#include "sync/notifier/notifications_disabled_reason.h"
@@ -17,7 +17,7 @@ enum IncomingNotificationSource {
LOCAL_NOTIFICATION,
};
-class SyncNotifierObserver {
+class InvalidationHandler {
public:
// Called when notifications are enabled.
virtual void OnNotificationsEnabled() = 0;
@@ -34,9 +34,9 @@ class SyncNotifierObserver {
IncomingNotificationSource source) = 0;
protected:
- virtual ~SyncNotifierObserver() {}
+ virtual ~InvalidationHandler() {}
};
} // namespace syncer
-#endif // SYNC_NOTIFIER_SYNC_NOTIFIER_OBSERVER_H_
+#endif // SYNC_NOTIFIER_INVALIDATION_HANDLER_H_
diff --git a/sync/notifier/invalidation_notifier.cc b/sync/notifier/invalidation_notifier.cc
index f56bbd6..0775d74 100644
--- a/sync/notifier/invalidation_notifier.cc
+++ b/sync/notifier/invalidation_notifier.cc
@@ -11,7 +11,7 @@
#include "google/cacheinvalidation/include/invalidation-client-factory.h"
#include "jingle/notifier/listener/push_client.h"
#include "net/url_request/url_request_context.h"
-#include "sync/notifier/sync_notifier_observer.h"
+#include "sync/notifier/invalidation_handler.h"
#include "talk/xmpp/jid.h"
#include "talk/xmpp/xmppclientsettings.h"
@@ -35,19 +35,19 @@ InvalidationNotifier::~InvalidationNotifier() {
DCHECK(CalledOnValidThread());
}
-void InvalidationNotifier::RegisterHandler(SyncNotifierObserver* handler) {
+void InvalidationNotifier::RegisterHandler(InvalidationHandler* handler) {
DCHECK(CalledOnValidThread());
registrar_.RegisterHandler(handler);
}
-void InvalidationNotifier::UpdateRegisteredIds(SyncNotifierObserver* handler,
+void InvalidationNotifier::UpdateRegisteredIds(InvalidationHandler* handler,
const ObjectIdSet& ids) {
DCHECK(CalledOnValidThread());
registrar_.UpdateRegisteredIds(handler, ids);
invalidation_client_.UpdateRegisteredIds(registrar_.GetAllRegisteredIds());
}
-void InvalidationNotifier::UnregisterHandler(SyncNotifierObserver* handler) {
+void InvalidationNotifier::UnregisterHandler(InvalidationHandler* handler) {
DCHECK(CalledOnValidThread());
registrar_.UnregisterHandler(handler);
}
diff --git a/sync/notifier/invalidation_notifier.h b/sync/notifier/invalidation_notifier.h
index 91c16c3..79bc4ae 100644
--- a/sync/notifier/invalidation_notifier.h
+++ b/sync/notifier/invalidation_notifier.h
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// An implementation of SyncNotifier that wraps an invalidation
+// An implementation of Invalidator that wraps an invalidation
// client. Handles the details of connecting to XMPP and hooking it
// up to the invalidation client.
//
@@ -22,8 +22,8 @@
#include "sync/internal_api/public/util/weak_handle.h"
#include "sync/notifier/chrome_invalidation_client.h"
#include "sync/notifier/invalidation_state_tracker.h"
-#include "sync/notifier/sync_notifier.h"
-#include "sync/notifier/sync_notifier_registrar.h"
+#include "sync/notifier/invalidator.h"
+#include "sync/notifier/invalidator_registrar.h"
namespace notifier {
class PushClient;
@@ -32,8 +32,9 @@ class PushClient;
namespace syncer {
// This class must live on the IO thread.
+// TODO(dcheng): Think of a name better than InvalidationInvalidator.
class InvalidationNotifier
- : public SyncNotifier,
+ : public Invalidator,
public ChromeInvalidationClient::Listener,
public base::NonThreadSafe {
public:
@@ -48,11 +49,11 @@ class InvalidationNotifier
virtual ~InvalidationNotifier();
- // SyncNotifier implementation.
- virtual void RegisterHandler(SyncNotifierObserver* handler) OVERRIDE;
- virtual void UpdateRegisteredIds(SyncNotifierObserver* handler,
+ // Invalidator implementation.
+ virtual void RegisterHandler(InvalidationHandler* handler) OVERRIDE;
+ virtual void UpdateRegisteredIds(InvalidationHandler* handler,
const ObjectIdSet& ids) OVERRIDE;
- virtual void UnregisterHandler(SyncNotifierObserver* handler) OVERRIDE;
+ virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE;
virtual void SetUniqueId(const std::string& unique_id) OVERRIDE;
virtual void SetStateDeprecated(const std::string& state) OVERRIDE;
virtual void UpdateCredentials(
@@ -77,7 +78,7 @@ class InvalidationNotifier
};
State state_;
- SyncNotifierRegistrar registrar_;
+ InvalidatorRegistrar registrar_;
// Passed to |invalidation_client_|.
const InvalidationVersionMap initial_max_invalidation_versions_;
diff --git a/sync/notifier/invalidation_notifier_unittest.cc b/sync/notifier/invalidation_notifier_unittest.cc
index 6ced3ef..563e7ec 100644
--- a/sync/notifier/invalidation_notifier_unittest.cc
+++ b/sync/notifier/invalidation_notifier_unittest.cc
@@ -13,8 +13,8 @@
#include "sync/internal_api/public/base/model_type.h"
#include "sync/internal_api/public/base/model_type_state_map.h"
#include "sync/internal_api/public/util/weak_handle.h"
+#include "sync/notifier/fake_invalidation_handler.h"
#include "sync/notifier/fake_invalidation_state_tracker.h"
-#include "sync/notifier/fake_sync_notifier_observer.h"
#include "sync/notifier/invalidation_state_tracker.h"
#include "sync/notifier/object_id_state_map_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -35,7 +35,7 @@ class InvalidationNotifierTest : public testing::Test {
}
// Constructs an InvalidationNotifier, places it in |invalidation_notifier_|,
- // and registers |fake_observer_| as a handler. This remains in place until
+ // and registers |fake_handler_| as a handler. This remains in place until
// either TearDown (automatic) or ResetNotifier (manual) is called.
void CreateNotifier(
const std::string& initial_invalidation_state) {
@@ -50,11 +50,11 @@ class InvalidationNotifierTest : public testing::Test {
initial_invalidation_state,
MakeWeakHandle(fake_tracker_.AsWeakPtr()),
"fake_client_info"));
- invalidation_notifier_->RegisterHandler(&fake_observer_);
+ invalidation_notifier_->RegisterHandler(&fake_handler_);
}
void ResetNotifier() {
- invalidation_notifier_->UnregisterHandler(&fake_observer_);
+ invalidation_notifier_->UnregisterHandler(&fake_handler_);
// Stopping the invalidation notifier stops its scheduler, which deletes any
// pending tasks without running them. Some tasks "run and delete" another
// task, so they must be run in order to avoid leaking the inner task.
@@ -76,7 +76,7 @@ class InvalidationNotifierTest : public testing::Test {
protected:
scoped_ptr<InvalidationNotifier> invalidation_notifier_;
FakeInvalidationStateTracker fake_tracker_;
- FakeSyncNotifierObserver fake_observer_;
+ FakeInvalidationHandler fake_handler_;
};
TEST_F(InvalidationNotifierTest, Basic) {
@@ -88,7 +88,7 @@ TEST_F(InvalidationNotifierTest, Basic) {
ModelTypeSetToStateMap(models, "payload"));
invalidation_notifier_->UpdateRegisteredIds(
- &fake_observer_, ModelTypeSetToObjectIdSet(models));
+ &fake_handler_, ModelTypeSetToObjectIdSet(models));
// TODO(tim): This call should be a no-op, Remove once bug 124140 and
// associated issues are fixed.
@@ -101,22 +101,22 @@ TEST_F(InvalidationNotifierTest, Basic) {
invalidation_notifier_->OnNotificationsEnabled();
EXPECT_EQ(NO_NOTIFICATION_ERROR,
- fake_observer_.GetNotificationsDisabledReason());
+ fake_handler_.GetNotificationsDisabledReason());
invalidation_notifier_->OnInvalidate(id_state_map);
EXPECT_THAT(id_state_map,
- Eq(fake_observer_.GetLastNotificationIdStateMap()));
- EXPECT_EQ(REMOTE_NOTIFICATION, fake_observer_.GetLastNotificationSource());
+ Eq(fake_handler_.GetLastNotificationIdStateMap()));
+ EXPECT_EQ(REMOTE_NOTIFICATION, fake_handler_.GetLastNotificationSource());
invalidation_notifier_->OnNotificationsDisabled(
TRANSIENT_NOTIFICATION_ERROR);
EXPECT_EQ(TRANSIENT_NOTIFICATION_ERROR,
- fake_observer_.GetNotificationsDisabledReason());
+ fake_handler_.GetNotificationsDisabledReason());
invalidation_notifier_->OnNotificationsDisabled(
NOTIFICATION_CREDENTIALS_REJECTED);
EXPECT_EQ(NOTIFICATION_CREDENTIALS_REJECTED,
- fake_observer_.GetNotificationsDisabledReason());
+ fake_handler_.GetNotificationsDisabledReason());
}
TEST_F(InvalidationNotifierTest, MigrateState) {
diff --git a/sync/notifier/sync_notifier.h b/sync/notifier/invalidator.h
index 9191b90..2765a67 100644
--- a/sync/notifier/sync_notifier.h
+++ b/sync/notifier/invalidator.h
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// Interface to the sync notifier, which is an object that receives
-// notifications when updates are available for a set of sync types.
-// All the observers are notified when such an event happens.
+// Interface to the invalidator, which is an object that receives
+// invalidations for registered object IDs. The corresponding
+// InvalidationHandler is notifier when such an event occurs.
-#ifndef SYNC_NOTIFIER_SYNC_NOTIFIER_H_
-#define SYNC_NOTIFIER_SYNC_NOTIFIER_H_
+#ifndef SYNC_NOTIFIER_INVALIDATOR_H_
+#define SYNC_NOTIFIER_INVALIDATOR_H_
#include <string>
@@ -15,28 +15,28 @@
#include "sync/notifier/invalidation_util.h"
namespace syncer {
-class SyncNotifierObserver;
+class InvalidationHandler;
-class SyncNotifier {
+class Invalidator {
public:
- SyncNotifier() {}
- virtual ~SyncNotifier() {}
+ Invalidator() {}
+ virtual ~Invalidator() {}
// Clients should follow the pattern below:
//
// When starting the client:
//
- // notifier->RegisterHandler(client_handler);
+ // invalidator->RegisterHandler(client_handler);
//
// When the set of IDs to register changes for the client during its lifetime
// (i.e., between calls to RegisterHandler(client_handler) and
// UnregisterHandler(client_handler):
//
- // notifier->UpdateRegisteredIds(client_handler, client_ids);
+ // invalidator->UpdateRegisteredIds(client_handler, client_ids);
//
- // When shutting down the client for browser shutdown:
+ // When shutting down the client for profile shutdown:
//
- // notifier->UnregisterHandler(client_handler);
+ // invalidator->UnregisterHandler(client_handler);
//
// Note that there's no call to UpdateRegisteredIds() -- this is because the
// invalidation API persists registrations across browser restarts.
@@ -44,23 +44,23 @@ class SyncNotifier {
// When permanently shutting down the client, e.g. when disabling the related
// feature:
//
- // notifier->UpdateRegisteredIds(client_handler, ObjectIdSet());
- // notifier->UnregisterHandler(client_handler);
+ // invalidator->UpdateRegisteredIds(client_handler, ObjectIdSet());
+ // invalidator->UnregisterHandler(client_handler);
// Starts sending notifications to |handler|. |handler| must not be NULL,
// and it must already be registered.
- virtual void RegisterHandler(SyncNotifierObserver* handler) = 0;
+ virtual void RegisterHandler(InvalidationHandler* handler) = 0;
// Updates the set of ObjectIds associated with |handler|. |handler| must
// not be NULL, and must already be registered. An ID must be registered for
// at most one handler.
- virtual void UpdateRegisteredIds(SyncNotifierObserver* handler,
+ virtual void UpdateRegisteredIds(InvalidationHandler* handler,
const ObjectIdSet& ids) = 0;
// Stops sending notifications to |handler|. |handler| must not be NULL, and
// it must already be registered. Note that this doesn't unregister the IDs
// associated with |handler|.
- virtual void UnregisterHandler(SyncNotifierObserver* handler) = 0;
+ virtual void UnregisterHandler(InvalidationHandler* handler) = 0;
// SetUniqueId must be called once, before any call to
// UpdateCredentials. |unique_id| should be a non-empty globally
@@ -86,4 +86,4 @@ class SyncNotifier {
};
} // namespace syncer
-#endif // SYNC_NOTIFIER_SYNC_NOTIFIER_H_
+#endif // SYNC_NOTIFIER_INVALIDATOR_H_
diff --git a/sync/notifier/sync_notifier_factory.cc b/sync/notifier/invalidator_factory.cc
index 3737f71..80ceb16 100644
--- a/sync/notifier/sync_notifier_factory.cc
+++ b/sync/notifier/invalidator_factory.cc
@@ -2,20 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sync/notifier/sync_notifier_factory.h"
+#include "sync/notifier/invalidator_factory.h"
#include <string>
#include "base/logging.h"
#include "jingle/notifier/listener/push_client.h"
-#include "sync/notifier/non_blocking_invalidation_notifier.h"
-#include "sync/notifier/p2p_notifier.h"
-#include "sync/notifier/sync_notifier.h"
+#include "sync/notifier/invalidator.h"
+#include "sync/notifier/non_blocking_invalidator.h"
+#include "sync/notifier/p2p_invalidator.h"
namespace syncer {
namespace {
-SyncNotifier* CreateDefaultSyncNotifier(
+Invalidator* CreateDefaultInvalidator(
const notifier::NotifierOptions& notifier_options,
const InvalidationVersionMap& initial_max_invalidation_versions,
const std::string& initial_invalidation_state,
@@ -26,12 +26,12 @@ SyncNotifier* CreateDefaultSyncNotifier(
// NOTIFY_OTHERS. There's no good reason to notify ourselves of our own
// commits. We self-notify for now only because the integration tests rely
// on this behaviour. See crbug.com/97780.
- return new P2PNotifier(
+ return new P2PInvalidator(
notifier::PushClient::CreateDefault(notifier_options),
NOTIFY_ALL);
}
- return new NonBlockingInvalidationNotifier(
+ return new NonBlockingInvalidator(
notifier_options, initial_max_invalidation_versions,
initial_invalidation_state, invalidation_state_tracker, client_info);
}
@@ -39,7 +39,7 @@ SyncNotifier* CreateDefaultSyncNotifier(
} // namespace
// TODO(akalin): Remove the dependency on jingle if OS_ANDROID is defined.
-SyncNotifierFactory::SyncNotifierFactory(
+InvalidatorFactory::InvalidatorFactory(
const notifier::NotifierOptions& notifier_options,
const std::string& client_info,
const base::WeakPtr<InvalidationStateTracker>&
@@ -57,19 +57,19 @@ SyncNotifierFactory::SyncNotifierFactory(
invalidation_state_tracker_(invalidation_state_tracker) {
}
-SyncNotifierFactory::~SyncNotifierFactory() {
+InvalidatorFactory::~InvalidatorFactory() {
}
-SyncNotifier* SyncNotifierFactory::CreateSyncNotifier() {
+Invalidator* InvalidatorFactory::CreateInvalidator() {
#if defined(OS_ANDROID)
// Android uses ChromeSyncNotificationBridge exclusively.
return NULL;
#else
- return CreateDefaultSyncNotifier(notifier_options_,
- initial_max_invalidation_versions_,
- initial_invalidation_state_,
- invalidation_state_tracker_,
- client_info_);
+ return CreateDefaultInvalidator(notifier_options_,
+ initial_max_invalidation_versions_,
+ initial_invalidation_state_,
+ invalidation_state_tracker_,
+ client_info_);
#endif
}
} // namespace syncer
diff --git a/sync/notifier/sync_notifier_factory.h b/sync/notifier/invalidator_factory.h
index 0c8a2d3..48763cd 100644
--- a/sync/notifier/sync_notifier_factory.h
+++ b/sync/notifier/invalidator_factory.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef SYNC_NOTIFIER_SYNC_NOTIFIER_FACTORY_H_
-#define SYNC_NOTIFIER_SYNC_NOTIFIER_FACTORY_H_
+#ifndef SYNC_NOTIFIER_INVALIDATOR_FACTORY_H_
+#define SYNC_NOTIFIER_INVALIDATOR_FACTORY_H_
#include <string>
@@ -14,26 +14,26 @@
namespace syncer {
-class SyncNotifier;
+class Invalidator;
-// Class to instantiate various implementations of the SyncNotifier
+// Class to instantiate various implementations of the Invalidator
// interface.
-class SyncNotifierFactory {
+class InvalidatorFactory {
public:
// |client_info| is a string identifying the client, e.g. a user
// agent string. |invalidation_state_tracker| may be NULL (for
// tests).
- SyncNotifierFactory(
+ InvalidatorFactory(
const notifier::NotifierOptions& notifier_options,
const std::string& client_info,
const base::WeakPtr<InvalidationStateTracker>&
invalidation_state_tracker);
- ~SyncNotifierFactory();
+ ~InvalidatorFactory();
- // Creates a sync notifier. Caller takes ownership of the returned
+ // Creates an invalidator. Caller takes ownership of the returned
// object. However, the returned object must not outlive the
// factory from which it was created. Can be called on any thread.
- SyncNotifier* CreateSyncNotifier();
+ Invalidator* CreateInvalidator();
private:
const notifier::NotifierOptions notifier_options_;
@@ -46,4 +46,4 @@ class SyncNotifierFactory {
} // namespace syncer
-#endif // SYNC_NOTIFIER_SYNC_NOTIFIER_FACTORY_H_
+#endif // SYNC_NOTIFIER_INVALIDATOR_FACTORY_H_
diff --git a/sync/notifier/sync_notifier_factory_unittest.cc b/sync/notifier/invalidator_factory_unittest.cc
index 6e2bc58..2b17e35 100644
--- a/sync/notifier/sync_notifier_factory_unittest.cc
+++ b/sync/notifier/invalidator_factory_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sync/notifier/sync_notifier_factory.h"
+#include "sync/notifier/invalidator_factory.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
@@ -15,15 +15,15 @@
#include "jingle/notifier/base/notifier_options.h"
#include "net/url_request/url_request_test_util.h"
#include "sync/internal_api/public/base/model_type.h"
-#include "sync/notifier/fake_sync_notifier_observer.h"
+#include "sync/notifier/fake_invalidation_handler.h"
#include "sync/notifier/invalidation_state_tracker.h"
-#include "sync/notifier/sync_notifier.h"
+#include "sync/notifier/invalidator.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace syncer {
namespace {
-class SyncNotifierFactoryTest : public testing::Test {
+class InvalidatorFactoryTest : public testing::Test {
protected:
virtual void SetUp() OVERRIDE {
@@ -33,50 +33,50 @@ class SyncNotifierFactoryTest : public testing::Test {
virtual void TearDown() OVERRIDE {
message_loop_.RunAllPending();
- EXPECT_EQ(0, fake_observer_.GetNotificationCount());
+ EXPECT_EQ(0, fake_handler_.GetNotificationCount());
}
MessageLoop message_loop_;
- FakeSyncNotifierObserver fake_observer_;
+ FakeInvalidationHandler fake_handler_;
notifier::NotifierOptions notifier_options_;
- scoped_ptr<SyncNotifierFactory> factory_;
+ scoped_ptr<InvalidatorFactory> factory_;
};
// Test basic creation of a NonBlockingInvalidationNotifier.
-TEST_F(SyncNotifierFactoryTest, Basic) {
+TEST_F(InvalidatorFactoryTest, Basic) {
notifier_options_.notification_method = notifier::NOTIFICATION_SERVER;
- SyncNotifierFactory factory(
+ InvalidatorFactory factory(
notifier_options_,
"test client info",
base::WeakPtr<InvalidationStateTracker>());
- scoped_ptr<SyncNotifier> notifier(factory.CreateSyncNotifier());
+ scoped_ptr<Invalidator> invalidator(factory.CreateInvalidator());
#if defined(OS_ANDROID)
- ASSERT_FALSE(notifier.get());
+ ASSERT_FALSE(invalidator.get());
#else
- ASSERT_TRUE(notifier.get());
+ ASSERT_TRUE(invalidator.get());
ObjectIdSet ids = ModelTypeSetToObjectIdSet(ModelTypeSet(syncer::BOOKMARKS));
- notifier->RegisterHandler(&fake_observer_);
- notifier->UpdateRegisteredIds(&fake_observer_, ids);
- notifier->UnregisterHandler(&fake_observer_);
+ invalidator->RegisterHandler(&fake_handler_);
+ invalidator->UpdateRegisteredIds(&fake_handler_, ids);
+ invalidator->UnregisterHandler(&fake_handler_);
#endif
}
// Test basic creation of a P2PNotifier.
-TEST_F(SyncNotifierFactoryTest, Basic_P2P) {
+TEST_F(InvalidatorFactoryTest, Basic_P2P) {
notifier_options_.notification_method = notifier::NOTIFICATION_P2P;
- SyncNotifierFactory factory(
+ InvalidatorFactory factory(
notifier_options_,
"test client info",
base::WeakPtr<InvalidationStateTracker>());
- scoped_ptr<SyncNotifier> notifier(factory.CreateSyncNotifier());
+ scoped_ptr<Invalidator> invalidator(factory.CreateInvalidator());
#if defined(OS_ANDROID)
- ASSERT_FALSE(notifier.get());
+ ASSERT_FALSE(invalidator.get());
#else
- ASSERT_TRUE(notifier.get());
+ ASSERT_TRUE(invalidator.get());
ObjectIdSet ids = ModelTypeSetToObjectIdSet(ModelTypeSet(syncer::BOOKMARKS));
- notifier->RegisterHandler(&fake_observer_);
- notifier->UpdateRegisteredIds(&fake_observer_, ids);
- notifier->UnregisterHandler(&fake_observer_);
+ invalidator->RegisterHandler(&fake_handler_);
+ invalidator->UpdateRegisteredIds(&fake_handler_, ids);
+ invalidator->UnregisterHandler(&fake_handler_);
#endif
}
diff --git a/sync/notifier/sync_notifier_registrar.cc b/sync/notifier/invalidator_registrar.cc
index a6960f5..a7ac5b0 100644
--- a/sync/notifier/sync_notifier_registrar.cc
+++ b/sync/notifier/invalidator_registrar.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sync/notifier/sync_notifier_registrar.h"
+#include "sync/notifier/invalidator_registrar.h"
#include <cstddef>
#include <utility>
@@ -11,21 +11,21 @@
namespace syncer {
-SyncNotifierRegistrar::SyncNotifierRegistrar() {}
+InvalidatorRegistrar::InvalidatorRegistrar() {}
-SyncNotifierRegistrar::~SyncNotifierRegistrar() {
+InvalidatorRegistrar::~InvalidatorRegistrar() {
DCHECK(thread_checker_.CalledOnValidThread());
}
-void SyncNotifierRegistrar::RegisterHandler(SyncNotifierObserver* handler) {
+void InvalidatorRegistrar::RegisterHandler(InvalidationHandler* handler) {
DCHECK(thread_checker_.CalledOnValidThread());
CHECK(handler);
CHECK(!handlers_.HasObserver(handler));
handlers_.AddObserver(handler);
}
-void SyncNotifierRegistrar::UpdateRegisteredIds(
- SyncNotifierObserver* handler,
+void InvalidatorRegistrar::UpdateRegisteredIds(
+ InvalidationHandler* handler,
const ObjectIdSet& ids) {
DCHECK(thread_checker_.CalledOnValidThread());
CHECK(handler);
@@ -56,14 +56,14 @@ void SyncNotifierRegistrar::UpdateRegisteredIds(
}
}
-void SyncNotifierRegistrar::UnregisterHandler(SyncNotifierObserver* handler) {
+void InvalidatorRegistrar::UnregisterHandler(InvalidationHandler* handler) {
DCHECK(thread_checker_.CalledOnValidThread());
CHECK(handler);
CHECK(handlers_.HasObserver(handler));
handlers_.RemoveObserver(handler);
}
-ObjectIdSet SyncNotifierRegistrar::GetAllRegisteredIds() const {
+ObjectIdSet InvalidatorRegistrar::GetAllRegisteredIds() const {
DCHECK(thread_checker_.CalledOnValidThread());
ObjectIdSet registered_ids;
for (IdHandlerMap::const_iterator it = id_to_handler_map_.begin();
@@ -73,7 +73,7 @@ ObjectIdSet SyncNotifierRegistrar::GetAllRegisteredIds() const {
return registered_ids;
}
-void SyncNotifierRegistrar::DispatchInvalidationsToHandlers(
+void InvalidatorRegistrar::DispatchInvalidationsToHandlers(
const ObjectIdStateMap& id_state_map,
IncomingNotificationSource source) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -82,19 +82,19 @@ void SyncNotifierRegistrar::DispatchInvalidationsToHandlers(
return;
}
- typedef std::map<SyncNotifierObserver*, ObjectIdStateMap> DispatchMap;
+ typedef std::map<InvalidationHandler*, ObjectIdStateMap> DispatchMap;
DispatchMap dispatch_map;
for (ObjectIdStateMap::const_iterator it = id_state_map.begin();
it != id_state_map.end(); ++it) {
- SyncNotifierObserver* const handler = ObjectIdToHandler(it->first);
+ InvalidationHandler* const handler = ObjectIdToHandler(it->first);
// Filter out invalidations for IDs with no handler.
if (handler)
dispatch_map[handler].insert(*it);
}
// Emit invalidations only for handlers in |handlers_|.
- ObserverListBase<SyncNotifierObserver>::Iterator it(handlers_);
- SyncNotifierObserver* handler = NULL;
+ ObserverListBase<InvalidationHandler>::Iterator it(handlers_);
+ InvalidationHandler* handler = NULL;
while ((handler = it.GetNext()) != NULL) {
DispatchMap::const_iterator dispatch_it = dispatch_map.find(handler);
if (dispatch_it != dispatch_map.end())
@@ -102,26 +102,26 @@ void SyncNotifierRegistrar::DispatchInvalidationsToHandlers(
}
}
-void SyncNotifierRegistrar::EmitOnNotificationsEnabled() {
+void InvalidatorRegistrar::EmitOnNotificationsEnabled() {
DCHECK(thread_checker_.CalledOnValidThread());
- FOR_EACH_OBSERVER(SyncNotifierObserver, handlers_, OnNotificationsEnabled());
+ FOR_EACH_OBSERVER(InvalidationHandler, handlers_, OnNotificationsEnabled());
}
-void SyncNotifierRegistrar::EmitOnNotificationsDisabled(
+void InvalidatorRegistrar::EmitOnNotificationsDisabled(
NotificationsDisabledReason reason) {
DCHECK(thread_checker_.CalledOnValidThread());
- FOR_EACH_OBSERVER(SyncNotifierObserver, handlers_,
+ FOR_EACH_OBSERVER(InvalidationHandler, handlers_,
OnNotificationsDisabled(reason));
}
-bool SyncNotifierRegistrar::IsHandlerRegisteredForTest(
- SyncNotifierObserver* handler) const {
+bool InvalidatorRegistrar::IsHandlerRegisteredForTest(
+ InvalidationHandler* handler) const {
DCHECK(thread_checker_.CalledOnValidThread());
return handlers_.HasObserver(handler);
}
-ObjectIdSet SyncNotifierRegistrar::GetRegisteredIdsForTest(
- SyncNotifierObserver* handler) const {
+ObjectIdSet InvalidatorRegistrar::GetRegisteredIdsForTest(
+ InvalidationHandler* handler) const {
DCHECK(thread_checker_.CalledOnValidThread());
ObjectIdSet registered_ids;
for (IdHandlerMap::const_iterator it = id_to_handler_map_.begin();
@@ -133,12 +133,12 @@ ObjectIdSet SyncNotifierRegistrar::GetRegisteredIdsForTest(
return registered_ids;
}
-void SyncNotifierRegistrar::DetachFromThreadForTest() {
+void InvalidatorRegistrar::DetachFromThreadForTest() {
DCHECK(thread_checker_.CalledOnValidThread());
thread_checker_.DetachFromThread();
}
-SyncNotifierObserver* SyncNotifierRegistrar::ObjectIdToHandler(
+InvalidationHandler* InvalidatorRegistrar::ObjectIdToHandler(
const invalidation::ObjectId& id) {
DCHECK(thread_checker_.CalledOnValidThread());
IdHandlerMap::const_iterator it = id_to_handler_map_.find(id);
diff --git a/sync/notifier/sync_notifier_registrar.h b/sync/notifier/invalidator_registrar.h
index 38a81c4..6bb481b 100644
--- a/sync/notifier/sync_notifier_registrar.h
+++ b/sync/notifier/invalidator_registrar.h
@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef SYNC_NOTIFIER_SYNC_NOTIFIER_REGISTRAR_H_
-#define SYNC_NOTIFIER_SYNC_NOTIFIER_REGISTRAR_H_
+#ifndef SYNC_NOTIFIER_INVALIDATOR_REGISTRAR_H_
+#define SYNC_NOTIFIER_INVALIDATOR_REGISTRAR_H_
#include <map>
#include "base/basictypes.h"
#include "base/observer_list.h"
#include "base/threading/thread_checker.h"
+#include "sync/notifier/invalidation_handler.h"
#include "sync/notifier/invalidation_util.h"
#include "sync/notifier/object_id_state_map.h"
-#include "sync/notifier/sync_notifier_observer.h"
namespace invalidation {
class ObjectId;
@@ -20,30 +20,29 @@ class ObjectId;
namespace syncer {
-// A helper class for implementations of the SyncNotifier interface. It helps
+// A helper class for implementations of the Invalidator interface. It helps
// keep track of registered handlers and which object ID registrations are
// associated with which handlers, so implementors can just reuse the logic
// here to dispatch invalidations and other interesting notifications.
-class SyncNotifierRegistrar {
+class InvalidatorRegistrar {
public:
- SyncNotifierRegistrar();
- ~SyncNotifierRegistrar();
+ InvalidatorRegistrar();
+ ~InvalidatorRegistrar();
// Starts sending notifications to |handler|. |handler| must not be NULL,
// and it must already be registered.
- void RegisterHandler(SyncNotifierObserver* handler);
-
+ void RegisterHandler(InvalidationHandler* handler);
// Updates the set of ObjectIds associated with |handler|. |handler| must
// not be NULL, and must already be registered. An ID must be registered for
// at most one handler.
- void UpdateRegisteredIds(SyncNotifierObserver* handler,
+ void UpdateRegisteredIds(InvalidationHandler* handler,
const ObjectIdSet& ids);
// Stops sending notifications to |handler|. |handler| must not be NULL, and
// it must already be registered. Note that this doesn't unregister the IDs
// associated with |handler|.
- void UnregisterHandler(SyncNotifierObserver* handler);
+ void UnregisterHandler(InvalidationHandler* handler);
// Returns the set of all IDs that are registered to some handler (even
// handlers that have been unregistered).
@@ -60,26 +59,26 @@ class SyncNotifierRegistrar {
void EmitOnNotificationsEnabled();
void EmitOnNotificationsDisabled(NotificationsDisabledReason reason);
- bool IsHandlerRegisteredForTest(SyncNotifierObserver* handler) const;
- ObjectIdSet GetRegisteredIdsForTest(SyncNotifierObserver* handler) const;
+ bool IsHandlerRegisteredForTest(InvalidationHandler* handler) const;
+ ObjectIdSet GetRegisteredIdsForTest(InvalidationHandler* handler) const;
// Needed for death tests.
void DetachFromThreadForTest();
private:
- typedef std::map<invalidation::ObjectId, SyncNotifierObserver*,
+ typedef std::map<invalidation::ObjectId, InvalidationHandler*,
ObjectIdLessThan>
IdHandlerMap;
- SyncNotifierObserver* ObjectIdToHandler(const invalidation::ObjectId& id);
+ InvalidationHandler* ObjectIdToHandler(const invalidation::ObjectId& id);
base::ThreadChecker thread_checker_;
- ObserverList<SyncNotifierObserver> handlers_;
+ ObserverList<InvalidationHandler> handlers_;
IdHandlerMap id_to_handler_map_;
- DISALLOW_COPY_AND_ASSIGN(SyncNotifierRegistrar);
+ DISALLOW_COPY_AND_ASSIGN(InvalidatorRegistrar);
};
} // namespace syncer
-#endif // SYNC_NOTIFIER_SYNC_NOTIFIER_REGISTRAR_H_
+#endif // SYNC_NOTIFIER_INVALIDATOR_REGISTRAR_H_
diff --git a/sync/notifier/sync_notifier_registrar_unittest.cc b/sync/notifier/invalidator_registrar_unittest.cc
index a9e57c5..f79a720 100644
--- a/sync/notifier/sync_notifier_registrar_unittest.cc
+++ b/sync/notifier/invalidator_registrar_unittest.cc
@@ -3,18 +3,18 @@
// found in the LICENSE file.
#include "google/cacheinvalidation/types.pb.h"
-#include "sync/notifier/fake_sync_notifier_observer.h"
+#include "sync/notifier/fake_invalidation_handler.h"
+#include "sync/notifier/invalidator_registrar.h"
#include "sync/notifier/object_id_state_map_test_util.h"
-#include "sync/notifier/sync_notifier_registrar.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace syncer {
namespace {
-class SyncNotifierRegistrarTest : public testing::Test {
+class InvalidatorRegistrarTest : public testing::Test {
protected:
- SyncNotifierRegistrarTest()
+ InvalidatorRegistrarTest()
: kObjectId1(ipc::invalidation::ObjectSource::TEST, "a"),
kObjectId2(ipc::invalidation::ObjectSource::TEST, "b"),
kObjectId3(ipc::invalidation::ObjectSource::TEST, "c"),
@@ -30,10 +30,10 @@ class SyncNotifierRegistrarTest : public testing::Test {
// Register a handler, register some IDs for that handler, and then unregister
// the handler, dispatching invalidations in between. The handler should only
// see invalidations when its registered and its IDs are registered.
-TEST_F(SyncNotifierRegistrarTest, Basic) {
- FakeSyncNotifierObserver handler;
+TEST_F(InvalidatorRegistrarTest, Basic) {
+ FakeInvalidationHandler handler;
- SyncNotifierRegistrar registrar;
+ InvalidatorRegistrar registrar;
registrar.RegisterHandler(&handler);
@@ -89,13 +89,13 @@ TEST_F(SyncNotifierRegistrarTest, Basic) {
// dispatch some notifications and invalidations. Handlers that are registered
// should get notifications, and the ones that have registered IDs should
// receive invalidations for those IDs.
-TEST_F(SyncNotifierRegistrarTest, MultipleHandlers) {
- FakeSyncNotifierObserver handler1;
- FakeSyncNotifierObserver handler2;
- FakeSyncNotifierObserver handler3;
- FakeSyncNotifierObserver handler4;
+TEST_F(InvalidatorRegistrarTest, MultipleHandlers) {
+ FakeInvalidationHandler handler1;
+ FakeInvalidationHandler handler2;
+ FakeInvalidationHandler handler3;
+ FakeInvalidationHandler handler4;
- SyncNotifierRegistrar registrar;
+ InvalidatorRegistrar registrar;
registrar.RegisterHandler(&handler1);
registrar.RegisterHandler(&handler2);
@@ -179,13 +179,13 @@ TEST_F(SyncNotifierRegistrarTest, MultipleHandlers) {
// Multiple registrations by different handlers on the same object ID should
// cause a CHECK.
-TEST_F(SyncNotifierRegistrarTest, MultipleRegistration) {
- SyncNotifierRegistrar registrar;
+TEST_F(InvalidatorRegistrarTest, MultipleRegistration) {
+ InvalidatorRegistrar registrar;
- FakeSyncNotifierObserver handler1;
+ FakeInvalidationHandler handler1;
registrar.RegisterHandler(&handler1);
- FakeSyncNotifierObserver handler2;
+ FakeInvalidationHandler handler2;
registrar.RegisterHandler(&handler2);
ObjectIdSet ids;
@@ -201,13 +201,13 @@ TEST_F(SyncNotifierRegistrarTest, MultipleRegistration) {
// Make sure that passing an empty set to UpdateRegisteredIds clears the
// corresponding entries for the handler.
-TEST_F(SyncNotifierRegistrarTest, EmptySetUnregisters) {
- FakeSyncNotifierObserver handler1;
+TEST_F(InvalidatorRegistrarTest, EmptySetUnregisters) {
+ FakeInvalidationHandler handler1;
// Control observer.
- FakeSyncNotifierObserver handler2;
+ FakeInvalidationHandler handler2;
- SyncNotifierRegistrar registrar;
+ InvalidatorRegistrar registrar;
registrar.RegisterHandler(&handler1);
registrar.RegisterHandler(&handler2);
diff --git a/sync/notifier/non_blocking_invalidation_notifier.cc b/sync/notifier/non_blocking_invalidator.cc
index 89fb19a..ab4f166 100644
--- a/sync/notifier/non_blocking_invalidation_notifier.cc
+++ b/sync/notifier/non_blocking_invalidator.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sync/notifier/non_blocking_invalidation_notifier.h"
+#include "sync/notifier/non_blocking_invalidator.h"
#include <cstddef>
@@ -17,15 +17,15 @@
namespace syncer {
-class NonBlockingInvalidationNotifier::Core
- : public base::RefCountedThreadSafe<NonBlockingInvalidationNotifier::Core>,
- // SyncNotifierObserver to observe the InvalidationNotifier we create.
- public SyncNotifierObserver {
+class NonBlockingInvalidator::Core
+ : public base::RefCountedThreadSafe<NonBlockingInvalidator::Core>,
+ // InvalidationHandler to observe the InvalidationNotifier we create.
+ public InvalidationHandler {
public:
// Called on parent thread. |delegate_observer| should be
// initialized.
explicit Core(
- const WeakHandle<SyncNotifierObserver>& delegate_observer);
+ const WeakHandle<InvalidationHandler>& delegate_observer);
// Helpers called on I/O thread.
void Initialize(
@@ -40,7 +40,7 @@ class NonBlockingInvalidationNotifier::Core
void SetStateDeprecated(const std::string& state);
void UpdateCredentials(const std::string& email, const std::string& token);
- // SyncNotifierObserver implementation (all called on I/O thread by
+ // InvalidationHandler implementation (all called on I/O thread by
// InvalidationNotifier).
virtual void OnNotificationsEnabled() OVERRIDE;
virtual void OnNotificationsDisabled(
@@ -51,28 +51,28 @@ class NonBlockingInvalidationNotifier::Core
private:
friend class
- base::RefCountedThreadSafe<NonBlockingInvalidationNotifier::Core>;
+ base::RefCountedThreadSafe<NonBlockingInvalidator::Core>;
// Called on parent or I/O thread.
~Core();
// The variables below should be used only on the I/O thread.
- const WeakHandle<SyncNotifierObserver> delegate_observer_;
+ const WeakHandle<InvalidationHandler> delegate_observer_;
scoped_ptr<InvalidationNotifier> invalidation_notifier_;
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
DISALLOW_COPY_AND_ASSIGN(Core);
};
-NonBlockingInvalidationNotifier::Core::Core(
- const WeakHandle<SyncNotifierObserver>& delegate_observer)
+NonBlockingInvalidator::Core::Core(
+ const WeakHandle<InvalidationHandler>& delegate_observer)
: delegate_observer_(delegate_observer) {
DCHECK(delegate_observer_.IsInitialized());
}
-NonBlockingInvalidationNotifier::Core::~Core() {
+NonBlockingInvalidator::Core::~Core() {
}
-void NonBlockingInvalidationNotifier::Core::Initialize(
+void NonBlockingInvalidator::Core::Initialize(
const notifier::NotifierOptions& notifier_options,
const InvalidationVersionMap& initial_max_invalidation_versions,
const std::string& initial_invalidation_state,
@@ -94,60 +94,58 @@ void NonBlockingInvalidationNotifier::Core::Initialize(
invalidation_notifier_->RegisterHandler(this);
}
-void NonBlockingInvalidationNotifier::Core::Teardown() {
+void NonBlockingInvalidator::Core::Teardown() {
DCHECK(network_task_runner_->BelongsToCurrentThread());
invalidation_notifier_->UnregisterHandler(this);
invalidation_notifier_.reset();
network_task_runner_ = NULL;
}
-void NonBlockingInvalidationNotifier::Core::UpdateRegisteredIds(
- const ObjectIdSet& ids) {
+void NonBlockingInvalidator::Core::UpdateRegisteredIds(const ObjectIdSet& ids) {
DCHECK(network_task_runner_->BelongsToCurrentThread());
invalidation_notifier_->UpdateRegisteredIds(this, ids);
}
-void NonBlockingInvalidationNotifier::Core::SetUniqueId(
- const std::string& unique_id) {
+void NonBlockingInvalidator::Core::SetUniqueId(const std::string& unique_id) {
DCHECK(network_task_runner_->BelongsToCurrentThread());
invalidation_notifier_->SetUniqueId(unique_id);
}
-void NonBlockingInvalidationNotifier::Core::SetStateDeprecated(
+void NonBlockingInvalidator::Core::SetStateDeprecated(
const std::string& state) {
DCHECK(network_task_runner_->BelongsToCurrentThread());
invalidation_notifier_->SetStateDeprecated(state);
}
-void NonBlockingInvalidationNotifier::Core::UpdateCredentials(
- const std::string& email, const std::string& token) {
+void NonBlockingInvalidator::Core::UpdateCredentials(const std::string& email,
+ const std::string& token) {
DCHECK(network_task_runner_->BelongsToCurrentThread());
invalidation_notifier_->UpdateCredentials(email, token);
}
-void NonBlockingInvalidationNotifier::Core::OnNotificationsEnabled() {
+void NonBlockingInvalidator::Core::OnNotificationsEnabled() {
DCHECK(network_task_runner_->BelongsToCurrentThread());
delegate_observer_.Call(FROM_HERE,
- &SyncNotifierObserver::OnNotificationsEnabled);
+ &InvalidationHandler::OnNotificationsEnabled);
}
-void NonBlockingInvalidationNotifier::Core::OnNotificationsDisabled(
+void NonBlockingInvalidator::Core::OnNotificationsDisabled(
NotificationsDisabledReason reason) {
DCHECK(network_task_runner_->BelongsToCurrentThread());
delegate_observer_.Call(
- FROM_HERE, &SyncNotifierObserver::OnNotificationsDisabled, reason);
+ FROM_HERE, &InvalidationHandler::OnNotificationsDisabled, reason);
}
-void NonBlockingInvalidationNotifier::Core::OnIncomingNotification(
+void NonBlockingInvalidator::Core::OnIncomingNotification(
const ObjectIdStateMap& id_state_map, IncomingNotificationSource source) {
DCHECK(network_task_runner_->BelongsToCurrentThread());
delegate_observer_.Call(FROM_HERE,
- &SyncNotifierObserver::OnIncomingNotification,
+ &InvalidationHandler::OnIncomingNotification,
id_state_map,
source);
}
-NonBlockingInvalidationNotifier::NonBlockingInvalidationNotifier(
+NonBlockingInvalidator::NonBlockingInvalidator(
const notifier::NotifierOptions& notifier_options,
const InvalidationVersionMap& initial_max_invalidation_versions,
const std::string& initial_invalidation_state,
@@ -164,7 +162,7 @@ NonBlockingInvalidationNotifier::NonBlockingInvalidationNotifier(
if (!network_task_runner_->PostTask(
FROM_HERE,
base::Bind(
- &NonBlockingInvalidationNotifier::Core::Initialize,
+ &NonBlockingInvalidator::Core::Initialize,
core_.get(),
notifier_options,
initial_max_invalidation_versions,
@@ -175,96 +173,90 @@ NonBlockingInvalidationNotifier::NonBlockingInvalidationNotifier(
}
}
-NonBlockingInvalidationNotifier::~NonBlockingInvalidationNotifier() {
+NonBlockingInvalidator::~NonBlockingInvalidator() {
DCHECK(parent_task_runner_->BelongsToCurrentThread());
if (!network_task_runner_->PostTask(
FROM_HERE,
- base::Bind(&NonBlockingInvalidationNotifier::Core::Teardown,
+ base::Bind(&NonBlockingInvalidator::Core::Teardown,
core_.get()))) {
NOTREACHED();
}
}
-void NonBlockingInvalidationNotifier::RegisterHandler(
- SyncNotifierObserver* handler) {
+void NonBlockingInvalidator::RegisterHandler(InvalidationHandler* handler) {
DCHECK(parent_task_runner_->BelongsToCurrentThread());
registrar_.RegisterHandler(handler);
}
-void NonBlockingInvalidationNotifier::UpdateRegisteredIds(
- SyncNotifierObserver* handler,
- const ObjectIdSet& ids) {
+void NonBlockingInvalidator::UpdateRegisteredIds(InvalidationHandler* handler,
+ const ObjectIdSet& ids) {
DCHECK(parent_task_runner_->BelongsToCurrentThread());
registrar_.UpdateRegisteredIds(handler, ids);
if (!network_task_runner_->PostTask(
FROM_HERE,
base::Bind(
- &NonBlockingInvalidationNotifier::Core::UpdateRegisteredIds,
+ &NonBlockingInvalidator::Core::UpdateRegisteredIds,
core_.get(),
registrar_.GetAllRegisteredIds()))) {
NOTREACHED();
}
}
-void NonBlockingInvalidationNotifier::UnregisterHandler(
- SyncNotifierObserver* handler) {
+void NonBlockingInvalidator::UnregisterHandler(InvalidationHandler* handler) {
DCHECK(parent_task_runner_->BelongsToCurrentThread());
registrar_.UnregisterHandler(handler);
}
-void NonBlockingInvalidationNotifier::SetUniqueId(
- const std::string& unique_id) {
+void NonBlockingInvalidator::SetUniqueId(const std::string& unique_id) {
DCHECK(parent_task_runner_->BelongsToCurrentThread());
if (!network_task_runner_->PostTask(
FROM_HERE,
- base::Bind(&NonBlockingInvalidationNotifier::Core::SetUniqueId,
+ base::Bind(&NonBlockingInvalidator::Core::SetUniqueId,
core_.get(), unique_id))) {
NOTREACHED();
}
}
-void NonBlockingInvalidationNotifier::SetStateDeprecated(
- const std::string& state) {
+void NonBlockingInvalidator::SetStateDeprecated(const std::string& state) {
DCHECK(parent_task_runner_->BelongsToCurrentThread());
if (!network_task_runner_->PostTask(
FROM_HERE,
base::Bind(
- &NonBlockingInvalidationNotifier::Core::SetStateDeprecated,
+ &NonBlockingInvalidator::Core::SetStateDeprecated,
core_.get(), state))) {
NOTREACHED();
}
}
-void NonBlockingInvalidationNotifier::UpdateCredentials(
- const std::string& email, const std::string& token) {
+void NonBlockingInvalidator::UpdateCredentials(const std::string& email,
+ const std::string& token) {
DCHECK(parent_task_runner_->BelongsToCurrentThread());
if (!network_task_runner_->PostTask(
FROM_HERE,
- base::Bind(&NonBlockingInvalidationNotifier::Core::UpdateCredentials,
+ base::Bind(&NonBlockingInvalidator::Core::UpdateCredentials,
core_.get(), email, token))) {
NOTREACHED();
}
}
-void NonBlockingInvalidationNotifier::SendNotification(
- ModelTypeSet changed_types) {
+void NonBlockingInvalidator::SendNotification(ModelTypeSet changed_types) {
DCHECK(parent_task_runner_->BelongsToCurrentThread());
// InvalidationClient doesn't implement SendNotification(), so no
// need to forward on the call.
}
-void NonBlockingInvalidationNotifier::OnNotificationsEnabled() {
+void NonBlockingInvalidator::OnNotificationsEnabled() {
DCHECK(parent_task_runner_->BelongsToCurrentThread());
registrar_.EmitOnNotificationsEnabled();
}
-void NonBlockingInvalidationNotifier::OnNotificationsDisabled(
+void NonBlockingInvalidator::OnNotificationsDisabled(
NotificationsDisabledReason reason) {
DCHECK(parent_task_runner_->BelongsToCurrentThread());
registrar_.EmitOnNotificationsDisabled(reason);
}
-void NonBlockingInvalidationNotifier::OnIncomingNotification(
+void NonBlockingInvalidator::OnIncomingNotification(
const ObjectIdStateMap& id_state_map,
IncomingNotificationSource source) {
DCHECK(parent_task_runner_->BelongsToCurrentThread());
diff --git a/sync/notifier/non_blocking_invalidation_notifier.h b/sync/notifier/non_blocking_invalidator.h
index 849c9813..cd98fe5 100644
--- a/sync/notifier/non_blocking_invalidation_notifier.h
+++ b/sync/notifier/non_blocking_invalidator.h
@@ -5,8 +5,8 @@
// An implementation of SyncNotifier that wraps InvalidationNotifier
// on its own thread.
-#ifndef SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_
-#define SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_
+#ifndef SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_
+#define SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_
#include <string>
@@ -16,10 +16,10 @@
#include "base/memory/weak_ptr.h"
#include "jingle/notifier/base/notifier_options.h"
#include "sync/internal_api/public/util/weak_handle.h"
+#include "sync/notifier/invalidation_handler.h"
#include "sync/notifier/invalidation_state_tracker.h"
-#include "sync/notifier/sync_notifier.h"
-#include "sync/notifier/sync_notifier_observer.h"
-#include "sync/notifier/sync_notifier_registrar.h"
+#include "sync/notifier/invalidator.h"
+#include "sync/notifier/invalidator_registrar.h"
namespace base {
class SingleThreadTaskRunner;
@@ -27,15 +27,15 @@ class SingleThreadTaskRunner;
namespace syncer {
-// TODO(akalin): Generalize to NonBlockingSyncNotifier
+// TODO(akalin): Generalize the interface so it can use any Invalidator.
// (http://crbug.com/140409).
-class NonBlockingInvalidationNotifier
- : public SyncNotifier,
- // SyncNotifierObserver to "observe" our Core via WeakHandle.
- public SyncNotifierObserver {
+class NonBlockingInvalidator
+ : public Invalidator,
+ // InvalidationHandler to "observe" our Core via WeakHandle.
+ public InvalidationHandler {
public:
// |invalidation_state_tracker| must be initialized.
- NonBlockingInvalidationNotifier(
+ NonBlockingInvalidator(
const notifier::NotifierOptions& notifier_options,
const InvalidationVersionMap& initial_max_invalidation_versions,
const std::string& initial_invalidation_state,
@@ -43,20 +43,20 @@ class NonBlockingInvalidationNotifier
invalidation_state_tracker,
const std::string& client_info);
- virtual ~NonBlockingInvalidationNotifier();
+ virtual ~NonBlockingInvalidator();
- // SyncNotifier implementation.
- virtual void RegisterHandler(SyncNotifierObserver* handler) OVERRIDE;
- virtual void UpdateRegisteredIds(SyncNotifierObserver* handler,
+ // Invalidator implementation.
+ virtual void RegisterHandler(InvalidationHandler* handler) OVERRIDE;
+ virtual void UpdateRegisteredIds(InvalidationHandler* handler,
const ObjectIdSet& ids) OVERRIDE;
- virtual void UnregisterHandler(SyncNotifierObserver* handler) OVERRIDE;
+ virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE;
virtual void SetUniqueId(const std::string& unique_id) OVERRIDE;
virtual void SetStateDeprecated(const std::string& state) OVERRIDE;
virtual void UpdateCredentials(
const std::string& email, const std::string& token) OVERRIDE;
virtual void SendNotification(ModelTypeSet changed_types) OVERRIDE;
- // SyncNotifierObserver implementation.
+ // InvalidationHandler implementation.
virtual void OnNotificationsEnabled() OVERRIDE;
virtual void OnNotificationsDisabled(
NotificationsDisabledReason reason) OVERRIDE;
@@ -67,19 +67,19 @@ class NonBlockingInvalidationNotifier
private:
class Core;
- base::WeakPtrFactory<NonBlockingInvalidationNotifier> weak_ptr_factory_;
+ base::WeakPtrFactory<NonBlockingInvalidator> weak_ptr_factory_;
- SyncNotifierRegistrar registrar_;
+ InvalidatorRegistrar registrar_;
- // The real guts of NonBlockingInvalidationNotifier, which allows
- // this class to live completely on the parent thread.
+ // The real guts of NonBlockingInvalidator, which allows this class to live
+ // completely on the parent thread.
scoped_refptr<Core> core_;
scoped_refptr<base::SingleThreadTaskRunner> parent_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
- DISALLOW_COPY_AND_ASSIGN(NonBlockingInvalidationNotifier);
+ DISALLOW_COPY_AND_ASSIGN(NonBlockingInvalidator);
};
} // namespace syncer
-#endif // SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_
+#endif // SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_
diff --git a/sync/notifier/non_blocking_invalidation_notifier_unittest.cc b/sync/notifier/non_blocking_invalidator_unittest.cc
index a749b64..8704cd2 100644
--- a/sync/notifier/non_blocking_invalidation_notifier_unittest.cc
+++ b/sync/notifier/non_blocking_invalidator_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sync/notifier/non_blocking_invalidation_notifier.h"
+#include "sync/notifier/non_blocking_invalidator.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@@ -14,7 +14,7 @@
#include "sync/internal_api/public/base/model_type.h"
#include "sync/internal_api/public/base/model_type_state_map.h"
#include "sync/internal_api/public/util/weak_handle.h"
-#include "sync/notifier/fake_sync_notifier_observer.h"
+#include "sync/notifier/fake_invalidation_handler.h"
#include "sync/notifier/invalidation_state_tracker.h"
#include "sync/notifier/object_id_state_map_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -27,9 +27,9 @@ namespace {
using ::testing::InSequence;
using ::testing::StrictMock;
-class NonBlockingInvalidationNotifierTest : public testing::Test {
+class NonBlockingInvalidatorTest : public testing::Test {
public:
- NonBlockingInvalidationNotifierTest() : io_thread_("Test IO thread") {}
+ NonBlockingInvalidatorTest() : io_thread_("Test IO thread") {}
protected:
virtual void SetUp() {
@@ -41,17 +41,17 @@ class NonBlockingInvalidationNotifierTest : public testing::Test {
notifier::NotifierOptions notifier_options;
notifier_options.request_context_getter = request_context_getter_;
invalidation_notifier_.reset(
- new NonBlockingInvalidationNotifier(
+ new NonBlockingInvalidator(
notifier_options,
InvalidationVersionMap(),
std::string(), // initial_invalidation_state
MakeWeakHandle(base::WeakPtr<InvalidationStateTracker>()),
"fake_client_info"));
- invalidation_notifier_->RegisterHandler(&fake_observer_);
+ invalidation_notifier_->RegisterHandler(&fake_handler_);
}
virtual void TearDown() {
- invalidation_notifier_->UnregisterHandler(&fake_observer_);
+ invalidation_notifier_->UnregisterHandler(&fake_handler_);
invalidation_notifier_.reset();
request_context_getter_ = NULL;
io_thread_.Stop();
@@ -61,21 +61,21 @@ class NonBlockingInvalidationNotifierTest : public testing::Test {
MessageLoop ui_loop_;
base::Thread io_thread_;
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
- scoped_ptr<NonBlockingInvalidationNotifier> invalidation_notifier_;
- FakeSyncNotifierObserver fake_observer_;
+ scoped_ptr<NonBlockingInvalidator> invalidation_notifier_;
+ FakeInvalidationHandler fake_handler_;
notifier::FakeBaseTask fake_base_task_;
};
// TODO(akalin): Add real unit tests (http://crbug.com/140410).
-TEST_F(NonBlockingInvalidationNotifierTest, Basic) {
+TEST_F(NonBlockingInvalidatorTest, Basic) {
const ModelTypeSet models(PREFERENCES, BOOKMARKS, AUTOFILL);
const ObjectIdStateMap& id_state_map =
ModelTypeStateMapToObjectIdStateMap(
ModelTypeSetToStateMap(models, "payload"));
invalidation_notifier_->UpdateRegisteredIds(
- &fake_observer_, ModelTypeSetToObjectIdSet(models));
+ &fake_handler_, ModelTypeSetToObjectIdSet(models));
invalidation_notifier_->SetStateDeprecated("fake_state");
invalidation_notifier_->SetUniqueId("fake_id");
@@ -83,23 +83,23 @@ TEST_F(NonBlockingInvalidationNotifierTest, Basic) {
invalidation_notifier_->OnNotificationsEnabled();
EXPECT_EQ(NO_NOTIFICATION_ERROR,
- fake_observer_.GetNotificationsDisabledReason());
+ fake_handler_.GetNotificationsDisabledReason());
invalidation_notifier_->OnIncomingNotification(
id_state_map, REMOTE_NOTIFICATION);
EXPECT_THAT(id_state_map,
- Eq(fake_observer_.GetLastNotificationIdStateMap()));
- EXPECT_EQ(REMOTE_NOTIFICATION, fake_observer_.GetLastNotificationSource());
+ Eq(fake_handler_.GetLastNotificationIdStateMap()));
+ EXPECT_EQ(REMOTE_NOTIFICATION, fake_handler_.GetLastNotificationSource());
invalidation_notifier_->OnNotificationsDisabled(
TRANSIENT_NOTIFICATION_ERROR);
EXPECT_EQ(TRANSIENT_NOTIFICATION_ERROR,
- fake_observer_.GetNotificationsDisabledReason());
+ fake_handler_.GetNotificationsDisabledReason());
invalidation_notifier_->OnNotificationsDisabled(
NOTIFICATION_CREDENTIALS_REJECTED);
EXPECT_EQ(NOTIFICATION_CREDENTIALS_REJECTED,
- fake_observer_.GetNotificationsDisabledReason());
+ fake_handler_.GetNotificationsDisabledReason());
ui_loop_.RunAllPending();
}
diff --git a/sync/notifier/p2p_notifier.cc b/sync/notifier/p2p_invalidator.cc
index 44fa05a..34822ff 100644
--- a/sync/notifier/p2p_notifier.cc
+++ b/sync/notifier/p2p_invalidator.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sync/notifier/p2p_notifier.h"
+#include "sync/notifier/p2p_invalidator.h"
#include <algorithm>
@@ -12,8 +12,8 @@
#include "base/values.h"
#include "jingle/notifier/listener/push_client.h"
#include "sync/internal_api/public/base/model_type_state_map.h"
+#include "sync/notifier/invalidation_handler.h"
#include "sync/notifier/invalidation_util.h"
-#include "sync/notifier/sync_notifier_observer.h"
namespace syncer {
@@ -141,8 +141,8 @@ bool P2PNotificationData::ResetFromString(const std::string& str) {
return true;
}
-P2PNotifier::P2PNotifier(scoped_ptr<notifier::PushClient> push_client,
- P2PNotificationTarget send_notification_target)
+P2PInvalidator::P2PInvalidator(scoped_ptr<notifier::PushClient> push_client,
+ P2PNotificationTarget send_notification_target)
: push_client_(push_client.Pass()),
logged_in_(false),
notifications_enabled_(false),
@@ -152,17 +152,17 @@ P2PNotifier::P2PNotifier(scoped_ptr<notifier::PushClient> push_client,
push_client_->AddObserver(this);
}
-P2PNotifier::~P2PNotifier() {
+P2PInvalidator::~P2PInvalidator() {
DCHECK(thread_checker_.CalledOnValidThread());
push_client_->RemoveObserver(this);
}
-void P2PNotifier::RegisterHandler(SyncNotifierObserver* handler) {
+void P2PInvalidator::RegisterHandler(InvalidationHandler* handler) {
DCHECK(thread_checker_.CalledOnValidThread());
registrar_.RegisterHandler(handler);
}
-void P2PNotifier::UpdateRegisteredIds(SyncNotifierObserver* handler,
+void P2PInvalidator::UpdateRegisteredIds(InvalidationHandler* handler,
const ObjectIdSet& ids) {
// TODO(akalin): Handle arbitrary object IDs (http://crbug.com/140411).
DCHECK(thread_checker_.CalledOnValidThread());
@@ -177,22 +177,22 @@ void P2PNotifier::UpdateRegisteredIds(SyncNotifierObserver* handler,
enabled_types_ = enabled_types;
}
-void P2PNotifier::UnregisterHandler(SyncNotifierObserver* handler) {
+void P2PInvalidator::UnregisterHandler(InvalidationHandler* handler) {
DCHECK(thread_checker_.CalledOnValidThread());
registrar_.UnregisterHandler(handler);
}
-void P2PNotifier::SetUniqueId(const std::string& unique_id) {
+void P2PInvalidator::SetUniqueId(const std::string& unique_id) {
DCHECK(thread_checker_.CalledOnValidThread());
unique_id_ = unique_id;
}
-void P2PNotifier::SetStateDeprecated(const std::string& state) {
+void P2PInvalidator::SetStateDeprecated(const std::string& state) {
DCHECK(thread_checker_.CalledOnValidThread());
// Do nothing.
}
-void P2PNotifier::UpdateCredentials(
+void P2PInvalidator::UpdateCredentials(
const std::string& email, const std::string& token) {
DCHECK(thread_checker_.CalledOnValidThread());
notifier::Subscription subscription;
@@ -209,14 +209,14 @@ void P2PNotifier::UpdateCredentials(
logged_in_ = true;
}
-void P2PNotifier::SendNotification(ModelTypeSet changed_types) {
+void P2PInvalidator::SendNotification(ModelTypeSet changed_types) {
DCHECK(thread_checker_.CalledOnValidThread());
const P2PNotificationData notification_data(
unique_id_, send_notification_target_, changed_types);
SendNotificationData(notification_data);
}
-void P2PNotifier::OnNotificationsEnabled() {
+void P2PInvalidator::OnNotificationsEnabled() {
DCHECK(thread_checker_.CalledOnValidThread());
bool just_turned_on = (notifications_enabled_ == false);
notifications_enabled_ = true;
@@ -228,13 +228,13 @@ void P2PNotifier::OnNotificationsEnabled() {
}
}
-void P2PNotifier::OnNotificationsDisabled(
+void P2PInvalidator::OnNotificationsDisabled(
notifier::NotificationsDisabledReason reason) {
DCHECK(thread_checker_.CalledOnValidThread());
registrar_.EmitOnNotificationsDisabled(FromNotifierReason(reason));
}
-void P2PNotifier::OnIncomingNotification(
+void P2PInvalidator::OnIncomingNotification(
const notifier::Notification& notification) {
DCHECK(thread_checker_.CalledOnValidThread());
DVLOG(1) << "Received notification " << notification.ToString();
@@ -275,13 +275,13 @@ void P2PNotifier::OnIncomingNotification(
REMOTE_NOTIFICATION);
}
-void P2PNotifier::SendNotificationDataForTest(
+void P2PInvalidator::SendNotificationDataForTest(
const P2PNotificationData& notification_data) {
DCHECK(thread_checker_.CalledOnValidThread());
SendNotificationData(notification_data);
}
-void P2PNotifier::SendNotificationData(
+void P2PInvalidator::SendNotificationData(
const P2PNotificationData& notification_data) {
DCHECK(thread_checker_.CalledOnValidThread());
if (notification_data.GetChangedTypes().Empty()) {
diff --git a/sync/notifier/p2p_notifier.h b/sync/notifier/p2p_invalidator.h
index 4457c6f..ce486ac 100644
--- a/sync/notifier/p2p_notifier.h
+++ b/sync/notifier/p2p_invalidator.h
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// A notifier that uses p2p notifications based on XMPP push
+// An invalidator that uses p2p notifications based on XMPP push
// notifications. Used only for sync integration tests.
-#ifndef SYNC_NOTIFIER_P2P_NOTIFIER_H_
-#define SYNC_NOTIFIER_P2P_NOTIFIER_H_
+#ifndef SYNC_NOTIFIER_P2P_INVALIDATOR_H_
+#define SYNC_NOTIFIER_P2P_INVALIDATOR_H_
#include <string>
@@ -18,9 +18,9 @@
#include "base/threading/thread_checker.h"
#include "jingle/notifier/listener/push_client_observer.h"
#include "sync/internal_api/public/base/model_type.h"
+#include "sync/notifier/invalidator.h"
+#include "sync/notifier/invalidator_registrar.h"
#include "sync/notifier/notifications_disabled_reason.h"
-#include "sync/notifier/sync_notifier.h"
-#include "sync/notifier/sync_notifier_registrar.h"
namespace notifier {
class PushClient;
@@ -82,24 +82,24 @@ class P2PNotificationData {
ModelTypeSet changed_types_;
};
-class P2PNotifier : public SyncNotifier,
- public notifier::PushClientObserver {
+class P2PInvalidator : public Invalidator,
+ public notifier::PushClientObserver {
public:
// The |send_notification_target| parameter was added to allow us to send
// self-notifications in some cases, but not others. The value should be
// either NOTIFY_ALL to send notifications to all clients, or NOTIFY_OTHERS
// to send notifications to all clients except for the one that triggered the
// notification. See crbug.com/97780.
- P2PNotifier(scoped_ptr<notifier::PushClient> push_client,
- P2PNotificationTarget send_notification_target);
+ P2PInvalidator(scoped_ptr<notifier::PushClient> push_client,
+ P2PNotificationTarget send_notification_target);
- virtual ~P2PNotifier();
+ virtual ~P2PInvalidator();
- // SyncNotifier implementation
- virtual void RegisterHandler(SyncNotifierObserver* handler) OVERRIDE;
- virtual void UpdateRegisteredIds(SyncNotifierObserver* handler,
+ // Invalidator implementation
+ virtual void RegisterHandler(InvalidationHandler* handler) OVERRIDE;
+ virtual void UpdateRegisteredIds(InvalidationHandler* handler,
const ObjectIdSet& ids) OVERRIDE;
- virtual void UnregisterHandler(SyncNotifierObserver* handler) OVERRIDE;
+ virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE;
virtual void SetUniqueId(const std::string& unique_id) OVERRIDE;
virtual void SetStateDeprecated(const std::string& state) OVERRIDE;
virtual void UpdateCredentials(
@@ -121,7 +121,7 @@ class P2PNotifier : public SyncNotifier,
base::ThreadChecker thread_checker_;
- SyncNotifierRegistrar registrar_;
+ InvalidatorRegistrar registrar_;
// The push client.
scoped_ptr<notifier::PushClient> push_client_;
@@ -134,8 +134,10 @@ class P2PNotifier : public SyncNotifier,
P2PNotificationTarget send_notification_target_;
ModelTypeSet enabled_types_;
+
+ DISALLOW_COPY_AND_ASSIGN(P2PInvalidator);
};
} // namespace syncer
-#endif // SYNC_NOTIFIER_P2P_NOTIFIER_H_
+#endif // SYNC_NOTIFIER_P2P_INVALIDATOR_H_
diff --git a/sync/notifier/p2p_notifier_unittest.cc b/sync/notifier/p2p_invalidator_unittest.cc
index 6a62038b..c169cdf 100644
--- a/sync/notifier/p2p_notifier_unittest.cc
+++ b/sync/notifier/p2p_invalidator_unittest.cc
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sync/notifier/p2p_notifier.h"
+#include "sync/notifier/p2p_invalidator.h"
#include <cstddef>
#include "jingle/notifier/listener/fake_push_client.h"
#include "sync/internal_api/public/base/model_type.h"
#include "sync/internal_api/public/base/model_type_state_map.h"
-#include "sync/notifier/fake_sync_notifier_observer.h"
+#include "sync/notifier/fake_invalidation_handler.h"
#include "sync/notifier/object_id_state_map_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -17,19 +17,19 @@ namespace syncer {
namespace {
-class P2PNotifierTest : public testing::Test {
+class P2PInvalidatorTest : public testing::Test {
protected:
- P2PNotifierTest()
+ P2PInvalidatorTest()
: fake_push_client_(new notifier::FakePushClient()),
p2p_notifier_(
scoped_ptr<notifier::PushClient>(fake_push_client_),
NOTIFY_OTHERS),
next_sent_notification_to_reflect_(0) {
- p2p_notifier_.RegisterHandler(&fake_observer_);
+ p2p_notifier_.RegisterHandler(&fake_handler_);
}
- virtual ~P2PNotifierTest() {
- p2p_notifier_.UnregisterHandler(&fake_observer_);
+ virtual ~P2PInvalidatorTest() {
+ p2p_notifier_.UnregisterHandler(&fake_handler_);
}
ModelTypeStateMap MakeStateMap(ModelTypeSet types) {
@@ -50,15 +50,15 @@ class P2PNotifierTest : public testing::Test {
// Owned by |p2p_notifier_|.
notifier::FakePushClient* fake_push_client_;
- P2PNotifier p2p_notifier_;
- FakeSyncNotifierObserver fake_observer_;
+ P2PInvalidator p2p_notifier_;
+ FakeInvalidationHandler fake_handler_;
private:
size_t next_sent_notification_to_reflect_;
};
// Make sure the P2PNotificationTarget <-> string conversions work.
-TEST_F(P2PNotifierTest, P2PNotificationTarget) {
+TEST_F(P2PInvalidatorTest, P2PNotificationTarget) {
for (int i = FIRST_NOTIFICATION_TARGET;
i <= LAST_NOTIFICATION_TARGET; ++i) {
P2PNotificationTarget target = static_cast<P2PNotificationTarget>(i);
@@ -70,7 +70,7 @@ TEST_F(P2PNotifierTest, P2PNotificationTarget) {
}
// Make sure notification targeting works correctly.
-TEST_F(P2PNotifierTest, P2PNotificationDataIsTargeted) {
+TEST_F(P2PInvalidatorTest, P2PNotificationDataIsTargeted) {
{
const P2PNotificationData notification_data(
"sender", NOTIFY_SELF, ModelTypeSet());
@@ -96,7 +96,7 @@ TEST_F(P2PNotifierTest, P2PNotificationDataIsTargeted) {
// Make sure the P2PNotificationData <-> string conversions work for a
// default-constructed P2PNotificationData.
-TEST_F(P2PNotifierTest, P2PNotificationDataDefault) {
+TEST_F(P2PInvalidatorTest, P2PNotificationDataDefault) {
const P2PNotificationData notification_data;
EXPECT_TRUE(notification_data.IsTargeted(""));
EXPECT_FALSE(notification_data.IsTargeted("other1"));
@@ -114,7 +114,7 @@ TEST_F(P2PNotifierTest, P2PNotificationDataDefault) {
// Make sure the P2PNotificationData <-> string conversions work for a
// non-default-constructed P2PNotificationData.
-TEST_F(P2PNotifierTest, P2PNotificationDataNonDefault) {
+TEST_F(P2PInvalidatorTest, P2PNotificationDataNonDefault) {
const ModelTypeSet changed_types(BOOKMARKS, THEMES);
const P2PNotificationData notification_data(
"sender", NOTIFY_ALL, changed_types);
@@ -133,14 +133,14 @@ TEST_F(P2PNotifierTest, P2PNotificationDataNonDefault) {
EXPECT_TRUE(notification_data.Equals(notification_data_parsed));
}
-// Set up the P2PNotifier, simulate a successful connection, and send
+// Set up the P2PInvalidator, simulate a successful connection, and send
// a notification with the default target (NOTIFY_OTHERS). The
// observer should receive only a notification from the call to
// UpdateEnabledTypes().
-TEST_F(P2PNotifierTest, NotificationsBasic) {
+TEST_F(P2PInvalidatorTest, NotificationsBasic) {
const ModelTypeSet enabled_types(BOOKMARKS, PREFERENCES);
- p2p_notifier_.UpdateRegisteredIds(&fake_observer_,
+ p2p_notifier_.UpdateRegisteredIds(&fake_handler_,
ModelTypeSetToObjectIdSet(enabled_types));
p2p_notifier_.SetUniqueId("sender");
@@ -162,35 +162,35 @@ TEST_F(P2PNotifierTest, NotificationsBasic) {
ReflectSentNotifications();
fake_push_client_->EnableNotifications();
EXPECT_EQ(NO_NOTIFICATION_ERROR,
- fake_observer_.GetNotificationsDisabledReason());
+ fake_handler_.GetNotificationsDisabledReason());
ReflectSentNotifications();
- EXPECT_EQ(1, fake_observer_.GetNotificationCount());
+ EXPECT_EQ(1, fake_handler_.GetNotificationCount());
EXPECT_THAT(
ModelTypeStateMapToObjectIdStateMap(MakeStateMap(enabled_types)),
- Eq(fake_observer_.GetLastNotificationIdStateMap()));
- EXPECT_EQ(REMOTE_NOTIFICATION, fake_observer_.GetLastNotificationSource());
+ Eq(fake_handler_.GetLastNotificationIdStateMap()));
+ EXPECT_EQ(REMOTE_NOTIFICATION, fake_handler_.GetLastNotificationSource());
// Sent with target NOTIFY_OTHERS so should not be propagated to
- // |fake_observer_|.
+ // |fake_handler_|.
{
ModelTypeSet changed_types(THEMES, APPS);
p2p_notifier_.SendNotification(changed_types);
}
ReflectSentNotifications();
- EXPECT_EQ(1, fake_observer_.GetNotificationCount());
+ EXPECT_EQ(1, fake_handler_.GetNotificationCount());
}
-// Set up the P2PNotifier and send out notifications with various
+// Set up the P2PInvalidator and send out notifications with various
// target settings. The notifications received by the observer should
// be consistent with the target settings.
-TEST_F(P2PNotifierTest, SendNotificationData) {
+TEST_F(P2PInvalidatorTest, SendNotificationData) {
const ModelTypeSet enabled_types(BOOKMARKS, PREFERENCES, THEMES);
const ModelTypeSet changed_types(THEMES, APPS);
const ModelTypeSet expected_types(THEMES);
- p2p_notifier_.UpdateRegisteredIds(&fake_observer_,
+ p2p_notifier_.UpdateRegisteredIds(&fake_handler_,
ModelTypeSetToObjectIdSet(enabled_types));
p2p_notifier_.SetUniqueId("sender");
@@ -199,19 +199,19 @@ TEST_F(P2PNotifierTest, SendNotificationData) {
ReflectSentNotifications();
fake_push_client_->EnableNotifications();
EXPECT_EQ(NO_NOTIFICATION_ERROR,
- fake_observer_.GetNotificationsDisabledReason());
+ fake_handler_.GetNotificationsDisabledReason());
ReflectSentNotifications();
- EXPECT_EQ(1, fake_observer_.GetNotificationCount());
+ EXPECT_EQ(1, fake_handler_.GetNotificationCount());
EXPECT_THAT(
ModelTypeStateMapToObjectIdStateMap(MakeStateMap(enabled_types)),
- Eq(fake_observer_.GetLastNotificationIdStateMap()));
- EXPECT_EQ(REMOTE_NOTIFICATION, fake_observer_.GetLastNotificationSource());
+ Eq(fake_handler_.GetLastNotificationIdStateMap()));
+ EXPECT_EQ(REMOTE_NOTIFICATION, fake_handler_.GetLastNotificationSource());
// Should be dropped.
p2p_notifier_.SendNotificationDataForTest(P2PNotificationData());
ReflectSentNotifications();
- EXPECT_EQ(1, fake_observer_.GetNotificationCount());
+ EXPECT_EQ(1, fake_handler_.GetNotificationCount());
const ObjectIdStateMap& expected_ids =
ModelTypeStateMapToObjectIdStateMap(MakeStateMap(expected_types));
@@ -220,67 +220,67 @@ TEST_F(P2PNotifierTest, SendNotificationData) {
p2p_notifier_.SendNotificationDataForTest(
P2PNotificationData("sender", NOTIFY_SELF, changed_types));
ReflectSentNotifications();
- EXPECT_EQ(2, fake_observer_.GetNotificationCount());
+ EXPECT_EQ(2, fake_handler_.GetNotificationCount());
EXPECT_THAT(
expected_ids,
- Eq(fake_observer_.GetLastNotificationIdStateMap()));
+ Eq(fake_handler_.GetLastNotificationIdStateMap()));
// Should be dropped.
p2p_notifier_.SendNotificationDataForTest(
P2PNotificationData("sender2", NOTIFY_SELF, changed_types));
ReflectSentNotifications();
- EXPECT_EQ(2, fake_observer_.GetNotificationCount());
+ EXPECT_EQ(2, fake_handler_.GetNotificationCount());
// Should be dropped.
p2p_notifier_.SendNotificationDataForTest(
P2PNotificationData("sender", NOTIFY_SELF, ModelTypeSet()));
ReflectSentNotifications();
- EXPECT_EQ(2, fake_observer_.GetNotificationCount());
+ EXPECT_EQ(2, fake_handler_.GetNotificationCount());
// Should be dropped.
p2p_notifier_.SendNotificationDataForTest(
P2PNotificationData("sender", NOTIFY_OTHERS, changed_types));
ReflectSentNotifications();
- EXPECT_EQ(2, fake_observer_.GetNotificationCount());
+ EXPECT_EQ(2, fake_handler_.GetNotificationCount());
// Should be propagated.
p2p_notifier_.SendNotificationDataForTest(
P2PNotificationData("sender2", NOTIFY_OTHERS, changed_types));
ReflectSentNotifications();
- EXPECT_EQ(3, fake_observer_.GetNotificationCount());
+ EXPECT_EQ(3, fake_handler_.GetNotificationCount());
EXPECT_THAT(
expected_ids,
- Eq(fake_observer_.GetLastNotificationIdStateMap()));
+ Eq(fake_handler_.GetLastNotificationIdStateMap()));
// Should be dropped.
p2p_notifier_.SendNotificationDataForTest(
P2PNotificationData("sender2", NOTIFY_OTHERS, ModelTypeSet()));
ReflectSentNotifications();
- EXPECT_EQ(3, fake_observer_.GetNotificationCount());
+ EXPECT_EQ(3, fake_handler_.GetNotificationCount());
// Should be propagated.
p2p_notifier_.SendNotificationDataForTest(
P2PNotificationData("sender", NOTIFY_ALL, changed_types));
ReflectSentNotifications();
- EXPECT_EQ(4, fake_observer_.GetNotificationCount());
+ EXPECT_EQ(4, fake_handler_.GetNotificationCount());
EXPECT_THAT(
expected_ids,
- Eq(fake_observer_.GetLastNotificationIdStateMap()));
+ Eq(fake_handler_.GetLastNotificationIdStateMap()));
// Should be propagated.
p2p_notifier_.SendNotificationDataForTest(
P2PNotificationData("sender2", NOTIFY_ALL, changed_types));
ReflectSentNotifications();
- EXPECT_EQ(5, fake_observer_.GetNotificationCount());
+ EXPECT_EQ(5, fake_handler_.GetNotificationCount());
EXPECT_THAT(
expected_ids,
- Eq(fake_observer_.GetLastNotificationIdStateMap()));
+ Eq(fake_handler_.GetLastNotificationIdStateMap()));
// Should be dropped.
p2p_notifier_.SendNotificationDataForTest(
P2PNotificationData("sender2", NOTIFY_ALL, ModelTypeSet()));
ReflectSentNotifications();
- EXPECT_EQ(5, fake_observer_.GetNotificationCount());
+ EXPECT_EQ(5, fake_handler_.GetNotificationCount());
}
} // namespace
diff --git a/sync/sync.gyp b/sync/sync.gyp
index 397d057..369605b 100644
--- a/sync/sync.gyp
+++ b/sync/sync.gyp
@@ -253,18 +253,18 @@
'../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation',
],
'sources': [
+ 'notifier/invalidation_handler.h',
'notifier/invalidation_util.cc',
'notifier/invalidation_util.h',
+ 'notifier/invalidator_factory.cc',
+ 'notifier/invalidator_factory.h',
+ 'notifier/invalidator.h',
+ 'notifier/invalidator_registrar.cc',
+ 'notifier/invalidator_registrar.h',
'notifier/notifications_disabled_reason.cc',
'notifier/notifications_disabled_reason.h',
'notifier/object_id_state_map.cc',
'notifier/object_id_state_map.h',
- 'notifier/sync_notifier.h',
- 'notifier/sync_notifier_factory.cc',
- 'notifier/sync_notifier_factory.h',
- 'notifier/sync_notifier_observer.h',
- 'notifier/sync_notifier_registrar.cc',
- 'notifier/sync_notifier_registrar.h',
],
'conditions': [
['OS != "android"', {
@@ -276,10 +276,10 @@
'notifier/invalidation_notifier.cc',
'notifier/invalidation_notifier.h',
'notifier/invalidation_state_tracker.h',
- 'notifier/non_blocking_invalidation_notifier.cc',
- 'notifier/non_blocking_invalidation_notifier.h',
- 'notifier/p2p_notifier.cc',
- 'notifier/p2p_notifier.h',
+ 'notifier/non_blocking_invalidator.cc',
+ 'notifier/non_blocking_invalidator.h',
+ 'notifier/p2p_invalidator.cc',
+ 'notifier/p2p_invalidator.h',
'notifier/push_client_channel.cc',
'notifier/push_client_channel.h',
'notifier/registration_manager.cc',
@@ -480,10 +480,10 @@
'sources': [
'notifier/fake_invalidation_state_tracker.cc',
'notifier/fake_invalidation_state_tracker.h',
- 'notifier/fake_sync_notifier.cc',
- 'notifier/fake_sync_notifier.h',
- 'notifier/fake_sync_notifier_observer.cc',
- 'notifier/fake_sync_notifier_observer.h',
+ 'notifier/fake_invalidator.cc',
+ 'notifier/fake_invalidator.h',
+ 'notifier/fake_invalidation_handler.cc',
+ 'notifier/fake_invalidation_handler.h',
'notifier/object_id_state_map_test_util.cc',
'notifier/object_id_state_map_test_util.h',
],
@@ -664,7 +664,7 @@
'..',
],
'sources': [
- 'notifier/sync_notifier_factory_unittest.cc',
+ 'notifier/invalidator_factory_unittest.cc',
],
'conditions': [
['OS != "android"', {
@@ -672,11 +672,11 @@
'notifier/chrome_invalidation_client_unittest.cc',
'notifier/chrome_system_resources_unittest.cc',
'notifier/invalidation_notifier_unittest.cc',
- 'notifier/non_blocking_invalidation_notifier_unittest.cc',
- 'notifier/p2p_notifier_unittest.cc',
+ 'notifier/invalidator_registrar_unittest.cc',
+ 'notifier/non_blocking_invalidator_unittest.cc',
+ 'notifier/p2p_invalidator_unittest.cc',
'notifier/push_client_channel_unittest.cc',
'notifier/registration_manager_unittest.cc',
- 'notifier/sync_notifier_registrar_unittest.cc',
],
}],
],
diff --git a/sync/tools/sync_client.cc b/sync/tools/sync_client.cc
index 5f6de2a..9047d48 100644
--- a/sync/tools/sync_client.cc
+++ b/sync/tools/sync_client.cc
@@ -41,8 +41,8 @@
#include "sync/js/js_event_details.h"
#include "sync/js/js_event_handler.h"
#include "sync/notifier/invalidation_state_tracker.h"
-#include "sync/notifier/sync_notifier.h"
-#include "sync/notifier/sync_notifier_factory.h"
+#include "sync/notifier/invalidator_factory.h"
+#include "sync/notifier/invalidator.h"
#include "sync/test/fake_encryptor.h"
#if defined(OS_MACOSX)
@@ -308,7 +308,7 @@ int SyncClientMain(int argc, char* argv[]) {
ParseNotifierOptions(command_line, context_getter);
const char kClientInfo[] = "sync_listen_notifications";
NullInvalidationStateTracker null_invalidation_state_tracker;
- SyncNotifierFactory sync_notifier_factory(
+ InvalidatorFactory invalidator_factory(
notifier_options, kClientInfo,
null_invalidation_state_tracker.AsWeakPtr());
@@ -368,8 +368,8 @@ int SyncClientMain(int argc, char* argv[]) {
extensions_activity_monitor,
&change_delegate,
credentials,
- scoped_ptr<SyncNotifier>(
- sync_notifier_factory.CreateSyncNotifier()),
+ scoped_ptr<Invalidator>(
+ invalidator_factory.CreateInvalidator()),
kRestoredKeyForBootstrapping,
kRestoredKeystoreKeyForBootstrapping,
scoped_ptr<InternalComponentsFactory>(
diff --git a/sync/tools/sync_listen_notifications.cc b/sync/tools/sync_listen_notifications.cc
index ef5ef19..3f3955c 100644
--- a/sync/tools/sync_listen_notifications.cc
+++ b/sync/tools/sync_listen_notifications.cc
@@ -26,10 +26,10 @@
#include "sync/internal_api/public/base/model_type.h"
#include "sync/internal_api/public/base/model_type_state_map.h"
#include "sync/notifier/invalidation_state_tracker.h"
+#include "sync/notifier/invalidation_handler.h"
#include "sync/notifier/invalidation_util.h"
-#include "sync/notifier/sync_notifier.h"
-#include "sync/notifier/sync_notifier_factory.h"
-#include "sync/notifier/sync_notifier_observer.h"
+#include "sync/notifier/invalidator_factory.h"
+#include "sync/notifier/invalidator.h"
#if defined(OS_MACOSX)
#include "base/mac/scoped_nsautorelease_pool.h"
@@ -49,7 +49,7 @@ const char kAllowInsecureConnectionSwitch[] = "allow-insecure-connection";
const char kNotificationMethodSwitch[] = "notification-method";
// Class to print received notifications events.
-class NotificationPrinter : public SyncNotifierObserver {
+class NotificationPrinter : public InvalidationHandler {
public:
NotificationPrinter() {}
virtual ~NotificationPrinter() {}
@@ -233,25 +233,25 @@ int SyncListenNotificationsMain(int argc, char* argv[]) {
new MyTestURLRequestContextGetter(io_thread.message_loop_proxy()));
const char kClientInfo[] = "sync_listen_notifications";
NullInvalidationStateTracker null_invalidation_state_tracker;
- SyncNotifierFactory sync_notifier_factory(
+ InvalidatorFactory invalidator_factory(
notifier_options, kClientInfo,
null_invalidation_state_tracker.AsWeakPtr());
- scoped_ptr<SyncNotifier> sync_notifier(
- sync_notifier_factory.CreateSyncNotifier());
+ scoped_ptr<Invalidator> invalidator(
+ invalidator_factory.CreateInvalidator());
NotificationPrinter notification_printer;
const char kUniqueId[] = "fake_unique_id";
- sync_notifier->SetUniqueId(kUniqueId);
- sync_notifier->UpdateCredentials(email, token);
+ invalidator->SetUniqueId(kUniqueId);
+ invalidator->UpdateCredentials(email, token);
// Listen for notifications for all known types.
- sync_notifier->RegisterHandler(&notification_printer);
- sync_notifier->UpdateRegisteredIds(
+ invalidator->RegisterHandler(&notification_printer);
+ invalidator->UpdateRegisteredIds(
&notification_printer, ModelTypeSetToObjectIdSet(ModelTypeSet::All()));
ui_loop.Run();
- sync_notifier->UnregisterHandler(&notification_printer);
+ invalidator->UnregisterHandler(&notification_printer);
io_thread.Stop();
return 0;
}