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

Unified Diff: chrome/browser/sync/glue/chrome_sync_notification_bridge.cc

Issue 10702074: Refactor sync-specific parts out of SyncNotifier/SyncNotifierObserver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DEPS 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: chrome/browser/sync/glue/chrome_sync_notification_bridge.cc
diff --git a/chrome/browser/sync/glue/chrome_sync_notification_bridge.cc b/chrome/browser/sync/glue/chrome_sync_notification_bridge.cc
index 9936fa08f020e93b0eff6fe86a1dcbecc3f81db8..35e2781d571c2c0f32fa605014a9ca3c1050191f 100644
--- a/chrome/browser/sync/glue/chrome_sync_notification_bridge.cc
+++ b/chrome/browser/sync/glue/chrome_sync_notification_bridge.cc
@@ -14,9 +14,7 @@ using content::BrowserThread;
namespace browser_sync {
ChromeSyncNotificationBridge::ChromeSyncNotificationBridge(
- const Profile* profile)
- : observers_(
- new ObserverListThreadSafe<syncer::SyncNotifierObserver>()) {
+ const Profile* profile) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(profile);
registrar_.Add(this, chrome::NOTIFICATION_SYNC_REFRESH_LOCAL,
@@ -33,14 +31,11 @@ void ChromeSyncNotificationBridge::UpdateEnabledTypes(
enabled_types_ = types;
}
-void ChromeSyncNotificationBridge::AddObserver(
- syncer::SyncNotifierObserver* observer) {
- observers_->AddObserver(observer);
-}
-
-void ChromeSyncNotificationBridge::RemoveObserver(
- syncer::SyncNotifierObserver* observer) {
- observers_->RemoveObserver(observer);
+void ChromeSyncNotificationBridge::UpdateRegisteredIds(
+ syncer::SyncNotifierObserver* handler,
+ const syncer::ObjectIdSet& ids) {
+ base::AutoLock locker_(helper_lock_);
+ helper_.UpdateRegisteredIds(handler, ids);
}
void ChromeSyncNotificationBridge::Observe(
@@ -69,9 +64,10 @@ void ChromeSyncNotificationBridge::Observe(
syncer::ModelTypePayloadMapFromEnumSet(enabled_types_, std::string());
}
- observers_->Notify(
- &syncer::SyncNotifierObserver::OnIncomingNotification,
- payload_map, notification_source);
+ base::AutoLock locker_(helper_lock_);
+ helper_.DispatchInvalidationsToHandlers(
akalin 2012/07/19 00:42:06 this won't work. the invalidations must happen on
dcheng 2012/07/19 18:31:05 I don't quite understand the issue. Why isn't it a
akalin 2012/07/19 23:07:26 ObserverListThreadSafe guarantees that notificatio
dcheng 2012/07/20 00:57:04 Ah. My fault for not looking at the implementation
+ ModelTypePayloadMapToObjectIdPayloadMap(payload_map),
+ notification_source);
}
} // namespace browser_sync

Powered by Google App Engine
This is Rietveld 408576698