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

Issue 5646003: Sanitize PrefStore interface. (Closed)

Created:
10 years ago by Mattias Nissler (ping if slow)
Modified:
9 years, 7 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, ben+cc_chromium.org, Erik does not do reviews, brettw-cc_chromium.org, pam+watch_chromium.org, darin-cc_chromium.org, nkostylev+cc_chromium.org, davemoore+watch_chromium.org, Paweł Hajdan Jr., amit
Visibility:
Public.

Description

Sanitize PrefStore interface. This reworks the PrefStore interface, specifically: - Split up the interface into PrefStore, which only provides reading functionality, and the derived PersistentPrefStore for the actual user pref store - Remove the hurt-me-plenty prefs() function from PrefStore, instead provide Get/Set/Remove operations - Remove special handling of default and user pref store from PrefValueStore and put it into PrefService - Pref change notification handling now almost exclusively handled through PrefValueStore - Adjust all consumers of these interfaces (but keep ConfigurationPolicyPrefStore untouched, that's up next on the list) BUG=64232 TEST=existing unit tests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=68736

Patch Set 1 #

Patch Set 2 : Rebase, fix up unit tests. #

Total comments: 83

Patch Set 3 : Address comments. #

Patch Set 4 : Rebase, fix build. #

Patch Set 5 : fix for chrome frame #

Total comments: 6

Patch Set 6 : Fix PrefService mock construction in PrefServiceTest to include command line store. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1525 lines, -1205 lines) Patch
M chrome/browser/browser_main.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/browser_process_impl.cc View 1 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/chromeos/login/signed_settings_temp_storage_unittest.cc View 1 1 chunk +1 line, -1 line 0 comments Download
A chrome/browser/extensions/extension_pref_store.h View 1 2 1 chunk +36 lines, -0 lines 0 comments Download
A chrome/browser/extensions/extension_pref_store.cc View 1 2 1 chunk +28 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_prefs.h View 1 3 chunks +8 lines, -1 line 0 comments Download
M chrome/browser/extensions/extension_prefs.cc View 1 2 3 4 chunks +13 lines, -18 lines 0 comments Download
M chrome/browser/extensions/extensions_service_unittest.cc View 1 2 2 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/extensions/test_extension_prefs.cc View 1 2 3 chunks +19 lines, -7 lines 0 comments Download
M chrome/browser/metrics/metrics_service_uitest.cc View 1 2 3 2 chunks +4 lines, -5 lines 0 comments Download
M chrome/browser/net/pref_proxy_config_service_unittest.cc View 1 2 3 5 chunks +13 lines, -11 lines 0 comments Download
M chrome/browser/policy/configuration_policy_pref_store.h View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/policy/configuration_policy_pref_store.cc View 1 2 2 chunks +19 lines, -9 lines 0 comments Download
M chrome/browser/policy/configuration_policy_pref_store_unittest.cc View 15 chunks +47 lines, -55 lines 0 comments Download
M chrome/browser/prefs/command_line_pref_store.h View 2 chunks +3 lines, -8 lines 0 comments Download
M chrome/browser/prefs/command_line_pref_store.cc View 2 chunks +5 lines, -9 lines 0 comments Download
M chrome/browser/prefs/command_line_pref_store_unittest.cc View 6 chunks +21 lines, -25 lines 0 comments Download
A chrome/browser/prefs/default_pref_store.h View 1 1 chunk +30 lines, -0 lines 0 comments Download
D chrome/browser/prefs/in_memory_pref_store.h View 1 1 chunk +0 lines, -32 lines 0 comments Download
D chrome/browser/prefs/in_memory_pref_store.cc View 1 1 chunk +0 lines, -21 lines 0 comments Download
M chrome/browser/prefs/pref_change_registrar_unittest.cc View 1 2 chunks +4 lines, -0 lines 0 comments Download
M chrome/browser/prefs/pref_service.h View 1 2 7 chunks +11 lines, -23 lines 0 comments Download
M chrome/browser/prefs/pref_service.cc View 1 2 15 chunks +33 lines, -70 lines 0 comments Download
A chrome/browser/prefs/pref_service_mock_builder.h View 1 2 1 chunk +69 lines, -0 lines 0 comments Download
A chrome/browser/prefs/pref_service_mock_builder.cc View 1 2 1 chunk +107 lines, -0 lines 0 comments Download
M chrome/browser/prefs/pref_service_unittest.cc View 1 2 3 4 5 6 chunks +74 lines, -69 lines 0 comments Download
A chrome/browser/prefs/pref_value_map.h View 1 2 1 chunk +46 lines, -0 lines 0 comments Download
A chrome/browser/prefs/pref_value_map.cc View 1 2 1 chunk +57 lines, -0 lines 0 comments Download
M chrome/browser/prefs/pref_value_store.h View 1 2 9 chunks +17 lines, -66 lines 0 comments Download
M chrome/browser/prefs/pref_value_store.cc View 1 2 10 chunks +44 lines, -150 lines 0 comments Download
M chrome/browser/prefs/pref_value_store_unittest.cc View 1 2 15 chunks +163 lines, -216 lines 0 comments Download
M chrome/browser/prefs/testing_pref_store.h View 1 2 2 chunks +39 lines, -22 lines 0 comments Download
M chrome/browser/prefs/testing_pref_store.cc View 1 2 2 chunks +74 lines, -10 lines 0 comments Download
A chrome/browser/prefs/value_map_pref_store.h View 1 2 1 chunk +48 lines, -0 lines 0 comments Download
A chrome/browser/prefs/value_map_pref_store.cc View 1 2 1 chunk +37 lines, -0 lines 0 comments Download
M chrome/browser/profiles/profile_impl.cc View 1 2 3 4 chunks +10 lines, -6 lines 0 comments Download
M chrome/browser/search_engines/keyword_editor_controller_unittest.cc View 1 chunk +5 lines, -5 lines 0 comments Download
M chrome/browser/search_engines/search_provider_install_data_unittest.cc View 1 chunk +5 lines, -5 lines 0 comments Download
M chrome/browser/search_engines/template_url_model.cc View 1 2 chunks +2 lines, -3 lines 0 comments Download
M chrome/browser/search_engines/template_url_model_test_util.h View 1 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/search_engines/template_url_model_test_util.cc View 1 2 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/search_engines/template_url_model_unittest.cc View 1 7 chunks +28 lines, -30 lines 0 comments Download
M chrome/browser/ui/cocoa/extensions/extension_popup_controller_unittest.mm View 1 2 2 chunks +5 lines, -1 line 0 comments Download
M chrome/chrome.gyp View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 3 chunks +7 lines, -2 lines 0 comments Download
M chrome/chrome_common.gypi View 1 1 chunk +1 line, -3 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/common/json_pref_store.h View 1 2 4 chunks +23 lines, -11 lines 0 comments Download
M chrome/common/json_pref_store.cc View 1 2 1 chunk +40 lines, -1 line 0 comments Download
M chrome/common/json_pref_store_unittest.cc View 4 chunks +36 lines, -20 lines 0 comments Download
A chrome/common/persistent_pref_store.h View 1 2 1 chunk +69 lines, -0 lines 0 comments Download
M chrome/common/pref_store.h View 1 2 3 chunks +17 lines, -49 lines 0 comments Download
D chrome/common/pref_store.cc View 1 2 1 chunk +0 lines, -14 lines 0 comments Download
D chrome/common/pref_store_base.h View 1 1 chunk +0 lines, -33 lines 0 comments Download
D chrome/common/pref_store_base.cc View 1 1 chunk +0 lines, -21 lines 0 comments Download
M chrome/service/cloud_print/cloud_print_proxy.h View 1 2 3 chunks +3 lines, -3 lines 0 comments Download
M chrome/service/cloud_print/cloud_print_proxy.cc View 1 2 7 chunks +28 lines, -26 lines 0 comments Download
M chrome/service/service_process.h View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/service/service_process.cc View 1 2 3 6 chunks +10 lines, -10 lines 0 comments Download
A chrome/service/service_process_prefs.h View 1 2 1 chunk +49 lines, -0 lines 0 comments Download
A chrome/service/service_process_prefs.cc View 1 2 1 chunk +54 lines, -0 lines 0 comments Download
M chrome/test/reliability/page_load_test.cc View 1 2 3 3 chunks +4 lines, -7 lines 0 comments Download
M chrome/test/testing_pref_service.h View 1 2 3 4 3 chunks +10 lines, -48 lines 0 comments Download
M chrome/test/testing_pref_service.cc View 1 2 4 chunks +12 lines, -54 lines 0 comments Download
M chrome/test/testing_profile.h View 1 2 3 2 chunks +4 lines, -0 lines 0 comments Download
M chrome/test/testing_profile.cc View 1 2 2 chunks +5 lines, -1 line 0 comments Download
M chrome_frame/test/reliability/page_load_test.cc View 1 2 3 4 3 chunks +7 lines, -9 lines 0 comments Download

Messages

Total messages: 14 (0 generated)
Mattias Nissler (ping if slow)
Please have a look. I know it's a lot, sorry.
10 years ago (2010-12-07 16:07:47 UTC) #1
Paweł Hajdan Jr.
Drive-by. http://codereview.chromium.org/5646003/diff/2001/chrome/browser/prefs/pref_service_unittest.cc File chrome/browser/prefs/pref_service_unittest.cc (right): http://codereview.chromium.org/5646003/diff/2001/chrome/browser/prefs/pref_service_unittest.cc#newcode149 chrome/browser/prefs/pref_service_unittest.cc:149: #if 0 Please DISABLE the test if needed. ...
10 years ago (2010-12-07 17:30:00 UTC) #2
Mattias Nissler (ping if slow)
+gfeher (FYI) http://codereview.chromium.org/5646003/diff/2001/chrome/browser/prefs/pref_service_unittest.cc File chrome/browser/prefs/pref_service_unittest.cc (right): http://codereview.chromium.org/5646003/diff/2001/chrome/browser/prefs/pref_service_unittest.cc#newcode149 chrome/browser/prefs/pref_service_unittest.cc:149: #if 0 On 2010/12/07 17:30:00, Paweł Hajdan ...
10 years ago (2010-12-08 09:22:38 UTC) #3
danno
http://codereview.chromium.org/5646003/diff/2001/chrome/browser/prefs/pref_service_unittest.cc File chrome/browser/prefs/pref_service_unittest.cc (right): http://codereview.chromium.org/5646003/diff/2001/chrome/browser/prefs/pref_service_unittest.cc#newcode150 chrome/browser/prefs/pref_service_unittest.cc:150: TEST(PrefServiceTest, ProxyFromCommandLineNotPolicy) { This test can be removed. It ...
10 years ago (2010-12-08 09:32:49 UTC) #4
battre (please use the other)
http://codereview.chromium.org/5646003/diff/2001/chrome/browser/extensions/extension_pref_store.h File chrome/browser/extensions/extension_pref_store.h (right): http://codereview.chromium.org/5646003/diff/2001/chrome/browser/extensions/extension_pref_store.h#newcode17 chrome/browser/extensions/extension_pref_store.h:17: // Set an extension preference |value| for |key|. Takes ...
10 years ago (2010-12-08 12:24:15 UTC) #5
gfeher
Just some random notes. http://codereview.chromium.org/5646003/diff/2001/chrome/browser/prefs/pref_value_store.cc File chrome/browser/prefs/pref_value_store.cc (right): http://codereview.chromium.org/5646003/diff/2001/chrome/browser/prefs/pref_value_store.cc#newcode327 chrome/browser/prefs/pref_value_store.cc:327: &changed_managed_platform_paths); Please indent. http://codereview.chromium.org/5646003/diff/2001/chrome/common/persistent_pref_store.h File ...
10 years ago (2010-12-08 12:34:35 UTC) #6
danno
a few issues and lots of nits. http://codereview.chromium.org/5646003/diff/2001/chrome/browser/extensions/extension_pref_store.cc File chrome/browser/extensions/extension_pref_store.cc (right): http://codereview.chromium.org/5646003/diff/2001/chrome/browser/extensions/extension_pref_store.cc#newcode20 chrome/browser/extensions/extension_pref_store.cc:20: void ExtensionPrefStore::OnInitializationCompleted() ...
10 years ago (2010-12-08 13:08:45 UTC) #7
danno
http://codereview.chromium.org/5646003/diff/2001/chrome/common/persistent_pref_store.h File chrome/common/persistent_pref_store.h (right): http://codereview.chromium.org/5646003/diff/2001/chrome/common/persistent_pref_store.h#newcode13 chrome/common/persistent_pref_store.h:13: // This interface is a complement to the PrefStore ...
10 years ago (2010-12-08 13:20:59 UTC) #8
Mattias Nissler (ping if slow)
Answered/addressed all your comments. Please take another look at the updated code. Thanks! http://codereview.chromium.org/5646003/diff/2001/chrome/browser/extensions/extension_pref_store.cc File ...
10 years ago (2010-12-09 10:20:20 UTC) #9
Nikita (slow)
Before you land this CL please make sure that user preference persistence is not broken ...
10 years ago (2010-12-09 10:24:41 UTC) #10
danno
http://codereview.chromium.org/5646003/diff/35001/chrome/browser/prefs/pref_service_unittest.cc File chrome/browser/prefs/pref_service_unittest.cc (right): http://codereview.chromium.org/5646003/diff/35001/chrome/browser/prefs/pref_service_unittest.cc#newcode182 chrome/browser/prefs/pref_service_unittest.cc:182: builder.WithManagedPlatformProvider(provider.get()); command line is missing. http://codereview.chromium.org/5646003/diff/35001/chrome/browser/prefs/pref_service_unittest.cc#newcode219 chrome/browser/prefs/pref_service_unittest.cc:219: builder.WithManagedPlatformProvider(provider.get()); command ...
10 years ago (2010-12-09 14:14:44 UTC) #11
Mattias Nissler (ping if slow)
Danno's comments fixed, please take another look. @Nikita: Your problem is unrelated to this CL, ...
10 years ago (2010-12-09 14:57:11 UTC) #12
Aaron Boodman
Is it now possible to have ExtensionPrefs directly implement PrefStore? And instead of maintaining a ...
10 years ago (2010-12-21 18:18:58 UTC) #13
Mattias Nissler (ping if slow)
10 years ago (2010-12-21 20:43:33 UTC) #14
On 2010/12/21 18:18:58, Aaron Boodman wrote:
> Is it now possible to have ExtensionPrefs directly implement PrefStore? And
> instead of maintaining a DictionaryValue internally, just handle the
> Get/Set/Remove calls directly?

There is still the initialization order problem: We need the ExtensionPrefStore
to construct the PrefService, and ExtensionPrefs has a PrefService dependency.

A second issue is that Dominic is working on a CL that adds a separate
PrefService for incognito profiles: http://codereview.chromium.org/5915004/
This actually results in ExtensionPrefs driving two different
ExtensionPrefStores, one for the original profile, one for incognito.

Finally, if I understand you correctly, you propose to implement Get/Set/Remove
in ExtensionPrefs in a way that would manipulate the underlying extension pref
cache value on the fly through the PrefService interface. I think this approach
is a bit fragile, since we would then end up with GetValue() recursing: Client
code reads pref -> PrefService checks ExtensionPrefStore::GetValue() ->
ExtensionPrefs reads the extension pref value from the PrefService and we enter
the GetValue() path again. That doesn't mean we loop at this point (as long as
ExtensionPrefs doesn't override its own extension pref cache dictionaries), but
the reentrancy still bothers me.

Powered by Google App Engine
This is Rietveld 408576698