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

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

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/sessions/sync_session_unittest.cc ('k') | chrome/browser/sync/syncable/syncable.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/syncable/syncable.h
diff --git a/chrome/browser/sync/syncable/syncable.h b/chrome/browser/sync/syncable/syncable.h
index b5c196a5bcbb708f219bace845899f07ba7a3be1..e561de3ba2fef30223b93cde5f7c2b71eead0225 100644
--- a/chrome/browser/sync/syncable/syncable.h
+++ b/chrome/browser/sync/syncable/syncable.h
@@ -26,6 +26,7 @@
#include "chrome/browser/sync/syncable/path_name_cmp.h"
#include "chrome/browser/sync/syncable/syncable_id.h"
#include "chrome/browser/sync/syncable/model_type.h"
+#include "chrome/browser/sync/util/channel.h"
#include "chrome/browser/sync/util/dbgq.h"
#include "chrome/browser/sync/util/row_iterator.h"
#include "chrome/browser/sync/util/sync_types.h"
@@ -672,6 +673,8 @@ class Directory {
FRIEND_TEST(SyncableDirectoryTest, TakeSnapshotGetsOnlyDirtyHandlesTest);
public:
+ class EventListenerHookup;
+
// Various data that the Directory::Kernel we are backing (persisting data
// for) needs saved across runs of the application.
struct PersistedKernelInfo {
@@ -780,6 +783,9 @@ class Directory {
// Unique to each account / client pair.
std::string cache_guid() const;
+ browser_sync::ChannelHookup<DirectoryChangeEvent>* AddChangeObserver(
+ browser_sync::ChannelEventHandler<DirectoryChangeEvent>* observer);
+
protected: // for friends, mainly used by Entry constructors
EntryKernel* GetEntryByHandle(const int64 handle);
EntryKernel* GetEntryByHandle(const int64 metahandle, ScopedKernelLock* lock);
@@ -816,7 +822,6 @@ class Directory {
};
public:
typedef EventChannel<DirectoryEventTraits, Lock> Channel;
- typedef EventChannel<DirectoryChangeEvent, Lock> ChangesChannel;
typedef std::vector<int64> ChildHandles;
// Returns the child meta handles for given parent id.
@@ -869,9 +874,6 @@ class Directory {
inline Channel* channel() const {
return kernel_->channel;
}
- inline ChangesChannel* changes_channel() const {
- return kernel_->changes_channel;
- }
// Checks tree metadata consistency.
// If full_scan is false, the function will avoid pulling any entries from the
@@ -998,7 +1000,8 @@ class Directory {
// The changes channel mutex is explicit because it must be locked
// while holding the transaction mutex and released after
// releasing the transaction mutex.
- ChangesChannel* const changes_channel;
+ browser_sync::Channel<DirectoryChangeEvent> changes_channel;
+
Lock changes_channel_mutex;
KernelShareInfoStatus info_status;
« no previous file with comments | « chrome/browser/sync/sessions/sync_session_unittest.cc ('k') | chrome/browser/sync/syncable/syncable.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698