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

Unified Diff: base/prefs/pref_filter.h

Issue 257003007: Introduce a new framework for back-and-forth tracked/protected preferences migration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment nit Created 6 years, 7 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 | « base/prefs/persistent_pref_store.h ('k') | chrome/browser/prefs/chrome_pref_service_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/prefs/pref_filter.h
diff --git a/base/prefs/pref_filter.h b/base/prefs/pref_filter.h
index ce07f929c7a7fc94f1569f66d3e403eee0f3c355..1020029131ab3daaec1f3abbfa322781915d9abf 100644
--- a/base/prefs/pref_filter.h
+++ b/base/prefs/pref_filter.h
@@ -7,6 +7,8 @@
#include <string>
+#include "base/callback_forward.h"
+#include "base/memory/scoped_ptr.h"
#include "base/prefs/base_prefs_export.h"
namespace base {
@@ -18,15 +20,25 @@ class Value;
// Currently supported only by JsonPrefStore.
class BASE_PREFS_EXPORT PrefFilter {
public:
+ // A callback to be invoked when |prefs| have been read (and possibly
+ // pre-modified) and are now ready to be handed back to this callback's
+ // builder. |schedule_write| indicates whether a write should be immediately
+ // scheduled (typically because the |prefs| were pre-modified).
+ typedef base::Callback<void(scoped_ptr<base::DictionaryValue> prefs,
+ bool schedule_write)> PostFilterOnLoadCallback;
+
virtual ~PrefFilter() {}
- // Receives notification when the pref store data has been loaded but before
- // Observers are notified.
- // Changes made by a PrefFilter during FilterOnLoad do not result in
- // notifications to |PrefStore::Observer|s.
- // Implementations should return true if they modify the dictionary, to allow
- // the changes to be persisted.
- virtual bool FilterOnLoad(base::DictionaryValue* pref_store_contents) = 0;
+ // This method is given ownership of the |pref_store_contents| read from disk
+ // before the underlying PersistentPrefStore gets to use them. It must hand
+ // them back via |post_filter_on_load_callback|, but may modify them first.
+ // Note: This method is asynchronous, which may make calls like
+ // PersistentPrefStore::ReadPrefs() asynchronous. The owner of filtered
+ // PersistentPrefStores should handle this to make the reads look synchronous
+ // to external users (see SegregatedPrefStore::ReadPrefs() for an example).
+ virtual void FilterOnLoad(
+ const PostFilterOnLoadCallback& post_filter_on_load_callback,
+ scoped_ptr<base::DictionaryValue> pref_store_contents) = 0;
// Receives notification when a pref store value is changed, before Observers
// are notified.
« no previous file with comments | « base/prefs/persistent_pref_store.h ('k') | chrome/browser/prefs/chrome_pref_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698