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

Issue 11368098: Draft change to use base::Closure instead of PrefObserver in PrefChangeRegistrar. (Closed)

Created:
8 years, 1 month ago by Jói
Modified:
8 years, 1 month ago
CC:
chromium-reviews, erikwright+watch_chromium.org, battre
Visibility:
Public.

Description

Add Closure-based API to PrefChangeObserver and PrefMember, deprecate PrefObserver-based API. This switches the API with minimal implementation changes; PrefNotifierImpl still uses PrefObserver to accept registrations, and still filters on pref names (which PrefChangeObserver looks up again when it receives callbacks via its PrefObserver implementation). This approach is chosen for now to establish the new API so that usages can be switched, because: a) We need a way for PrefNotifierImpl to dispatch to both PrefChangeObserver and PrefMember, and it's unclear to me whether we want to switch that interface to base::Callback as well (if so, how to unregister?), or whether we want PrefMember to have a PrefChangeObserver instance (probably inefficient?) or something else. b) There are plans to do performance measurements of a few different implementation approaches in how PrefNotifierImpl and PrefChangeObserver interact; that interaction can be changed "under the hood" while the new API stays unchanged, and this lets us start switching users to the new API and removing the now-deprecated PrefObserver-based API. TBR=ben@chromium.org,finnur@chromium.org BUG=155525 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=166670

Patch Set 1 #

Patch Set 2 : . #

Total comments: 2

Patch Set 3 : Switch to no-unregistration, PrefChangeRegistrar manages dispatch. #

Patch Set 4 : Ready for review. #

Patch Set 5 : Fix unit tests #

Patch Set 6 : . #

Total comments: 6

Patch Set 7 : Respond to review comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+117 lines, -76 lines) Patch
M base/prefs/public/pref_change_registrar.h View 1 2 3 3 chunks +18 lines, -10 lines 0 comments Download
M base/prefs/public/pref_change_registrar.cc View 1 2 3 4 5 6 4 chunks +30 lines, -34 lines 0 comments Download
M base/prefs/public/pref_change_registrar_unittest.cc View 1 2 3 4 7 chunks +22 lines, -13 lines 0 comments Download
M chrome/browser/api/prefs/pref_member.h View 1 2 3 4 5 6 4 chunks +25 lines, -6 lines 0 comments Download
M chrome/browser/api/prefs/pref_member.cc View 1 2 3 4 5 6 4 chunks +12 lines, -6 lines 0 comments Download
M chrome/browser/extensions/extension_prefs_unittest.cc View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/prefs/pref_service_unittest.cc View 1 2 3 4 5 6 3 chunks +5 lines, -2 lines 0 comments Download
M chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/webui/options/core_options_handler.cc View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 19 (0 generated)
Jói
Hi Mattias, This doesn't quite compile, as you can't store a base::Callback in a set ...
8 years, 1 month ago (2012-11-06 12:58:05 UTC) #1
Mattias Nissler (ping if slow)
See comments for thoughts :) http://codereview.chromium.org/11368098/diff/2001/base/prefs/public/pref_change_registrar.cc File base/prefs/public/pref_change_registrar.cc (right): http://codereview.chromium.org/11368098/diff/2001/base/prefs/public/pref_change_registrar.cc#newcode51 base/prefs/public/pref_change_registrar.cc:51: base::Unretained(obs), service_, path)); Hm, ...
8 years, 1 month ago (2012-11-06 13:26:48 UTC) #2
Jói
If I understand you correctly, you mean PrefNotifierImpl would no longer filter on the pref ...
8 years, 1 month ago (2012-11-06 13:35:50 UTC) #3
Jói
For discussion, I uploaded a very rough draft (does not compile) of having an Add-only, ...
8 years, 1 month ago (2012-11-06 14:25:59 UTC) #4
Mattias Nissler (ping if slow)
On 2012/11/06 13:35:50, Jói wrote: > If I understand you correctly, you mean PrefNotifierImpl would ...
8 years, 1 month ago (2012-11-06 14:43:14 UTC) #5
Jói
> I'm clogged with other stuff, so I may be a bit slow. Dominic, would ...
8 years, 1 month ago (2012-11-06 14:51:08 UTC) #6
Mattias Nissler (ping if slow)
On 2012/11/06 14:51:08, Jói wrote: > > I'm clogged with other stuff, so I may ...
8 years, 1 month ago (2012-11-06 15:31:01 UTC) #7
Jói
Hi Mattias, I respect your decision as an OWNER about what the shape of the ...
8 years, 1 month ago (2012-11-06 17:07:24 UTC) #8
Mattias Nissler (ping if slow)
On Tue, Nov 6, 2012 at 6:06 PM, Jói Sigurðsson <joi@chromium.org> wrote: > Hi Mattias, ...
8 years, 1 month ago (2012-11-06 17:33:05 UTC) #9
Jói
Great, thanks Mattias. (typed on tiny keyboard) On Nov 6, 2012 5:33 PM, "Mattias Nissler" ...
8 years, 1 month ago (2012-11-06 17:35:58 UTC) #10
Mattias Nissler (ping if slow)
Just chatted with Dominic. We're both favoring the following PrefChangeRegistrar interface: class PrefChangeRegistrar { // ...
8 years, 1 month ago (2012-11-07 10:59:41 UTC) #11
Jói
Cool, thanks guys. > Keep a std::vector<PrefChangeRegistrar> in PrefNotifierImpl, loop through > all of them ...
8 years, 1 month ago (2012-11-07 11:20:04 UTC) #12
Mattias Nissler (ping if slow)
On Wed, Nov 7, 2012 at 12:19 PM, Jói Sigurðsson <joi@chromium.org> wrote: > Cool, thanks ...
8 years, 1 month ago (2012-11-07 13:03:41 UTC) #13
Jói
I think this is ready for review. Note the new change description, and a slightly ...
8 years, 1 month ago (2012-11-07 15:20:01 UTC) #14
Mattias Nissler (ping if slow)
Joi, thanks for your time working on this. Looks mostly good, just a couple minor ...
8 years, 1 month ago (2012-11-07 16:02:24 UTC) #15
Jói
Thanks Mattias. I addressed your concerns and fixed a bug caused by behavior of base::Bind ...
8 years, 1 month ago (2012-11-08 11:03:14 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/joi@chromium.org/11368098/1020
8 years, 1 month ago (2012-11-08 11:03:30 UTC) #17
Finnur
chrome/browser/extensions LGTM.
8 years, 1 month ago (2012-11-08 12:00:28 UTC) #18
commit-bot: I haz the power
8 years, 1 month ago (2012-11-08 13:06:20 UTC) #19
Change committed as 166670

Powered by Google App Engine
This is Rietveld 408576698