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

Issue 1357183002: MD-Settings: convert cr-settings-prefs to a singleton model (Closed)

Created:
5 years, 3 months ago by michaelpg
Modified:
5 years, 3 months ago
Reviewers:
stevenjb, *Dan Beam
CC:
chromium-reviews, michaelpg+watch-md-settings_chromium.org, jhawkins+watch-md-settings_chromium.org, arv+watch_chromium.org, dbeam+watch-settings_chromium.org, stevenjb+watch-md-settings_chromium.org, jlklein+watch-md-settings_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

MD-Settings: convert cr-settings-prefs to a singleton model This CL adds <cr-settings-prefs-private>, a singleton element created at startup and initialized on demand. <cr-settings-prefs> now mediates between the singleton model and the outside world, providing access to the shared prefs state. This lets a component access the shared prefs by adding a <cr-settings-prefs> to its local DOM, instead of having to pipe a prefs object from <cr-settings> all the way down to any component that needs it. This also lets us create other singletons to access the shared prefs. The singleton can be re-initialized in between tests to start with a fresh set of prefs. <cr-settings-prefs> elements created by tests are reset so they don't interfere with the next test (because we can't just destroy a DOM element). CrSettingsPrefsTest is updated to reset the singleton in between tests. It creates 200 elements for each test, so if the shared model starts generating extraneous events the test is likely to explode exponentially. Currently, time added by each additional <cr-settings-prefs> is slightly less than linear, which is good: # | time from first setup to last teardown (ms) on Z620 1 | 87 2 | 89 4 | 101 8 | 118 16 | 154 32 | 228 64 | 433 128 | 762 256 | 1416 BUG=532270 R=dbeam@chromium.org Committed: https://crrev.com/8ff101453f82f6c4f3a61aea938b4e3a4b0f2b07 Cr-Commit-Position: refs/heads/master@{#350411}

Patch Set 1 : #

Total comments: 1

Patch Set 2 : closure, typo #

Total comments: 1

Patch Set 3 : #

Total comments: 27

Patch Set 4 : changes #

Patch Set 5 : missed one #

Patch Set 6 : this -> CrSettingsPrefsInternal #

Patch Set 7 : unnecessary parens #

Total comments: 8

Patch Set 8 : dbeam feedback #

Total comments: 3

Patch Set 9 : #

Patch Set 10 : rebase #

Patch Set 11 : clarify singleton/private/model language #

Unified diffs Side-by-side diffs Delta from patch set Stats (+245 lines, -99 lines) Patch
M chrome/browser/resources/settings/pref_tracker/pref_tracker.js View 2 chunks +7 lines, -28 lines 0 comments Download
M chrome/browser/resources/settings/prefs/prefs.js View 1 2 3 4 5 6 7 8 9 10 7 chunks +152 lines, -23 lines 0 comments Download
M chrome/browser/resources/settings/prefs/prefs_types.js View 1 2 3 4 5 6 7 8 1 chunk +34 lines, -12 lines 0 comments Download
M chrome/test/data/webui/settings/prefs_tests.js View 1 2 3 4 5 6 7 14 chunks +52 lines, -36 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 36 (17 generated)
michaelpg
PTAL https://codereview.chromium.org/1357183002/diff/40001/chrome/test/data/webui/settings/prefs_tests.js File chrome/test/data/webui/settings/prefs_tests.js (right): https://codereview.chromium.org/1357183002/diff/40001/chrome/test/data/webui/settings/prefs_tests.js#newcode45 chrome/test/data/webui/settings/prefs_tests.js:45: assertNotEquals(null, MockSettingsApi.listener_); Switched expects to asserts because test_api.js ...
5 years, 3 months ago (2015-09-20 21:01:56 UTC) #3
michaelpg
https://codereview.chromium.org/1357183002/diff/60001/chrome/browser/resources/settings/prefs/prefs.js File chrome/browser/resources/settings/prefs/prefs.js (right): https://codereview.chromium.org/1357183002/diff/60001/chrome/browser/resources/settings/prefs/prefs.js#newcode369 chrome/browser/resources/settings/prefs/prefs.js:369: if (!deepEqual(this.get(newPrefObj.key, prefs), newPrefObj)) { silly typo, thanks Closure! ...
5 years, 3 months ago (2015-09-20 23:44:44 UTC) #4
Dan Beam
https://codereview.chromium.org/1357183002/diff/80001/chrome/browser/resources/settings/pref_tracker/pref_tracker.js File chrome/browser/resources/settings/pref_tracker/pref_tracker.js (right): https://codereview.chromium.org/1357183002/diff/80001/chrome/browser/resources/settings/pref_tracker/pref_tracker.js#newcode53 chrome/browser/resources/settings/pref_tracker/pref_tracker.js:53: console.error('Pref not found. Parent control:' + is this console.error() ...
5 years, 3 months ago (2015-09-21 22:25:21 UTC) #5
michaelpg
Feedback addressed, thanks -- PTAnotherL. https://codereview.chromium.org/1357183002/diff/80001/chrome/browser/resources/settings/pref_tracker/pref_tracker.js File chrome/browser/resources/settings/pref_tracker/pref_tracker.js (right): https://codereview.chromium.org/1357183002/diff/80001/chrome/browser/resources/settings/pref_tracker/pref_tracker.js#newcode53 chrome/browser/resources/settings/pref_tracker/pref_tracker.js:53: console.error('Pref not found. Parent ...
5 years, 3 months ago (2015-09-22 00:34:07 UTC) #6
Dan Beam
lgtm https://codereview.chromium.org/1357183002/diff/80001/chrome/browser/resources/settings/prefs/prefs.js File chrome/browser/resources/settings/prefs/prefs.js (right): https://codereview.chromium.org/1357183002/diff/80001/chrome/browser/resources/settings/prefs/prefs.js#newcode221 chrome/browser/resources/settings/prefs/prefs.js:221: this.squelch_ = false; On 2015/09/22 00:34:07, michaelpg wrote: ...
5 years, 3 months ago (2015-09-22 06:12:31 UTC) #7
michaelpg
https://codereview.chromium.org/1357183002/diff/160001/chrome/browser/resources/settings/prefs/prefs.js File chrome/browser/resources/settings/prefs/prefs.js (right): https://codereview.chromium.org/1357183002/diff/160001/chrome/browser/resources/settings/prefs/prefs.js#newcode213 chrome/browser/resources/settings/prefs/prefs.js:213: runWhileIgnoringChanges_: function(fn) { On 2015/09/22 06:12:31, Dan Beam wrote: ...
5 years, 3 months ago (2015-09-22 21:38:37 UTC) #9
Dan Beam
https://codereview.chromium.org/1357183002/diff/200001/chrome/browser/resources/settings/prefs/prefs_types.js File chrome/browser/resources/settings/prefs/prefs_types.js (right): https://codereview.chromium.org/1357183002/diff/200001/chrome/browser/resources/settings/prefs/prefs_types.js#newcode46 chrome/browser/resources/settings/prefs/prefs_types.js:46: CrSettingsPrefsInternal.setup_(); On 2015/09/22 21:38:37, michaelpg wrote: > Is calling ...
5 years, 3 months ago (2015-09-22 21:58:35 UTC) #12
michaelpg
https://codereview.chromium.org/1357183002/diff/200001/chrome/browser/resources/settings/prefs/prefs_types.js File chrome/browser/resources/settings/prefs/prefs_types.js (right): https://codereview.chromium.org/1357183002/diff/200001/chrome/browser/resources/settings/prefs/prefs_types.js#newcode46 chrome/browser/resources/settings/prefs/prefs_types.js:46: CrSettingsPrefsInternal.setup_(); On 2015/09/22 21:58:35, Dan Beam wrote: > On ...
5 years, 3 months ago (2015-09-22 22:01:46 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1357183002/220001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1357183002/220001
5 years, 3 months ago (2015-09-23 00:27:40 UTC) #16
commit-bot: I haz the power
Try jobs failed on following builders: linux_android_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_android_rel_ng/builds/72435)
5 years, 3 months ago (2015-09-23 05:29:03 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1357183002/280001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1357183002/280001
5 years, 3 months ago (2015-09-23 20:47:43 UTC) #22
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_clobber_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_clobber_rel_ng/builds/73533)
5 years, 3 months ago (2015-09-23 21:20:37 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1357183002/280001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1357183002/280001
5 years, 3 months ago (2015-09-23 21:29:44 UTC) #26
commit-bot: I haz the power
Try jobs failed on following builders: win8_chromium_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win8_chromium_ng/builds/44559)
5 years, 3 months ago (2015-09-23 21:58:52 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1357183002/280001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1357183002/280001
5 years, 3 months ago (2015-09-23 22:00:37 UTC) #30
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/117061)
5 years, 3 months ago (2015-09-23 23:15:06 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1357183002/280001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1357183002/280001
5 years, 3 months ago (2015-09-23 23:29:03 UTC) #34
commit-bot: I haz the power
Committed patchset #11 (id:280001)
5 years, 3 months ago (2015-09-24 00:21:16 UTC) #35
commit-bot: I haz the power
5 years, 3 months ago (2015-09-24 00:35:18 UTC) #36
Message was sent while issue was closed.
Patchset 11 (id:??) landed as
https://crrev.com/8ff101453f82f6c4f3a61aea938b4e3a4b0f2b07
Cr-Commit-Position: refs/heads/master@{#350411}

Powered by Google App Engine
This is Rietveld 408576698