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

Issue 2812863002: Pref service: Add a ScopedDictionaryPrefUpdate to track value changes. (Closed)

Created:
3 years, 8 months ago by Sam McNally
Modified:
3 years, 7 months ago
Reviewers:
tibell
CC:
chromium-reviews, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org, abarth-chromium, Aaron Boodman, darin (slow to review), chrome-apps-syd-reviews_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Pref service: Add a ScopedDictionaryPrefUpdate to track value changes. Currently, if a pref is changed and the pref service is enabled, the entire value is sent to the pref service and other clients. For large prefs used by extensions or content settings this can result milliseconds of busy time on the UI thread. ScopedDictionaryPrefUpdate tracks which components of a pref are changed so only the changes need to be sent to the pref service and other pref clients. BUG=654988

Patch Set 1 : #

Total comments: 7

Patch Set 2 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1637 lines, -48 lines) Patch
M components/prefs/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M components/prefs/pref_service.h View 3 chunks +8 lines, -0 lines 0 comments Download
M components/prefs/pref_service.cc View 1 chunk +8 lines, -0 lines 0 comments Download
M components/prefs/writeable_pref_store.h View 2 chunks +19 lines, -5 lines 0 comments Download
A components/prefs/writeable_pref_store.cc View 1 chunk +12 lines, -0 lines 0 comments Download
M mojo/common/values_struct_traits.h View 1 chunk +6 lines, -0 lines 0 comments Download
M mojo/common/values_struct_traits.cc View 2 chunks +7 lines, -3 lines 0 comments Download
M services/preferences/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M services/preferences/persistent_pref_store_impl.cc View 3 chunks +34 lines, -6 lines 0 comments Download
M services/preferences/pref_service_factory_unittest.cc View 5 chunks +210 lines, -0 lines 0 comments Download
M services/preferences/public/cpp/BUILD.gn View 2 chunks +3 lines, -0 lines 0 comments Download
A services/preferences/public/cpp/lib/BUILD.gn View 1 chunk +16 lines, -0 lines 0 comments Download
A services/preferences/public/cpp/lib/util.h View 1 chunk +26 lines, -0 lines 0 comments Download
A services/preferences/public/cpp/lib/util.cc View 1 chunk +34 lines, -0 lines 0 comments Download
M services/preferences/public/cpp/persistent_pref_store_client.h View 4 chunks +13 lines, -2 lines 0 comments Download
M services/preferences/public/cpp/persistent_pref_store_client.cc View 4 chunks +98 lines, -15 lines 0 comments Download
M services/preferences/public/cpp/pref_store_client_mixin.h View 2 chunks +2 lines, -1 line 0 comments Download
M services/preferences/public/cpp/pref_store_client_mixin.cc View 2 chunks +29 lines, -10 lines 0 comments Download
M services/preferences/public/cpp/pref_store_impl.h View 1 chunk +1 line, -0 lines 0 comments Download
M services/preferences/public/cpp/pref_store_impl.cc View 3 chunks +6 lines, -2 lines 0 comments Download
A services/preferences/public/cpp/scoped_pref_update.h View 1 chunk +197 lines, -0 lines 0 comments Download
A services/preferences/public/cpp/scoped_pref_update.cc View 1 chunk +385 lines, -0 lines 0 comments Download
M services/preferences/public/cpp/tests/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
A services/preferences/public/cpp/tests/persistent_pref_store_client_unittest.cc View 1 chunk +500 lines, -0 lines 0 comments Download
M services/preferences/public/cpp/tests/pref_store_client_unittest.cc View 1 chunk +3 lines, -1 line 0 comments Download
M services/preferences/public/interfaces/preferences.mojom View 1 chunk +17 lines, -3 lines 0 comments Download

Messages

Total messages: 25 (23 generated)
Sam McNally
3 years, 8 months ago (2017-04-12 06:34:42 UTC) #24
tibell
3 years, 8 months ago (2017-04-12 07:13:53 UTC) #25
Initial batch of comments.

https://codereview.chromium.org/2812863002/diff/80001/services/preferences/pe...
File services/preferences/persistent_pref_store_impl.cc (right):

https://codereview.chromium.org/2812863002/diff/80001/services/preferences/pe...
services/preferences/persistent_pref_store_impl.cc:139:
backing_pref_store_->SetValue(update->key, value->CreateDeepCopy(),
Can't we move out value?

https://codereview.chromium.org/2812863002/diff/80001/services/preferences/pe...
services/preferences/persistent_pref_store_impl.cc:147:
DCHECK(update->value->is_split_updates());
I'd prefer that this was in an else block without the continue statement above.
If that's too much nesting pull it out into a helper function/method.

https://codereview.chromium.org/2812863002/diff/80001/services/preferences/pu...
File services/preferences/public/cpp/lib/util.h (right):

https://codereview.chromium.org/2812863002/diff/80001/services/preferences/pu...
services/preferences/public/cpp/lib/util.h:20: void
SetValue(base::DictionaryValue* dictionary_value,
// Sets a nested value inside the dictionary, specified by |path_components|.
Creates nested dictionaries as needed.

https://codereview.chromium.org/2812863002/diff/80001/services/preferences/pu...
File services/preferences/public/cpp/scoped_pref_update.h (right):

https://codereview.chromium.org/2812863002/diff/80001/services/preferences/pu...
services/preferences/public/cpp/scoped_pref_update.h:22: // An update to a
dictionary value pref.
Could you include an example code snippet of how to use this class?

https://codereview.chromium.org/2812863002/diff/80001/services/preferences/pu...
services/preferences/public/cpp/scoped_pref_update.h:49: DictionaryValueUpdate*
value_;
Owned?

https://codereview.chromium.org/2812863002/diff/80001/services/preferences/pu...
File
services/preferences/public/cpp/tests/persistent_pref_store_client_unittest.cc
(right):

https://codereview.chromium.org/2812863002/diff/80001/services/preferences/pu...
services/preferences/public/cpp/tests/persistent_pref_store_client_unittest.cc:54:
{ ScopedDictionaryPrefUpdate update(pref_service(), kDictionaryKey); }
As per offline discussion remove these checks.

https://codereview.chromium.org/2812863002/diff/80001/services/preferences/pu...
File services/preferences/public/interfaces/preferences.mojom (right):

https://codereview.chromium.org/2812863002/diff/80001/services/preferences/pu...
services/preferences/public/interfaces/preferences.mojom:111:
array<SubPrefUpdate> split_updates;
// Updates to several values withing a pref (e.g. inside a dictionary stored
under the pref key).

Powered by Google App Engine
This is Rietveld 408576698