Chromium Code Reviews| 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 93da8de4e6ef4cefd1aa83a868ded25e19cb68b2..03238fc28208dce042bb42ab392b8a8b5f207f65 100644 |
| --- a/sync/internal_api/sync_manager_impl.cc |
| +++ b/sync/internal_api/sync_manager_impl.cc |
| @@ -63,6 +63,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,9 @@ bool SyncManagerImpl::Init( |
| change_delegate_ = change_delegate; |
| sync_notifier_ = sync_notifier.Pass(); |
| + if (sync_notifier_.get()) { |
|
msw
2012/08/03 23:30:46
nit: remove unnecessary {}
akalin
2012/08/07 07:25:19
Done.
|
| + sync_notifier_->SetHandler(kHandlerName, this); |
| + } |
| AddObserver(&js_sync_manager_observer_); |
| SetJsEventHandler(event_handler); |
| @@ -734,14 +739,20 @@ void SyncManagerImpl::UpdateEnabledTypes( |
| const ModelTypeSet& enabled_types) { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| sync_notifier_->UpdateRegisteredIds( |
| - this, |
| + kHandlerName, |
| ModelTypeSetToObjectIdSet(enabled_types)); |
| } |
| +void SyncManagerImpl::SetInvalidationHandler( |
|
tim (not reviewing)
2012/08/06 05:55:32
DCHECK(initialized) too?
akalin
2012/08/07 07:25:19
Can't. Added comment why not. :/
|
| + const std::string& handler_name, SyncNotifierObserver* handler) { |
|
msw
2012/08/03 23:30:46
one param per line
akalin
2012/08/07 07:25:19
Done.
|
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| + sync_notifier_->SetHandler(handler_name, handler); |
| +} |
| + |
| void SyncManagerImpl::UpdateRegisteredInvalidationIds( |
| - SyncNotifierObserver* handler, const ObjectIdSet& ids) { |
| + const std::string& handler_name, const ObjectIdSet& ids) { |
|
msw
2012/08/03 23:30:46
one param per line
akalin
2012/08/07 07:25:19
Done.
|
| DCHECK(thread_checker_.CalledOnValidThread()); |
| - sync_notifier_->UpdateRegisteredIds(handler, ids); |
| + sync_notifier_->UpdateRegisteredIds(handler_name, ids); |
| } |
| void SyncManagerImpl::SetEncryptionPassphrase( |
| @@ -1216,7 +1227,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(); |