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

Unified Diff: base/prefs/json_pref_store.h

Issue 90563003: Fix a race condition in preference metric reporting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | base/prefs/json_pref_store.cc » ('j') | base/prefs/json_pref_store.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/prefs/json_pref_store.h
diff --git a/base/prefs/json_pref_store.h b/base/prefs/json_pref_store.h
index 9e6c1821834e712496f6cf481fc501a56bbfab30..95ecfbb56255577bba1856c9937f734f91cecb3d 100644
--- a/base/prefs/json_pref_store.h
+++ b/base/prefs/json_pref_store.h
@@ -13,6 +13,7 @@
#include "base/files/file_path.h"
#include "base/files/important_file_writer.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/observer_list.h"
#include "base/prefs/base_prefs_export.h"
@@ -51,6 +52,10 @@ class BASE_PREFS_EXPORT JsonPrefStore
virtual bool HasObservers() const OVERRIDE;
virtual bool IsInitializationComplete() const OVERRIDE;
+ // Adds an observer that will be automatically deregistered and destroyed by
+ // ~JsonPrefStore().
+ void AddOwnedObserver(scoped_ptr<PrefStore::Observer> observer);
gab 2013/11/27 23:43:27 #include base/prefs/pref_store.h for PrefStore::O
robertshield 2013/11/28 02:54:26 AddObserver takes a raw pointer, any reason not to
erikwright (departed) 2013/11/28 17:48:07 Because there is a transfer of ownership.
+
// PersistentPrefStore overrides:
virtual bool GetMutableValue(const std::string& key,
base::Value** result) OVERRIDE;
@@ -89,6 +94,7 @@ class BASE_PREFS_EXPORT JsonPrefStore
base::ImportantFileWriter writer_;
ObserverList<PrefStore::Observer, true> observers_;
+ ScopedVector<PrefStore::Observer> owned_observers_;
scoped_ptr<ReadErrorDelegate> error_delegate_;
« no previous file with comments | « no previous file | base/prefs/json_pref_store.cc » ('j') | base/prefs/json_pref_store.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698