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

Unified Diff: chrome/browser/sync/syncable/syncable.cc

Issue 2075012: Replace changes_channel with an observer list. (Closed)
Patch Set: Ready for checkin Created 10 years, 6 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
« no previous file with comments | « chrome/browser/sync/syncable/syncable.h ('k') | chrome/browser/sync/util/channel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/syncable/syncable.cc
diff --git a/chrome/browser/sync/syncable/syncable.cc b/chrome/browser/sync/syncable/syncable.cc
index ae0307cbb94cdca7dd4881ab5d821ead05c3729c..42e48674c538c3d0a500d8c7f36ed930277b2d66 100644
--- a/chrome/browser/sync/syncable/syncable.cc
+++ b/chrome/browser/sync/syncable/syncable.cc
@@ -172,7 +172,6 @@ Directory::Kernel::Kernel(const FilePath& db_path,
unsynced_metahandles(new MetahandleSet),
dirty_metahandles(new MetahandleSet),
channel(new Directory::Channel(syncable::DIRECTORY_DESTROYED)),
- changes_channel(new Directory::ChangesChannel(kShutdownChangesEvent)),
info_status(Directory::KERNEL_SHARE_INFO_VALID),
persisted_info(info.kernel_info),
cache_guid(info.cache_guid),
@@ -195,7 +194,7 @@ void Directory::Kernel::Release() {
Directory::Kernel::~Kernel() {
CHECK(0 == refcount);
delete channel;
- delete changes_channel;
+ changes_channel.Notify(kShutdownChangesEvent);
delete unsynced_metahandles;
delete unapplied_update_metahandles;
delete dirty_metahandles;
@@ -898,6 +897,11 @@ void Directory::CheckTreeInvariants(syncable::BaseTransaction* trans,
// pulling entries into RAM
}
+browser_sync::ChannelHookup<DirectoryChangeEvent>* Directory::AddChangeObserver(
+ browser_sync::ChannelEventHandler<DirectoryChangeEvent>* observer) {
+ return kernel_->changes_channel.AddObserver(observer);
+}
+
///////////////////////////////////////////////////////////////////////////////
// ScopedKernelLocks
@@ -954,14 +958,14 @@ void BaseTransaction::UnlockAndLog(OriginalEntries* originals_arg) {
// Tell listeners to calculate changes while we still have the mutex.
DirectoryChangeEvent event = { DirectoryChangeEvent::CALCULATE_CHANGES,
originals.get(), this, writer_ };
- dirkernel_->changes_channel->NotifyListeners(event);
+ dirkernel_->changes_channel.Notify(event);
dirkernel_->transaction_mutex.Release();
DirectoryChangeEvent complete_event =
{ DirectoryChangeEvent::TRANSACTION_COMPLETE,
NULL, NULL, INVALID };
- dirkernel_->changes_channel->NotifyListeners(complete_event);
+ dirkernel_->changes_channel.Notify(complete_event);
}
ReadTransaction::ReadTransaction(Directory* directory, const char* file,
« no previous file with comments | « chrome/browser/sync/syncable/syncable.h ('k') | chrome/browser/sync/util/channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698