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

Unified Diff: components/prefs/pref_service.h

Issue 2799143002: Improve profile stats performace. (Closed)
Patch Set: Always Created 3 years, 8 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/ui/webui/prefs_internals_source.cc ('k') | components/prefs/pref_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/prefs/pref_service.h
diff --git a/components/prefs/pref_service.h b/components/prefs/pref_service.h
index e08e361c40b618da1637b995323745dfc1e0052f..7860f14c0841bdcaca9852017b0ee9ca470548de 100644
--- a/components/prefs/pref_service.h
+++ b/components/prefs/pref_service.h
@@ -250,23 +250,22 @@ class COMPONENTS_PREFS_EXPORT PrefService : public base::NonThreadSafe {
// this checks if a value exists for the path.
bool HasPrefPath(const std::string& path) const;
- // Returns a dictionary with effective preference values.
- std::unique_ptr<base::DictionaryValue> GetPreferenceValues() const;
-
- // Returns a dictionary with effective preference values, omitting prefs that
- // are at their default values.
- std::unique_ptr<base::DictionaryValue> GetPreferenceValuesOmitDefaults()
- const;
-
- // Returns a dictionary with effective preference values. Contrary to
- // GetPreferenceValues(), the paths of registered preferences are not split on
- // '.' characters. If a registered preference stores a dictionary, however,
- // the hierarchical structure inside the preference will be preserved.
- // For example, if "foo.bar" is a registered preference, the result could look
- // like this:
- // {"foo.bar": {"a": {"b": true}}}.
- std::unique_ptr<base::DictionaryValue>
- GetPreferenceValuesWithoutPathExpansion() const;
+ // Issues a callback for every preference value. The preferences must not be
+ // mutated during iteration.
+ void IteratePreferenceValues(
+ base::RepeatingCallback<void(const std::string& key,
+ const base::Value& value)> callback) const;
+
+ // Returns a dictionary with effective preference values. This is an expensive
+ // operation which does a deep copy. Use only if you really need the results
+ // in a base::Value (for example, for JSON serialization). Otherwise use
+ // IteratePreferenceValues above to avoid the copies.
+ //
+ // If include_defaults is set, preferences set to their default values will
+ // be included. Otherwise, these will be omitted from the returned
+ // dictionary.
+ std::unique_ptr<base::DictionaryValue> GetPreferenceValues(
+ bool include_defaults) const;
Roger Tawa OOO till Jul 10th 2017/04/11 21:04:29 Would be better if this were an enum instead of a
brettw 2017/04/18 19:28:38 Done
bool ReadOnly() const;
« no previous file with comments | « chrome/browser/ui/webui/prefs_internals_source.cc ('k') | components/prefs/pref_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698