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

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

Issue 7046067: [Sync] Fix use of ObserverList by multiple threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync to head Created 9 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 | « no previous file | 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 5b31201da3cc6e98d672d063b14d3e29f2d40b85..d195a5002ea25cf18404512c5d30155944dc8f43 100644
--- a/chrome/browser/sync/syncable/syncable.h
+++ b/chrome/browser/sync/syncable/syncable.h
@@ -996,6 +996,12 @@ class Directory {
void AddRef(); // For convenience.
void Release();
+ void AddChangeListener(DirectoryChangeListener* listener);
+ void RemoveChangeListener(DirectoryChangeListener* listener);
+
+ void CopyChangeListeners(
+ ObserverList<DirectoryChangeListener>* change_listeners);
+
FilePath const db_path;
// TODO(timsteele): audit use of the member and remove if possible
volatile base::subtle::AtomicWord refcount;
@@ -1038,10 +1044,6 @@ class Directory {
// TODO(ncarter): Figure out what the hell this is, and comment it.
Channel* const channel;
- // The listeners for directory change events, triggered when the
- // transaction is ending.
- ObserverList<DirectoryChangeListener> change_listeners_;
-
KernelShareInfoStatus info_status;
// These 3 members are backed in the share_info table, and
@@ -1065,6 +1067,12 @@ class Directory {
// Keep a history of recently flushed metahandles for debugging
// purposes. Protected by the save_changes_mutex.
DebugQueue<int64, 1000> flushed_metahandles;
+
+ private:
+ // The listeners for directory change events, triggered when the
+ // transaction is ending (and its lock).
+ base::Lock change_listeners_lock_;
+ ObserverList<DirectoryChangeListener> change_listeners_;
};
// Helper method used to do searches on |parent_id_child_index|.
« no previous file with comments | « no previous file | chrome/browser/sync/syncable/syncable.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698