| Index: sync/internal_api/sync_manager_impl.cc
|
| diff --git a/sync/internal_api/sync_manager_impl.cc b/sync/internal_api/sync_manager_impl.cc
|
| index 72f936f3d23a27c2d34c0c17f6cf4598b04998c2..92457f08e3c5b6f912ec4f5ef54b8a74e8f1ceee 100644
|
| --- a/sync/internal_api/sync_manager_impl.cc
|
| +++ b/sync/internal_api/sync_manager_impl.cc
|
| @@ -62,6 +62,8 @@ using syncable::SPECIFICS;
|
|
|
| namespace {
|
|
|
| +const char kHandlerName[] = "SyncManagerImpl";
|
| +
|
| // Delays for syncer nudges.
|
| static const int kDefaultNudgeDelayMilliseconds = 200;
|
| static const int kPreferencesNudgeDelayMilliseconds = 2000;
|
| @@ -396,6 +398,8 @@ bool SyncManagerImpl::Init(
|
| change_delegate_ = change_delegate;
|
|
|
| sync_notifier_ = sync_notifier.Pass();
|
| + if (sync_notifier_.get())
|
| + sync_notifier_->SetHandler(kHandlerName, this);
|
|
|
| AddObserver(&js_sync_manager_observer_);
|
| SetJsEventHandler(event_handler);
|
| @@ -733,16 +737,27 @@ void SyncManagerImpl::UpdateCredentials(
|
| void SyncManagerImpl::UpdateEnabledTypes(
|
| const ModelTypeSet& enabled_types) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| + DCHECK(initialized_);
|
| sync_notifier_->UpdateRegisteredIds(
|
| - this,
|
| + kHandlerName,
|
| ModelTypeSetToObjectIdSet(enabled_types));
|
| }
|
|
|
| +void SyncManagerImpl::SetInvalidationHandler(
|
| + const std::string& handler_name,
|
| + SyncNotifierObserver* handler) {
|
| + DCHECK(thread_checker_.CalledOnValidThread());
|
| + // We may be called when initialization fails, so |initialized_| may
|
| + // be false.
|
| + sync_notifier_->SetHandler(handler_name, handler);
|
| +}
|
| +
|
| void SyncManagerImpl::UpdateRegisteredInvalidationIds(
|
| - SyncNotifierObserver* handler,
|
| + const std::string& handler_name,
|
| const ObjectIdSet& ids) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| - sync_notifier_->UpdateRegisteredIds(handler, ids);
|
| + DCHECK(initialized_);
|
| + sync_notifier_->UpdateRegisteredIds(handler_name, ids);
|
| }
|
|
|
| void SyncManagerImpl::SetEncryptionPassphrase(
|
| @@ -1217,7 +1232,7 @@ void SyncManagerImpl::ShutdownOnSyncThread() {
|
| RemoveObserver(&debug_info_event_listener_);
|
|
|
| if (sync_notifier_.get()) {
|
| - sync_notifier_->UpdateRegisteredIds(this, ObjectIdSet());
|
| + sync_notifier_->SetHandler(kHandlerName, NULL);
|
| }
|
| sync_notifier_.reset();
|
|
|
|
|