Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(606)

Unified Diff: sync/internal_api/sync_manager_impl.cc

Issue 10702074: Refactor sync-specific parts out of SyncNotifier/SyncNotifierObserver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: FOR_THE_HORDE Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 6a164d8f0ff2aac4ff56893cfc13914c323e1737..c7deaa7cc40fc17a7954f81370894a96b7c726fd 100644
--- a/sync/internal_api/sync_manager_impl.cc
+++ b/sync/internal_api/sync_manager_impl.cc
@@ -39,6 +39,7 @@
#include "sync/js/js_event_details.h"
#include "sync/js/js_event_handler.h"
#include "sync/js/js_reply_handler.h"
+#include "sync/notifier/invalidation_util.h"
#include "sync/notifier/notifications_disabled_reason.h"
#include "sync/notifier/sync_notifier.h"
#include "sync/protocol/encryption.pb.h"
@@ -486,8 +487,6 @@ bool SyncManagerImpl::Init(
if (!success)
return false;
- sync_notifier_->AddObserver(this);
-
return success;
}
@@ -730,7 +729,8 @@ void SyncManagerImpl::UpdateCredentials(
void SyncManagerImpl::UpdateEnabledTypes(
const ModelTypeSet& enabled_types) {
DCHECK(thread_checker_.CalledOnValidThread());
- sync_notifier_->UpdateEnabledTypes(enabled_types);
+ sync_notifier_->UpdateRegisteredIds(this,
+ ModelTypeSetToObjectIdSet(enabled_types));
}
void SyncManagerImpl::SetEncryptionPassphrase(
@@ -1200,7 +1200,7 @@ void SyncManagerImpl::ShutdownOnSyncThread() {
RemoveObserver(&debug_info_event_listener_);
if (sync_notifier_.get()) {
- sync_notifier_->RemoveObserver(this);
+ sync_notifier_->UpdateRegisteredIds(this, ObjectIdSet());
}
sync_notifier_.reset();
@@ -1786,9 +1786,11 @@ void SyncManagerImpl::OnNotificationsDisabled(
}
void SyncManagerImpl::OnIncomingNotification(
- const ModelTypePayloadMap& type_payloads,
+ const ObjectIdPayloadMap& id_payloads,
IncomingNotificationSource source) {
DCHECK(thread_checker_.CalledOnValidThread());
+ const ModelTypePayloadMap& type_payloads =
+ ObjectIdPayloadMapToModelTypePayloadMap(id_payloads);
if (source == LOCAL_NOTIFICATION) {
scheduler_->ScheduleNudgeWithPayloadsAsync(
TimeDelta::FromMilliseconds(kSyncRefreshDelayMsec),
@@ -1880,11 +1882,11 @@ void SyncManagerImpl::SimulateDisableNotificationsForTest(int reason) {
void SyncManagerImpl::TriggerOnIncomingNotificationForTest(
ModelTypeSet model_types) {
DCHECK(thread_checker_.CalledOnValidThread());
- ModelTypePayloadMap model_types_with_payloads =
- ModelTypePayloadMapFromEnumSet(model_types,
- std::string());
+ const ModelTypePayloadMap& type_payloads =
+ ModelTypePayloadMapFromEnumSet(model_types, std::string());
- OnIncomingNotification(model_types_with_payloads, REMOTE_NOTIFICATION);
+ OnIncomingNotification(ModelTypePayloadMapToObjectIdPayloadMap(type_payloads),
+ REMOTE_NOTIFICATION);
}
// static.

Powered by Google App Engine
This is Rietveld 408576698