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

Issue 5213002: Fix for Bug 50726 "Save extension list and "winning" prefs from extensions" (Closed)

Created:
10 years, 1 month ago by battre (please use the other)
Modified:
9 years, 7 months ago
CC:
chromium-reviews, Erik does not do reviews, Paweł Hajdan Jr., pam+watch_chromium.org, ben+cc_chromium.org, Pam (message me for reviews), danno, cbentzel+watch_chromium.org, darin-cc_chromium.org, brettw-cc_chromium.org, Bernhard Bauer, Aaron Boodman
Visibility:
Public.

Description

Fix for Bug 50726 "Save extension list and "winning" prefs from extensions" This is a redesign for http://codereview.chromium.org/4852002/ following discussions. The goal of this patch is to ensure that Chrome maintains the order in which extensions apply their preferences between restarts. This may be an issue if two extensions overwrite each others preferences. Furthermore, it ensures that preferences are persisted to disk between browser restarts. Therefore, previous settings are immediately available when the browser is restarted. A description of the design has been published https://docs.google.com/a/google.com/document/d/1E_HX_cUpET1gH2gDunGIU1EOywMM6FEOuVU6TlpnSwo/edit?hl=en for review and comments. - Sorry, accessible Google internally only. This CL requires http://codereview.chromium.org/5204006/ Contributed by battre@google.com BUG=50726 TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=68355

Patch Set 1 #

Patch Set 2 : Fixed lint issues #

Patch Set 3 : Fixed Directory parameter in TestingProfile::CreateExtensionsService #

Patch Set 4 : Fixed Mac compile issue #

Total comments: 16

Patch Set 5 : Addressed (first set of) comments by Mattias #

Total comments: 66

Patch Set 6 : reuse old DefaultPrefStore as InMemoryPrefStore #

Total comments: 10

Patch Set 7 : Addressed Mattias' comments #

Patch Set 8 : Lint issues and factored out renaming of InMemoryPrefStore #

Total comments: 42

Patch Set 9 : Addressed Mattias' feedback #

Patch Set 10 : Addressed Mattias' feedback #

Patch Set 11 : Temporary hack to fix regression in unit tests #

Total comments: 29

Patch Set 12 : Addressed comments, moved ExtensionPrefStore reference to Profile #

Total comments: 37

Patch Set 13 : Addressed Mattias' comments #

Total comments: 30

Patch Set 14 : Removed ExtensionPrefStore from profile again. #

Patch Set 15 : Rebased to current trunk (+ tiny cleanups) #

Patch Set 16 : Further modifications for rebasing #

Total comments: 8

Patch Set 17 : Addressed Aaron's comments #

Patch Set 18 : Same patch but without stuff that is already included in 5204006 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+750 lines, -736 lines) Patch
M base/values.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +4 lines, -0 lines 0 comments Download
M base/values.cc View 1 2 3 4 5 6 7 8 1 chunk +7 lines, -0 lines 0 comments Download
M base/values_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +23 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_pref_store.h View 12 13 1 chunk +0 lines, -124 lines 0 comments Download
D chrome/browser/extensions/extension_pref_store.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +0 lines, -199 lines 0 comments Download
D chrome/browser/extensions/extension_pref_store_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +0 lines, -370 lines 0 comments Download
M chrome/browser/extensions/extension_prefs.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 7 chunks +71 lines, -4 lines 0 comments Download
M chrome/browser/extensions/extension_prefs.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 9 chunks +217 lines, -3 lines 0 comments Download
M chrome/browser/extensions/extension_prefs_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 4 chunks +331 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_proxy_api.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +4 lines, -9 lines 0 comments Download
M chrome/browser/extensions/extensions_service.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 4 chunks +6 lines, -4 lines 0 comments Download
M chrome/browser/extensions/extensions_service.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/extensions/test_extension_prefs.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/extensions/test_extension_prefs.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +25 lines, -2 lines 0 comments Download
M chrome/browser/prefs/pref_service.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/prefs/pref_service.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/prefs/pref_value_store.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/prefs/pref_value_store.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 5 chunks +12 lines, -4 lines 0 comments Download
M chrome/browser/profiles/profile_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +8 lines, -1 line 0 comments Download
M chrome/browser/profiles/profile_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +7 lines, -0 lines 0 comments Download
M chrome/browser/ui/cocoa/extensions/extension_popup_controller_unittest.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 4 chunks +7 lines, -1 line 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +0 lines, -1 line 0 comments Download
M chrome/test/testing_pref_service.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +7 lines, -7 lines 0 comments Download
M chrome/test/testing_profile.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +6 lines, -1 line 0 comments Download
M chrome/test/testing_profile.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +3 lines, -1 line 0 comments Download

Messages

Total messages: 29 (0 generated)
battre (please use the other)
First version of the CL
10 years, 1 month ago (2010-11-18 14:00:01 UTC) #1
Mattias Nissler (ping if slow)
A few initial comments, didn't make it through the whole patch. I'll do that later ...
10 years, 1 month ago (2010-11-18 16:30:32 UTC) #2
battre (please use the other)
Addressed the first set of comments on the new implementation of this feature. http://codereview.chromium.org/5213002/diff/36001/chrome/browser/extensions/extension_prefs.cc File ...
10 years, 1 month ago (2010-11-18 16:47:33 UTC) #3
Mattias Nissler (ping if slow)
More comments, still working :) http://codereview.chromium.org/5213002/diff/1022/chrome/browser/extensions/extension_prefs.cc File chrome/browser/extensions/extension_prefs.cc (right): http://codereview.chromium.org/5213002/diff/1022/chrome/browser/extensions/extension_prefs.cc#newcode571 chrome/browser/extensions/extension_prefs.cc:571: Remove blank line and ...
10 years, 1 month ago (2010-11-19 10:36:12 UTC) #4
Mattias Nissler (ping if slow)
some more comments. http://codereview.chromium.org/5213002/diff/47002/chrome/browser/extensions/test_extension_prefs.cc File chrome/browser/extensions/test_extension_prefs.cc (right): http://codereview.chromium.org/5213002/diff/47002/chrome/browser/extensions/test_extension_prefs.cc#newcode30 chrome/browser/extensions/test_extension_prefs.cc:30: base::Time GetCurrentTime() const { note my ...
10 years, 1 month ago (2010-11-19 10:47:39 UTC) #5
battre (please use the other)
Addressed Matthias' comments (thanks!!!) and factored out the renaming of DefaultPrefStore to InMemoryPrefStore to http://codereview.chromium.org/5204006/ ...
10 years, 1 month ago (2010-11-19 16:03:17 UTC) #6
Mattias Nissler (ping if slow)
a couple more comments. http://codereview.chromium.org/5213002/diff/1022/chrome/browser/extensions/extension_prefs_unittest.cc File chrome/browser/extensions/extension_prefs_unittest.cc (right): http://codereview.chromium.org/5213002/diff/1022/chrome/browser/extensions/extension_prefs_unittest.cc#newcode448 chrome/browser/extensions/extension_prefs_unittest.cc:448: void InstallExtControlledPref(Extension *ext, On 2010/11/19 ...
10 years, 1 month ago (2010-11-19 16:52:15 UTC) #7
battre (please use the other)
Addressed Mattias' comments (thanks!). Aaron, could you have a look now as well? Thanks, Dominic ...
10 years, 1 month ago (2010-11-19 18:00:39 UTC) #8
Aaron Boodman
Ok, here we go. At a high level, I'm pretty concerned about this approach, and ...
10 years, 1 month ago (2010-11-23 20:35:12 UTC) #9
Aaron Boodman
On 2010/11/23 20:35:12, Aaron Boodman wrote: > Ok, here we go. > > At a ...
10 years, 1 month ago (2010-11-23 20:37:31 UTC) #10
Aaron Boodman
On 2010/11/23 20:35:12, Aaron Boodman wrote: > 1. I'm not crazy about the 'preferences' subtree ...
10 years, 1 month ago (2010-11-23 20:41:59 UTC) #11
Mattias Nissler (ping if slow)
On 2010/11/23 20:41:59, Aaron Boodman wrote: > On 2010/11/23 20:35:12, Aaron Boodman wrote: > > ...
10 years, 1 month ago (2010-11-23 22:02:05 UTC) #12
Mattias Nissler (ping if slow)
http://codereview.chromium.org/5213002/diff/57002/chrome/browser/extensions/extension_prefs.cc File chrome/browser/extensions/extension_prefs.cc (right): http://codereview.chromium.org/5213002/diff/57002/chrome/browser/extensions/extension_prefs.cc#newcode92 chrome/browser/extensions/extension_prefs.cc:92: const char kPrefPreferences[] = "preferences"; On 2010/11/23 20:35:13, Aaron ...
10 years, 1 month ago (2010-11-23 22:02:44 UTC) #13
Aaron Boodman
On 2010/11/23 22:02:05, Mattias Nissler wrote: > On 2010/11/23 20:41:59, Aaron Boodman wrote: > > ...
10 years, 1 month ago (2010-11-23 22:46:30 UTC) #14
Mattias Nissler (ping if slow)
On 2010/11/23 22:46:30, Aaron Boodman wrote: > On 2010/11/23 22:02:05, Mattias Nissler wrote: > > ...
10 years, 1 month ago (2010-11-23 22:56:48 UTC) #15
Aaron Boodman
On 2010/11/23 22:46:30, Aaron Boodman wrote: > On 2010/11/23 22:02:05, Mattias Nissler wrote: > > ...
10 years, 1 month ago (2010-11-23 22:57:10 UTC) #16
Mattias Nissler (ping if slow)
On Tue, Nov 23, 2010 at 11:57 PM, <aa@chromium.org> wrote: > On 2010/11/23 22:46:30, Aaron ...
10 years, 1 month ago (2010-11-23 23:04:56 UTC) #17
Aaron Boodman
On 2010/11/23 23:04:56, Mattias Nissler wrote: > On Tue, Nov 23, 2010 at 11:57 PM, ...
10 years, 1 month ago (2010-11-23 23:34:21 UTC) #18
battre (please use the other)
I have addressed the issues from the comments. After discussions in MUC with mnissler, danno ...
10 years ago (2010-11-30 17:46:53 UTC) #19
Mattias Nissler (ping if slow)
I think this is much closer to what we want. http://codereview.chromium.org/5213002/diff/114001/base/values.h File base/values.h (right): http://codereview.chromium.org/5213002/diff/114001/base/values.h#newcode103 ...
10 years ago (2010-12-01 10:36:36 UTC) #20
battre (please use the other)
Addressed the issues raised by Mattias. http://codereview.chromium.org/5213002/diff/114001/base/values.h File base/values.h (right): http://codereview.chromium.org/5213002/diff/114001/base/values.h#newcode103 base/values.h:103: // Compares if ...
10 years ago (2010-12-01 17:44:38 UTC) #21
Aaron Boodman
http://codereview.chromium.org/5213002/diff/136001/chrome/browser/extensions/extension_prefs.cc File chrome/browser/extensions/extension_prefs.cc (right): http://codereview.chromium.org/5213002/diff/136001/chrome/browser/extensions/extension_prefs.cc#newcode101 chrome/browser/extensions/extension_prefs.cc:101: const char kPrefPreferences[] = "preferences"; I think it is ...
10 years ago (2010-12-03 08:58:10 UTC) #22
Aaron Boodman
http://codereview.chromium.org/5213002/diff/136001/chrome/browser/extensions/extension_pref_store.cc File chrome/browser/extensions/extension_pref_store.cc (right): http://codereview.chromium.org/5213002/diff/136001/chrome/browser/extensions/extension_pref_store.cc#newcode11 chrome/browser/extensions/extension_pref_store.cc:11: if (profile_) In Profile, I commented that I didn't ...
10 years ago (2010-12-03 09:02:11 UTC) #23
battre (please use the other)
As discussed, I have moved the Extension Pref Store back into the PrefValueStore again. I ...
10 years ago (2010-12-03 19:32:58 UTC) #24
Aaron Boodman
LGTM w/ the below nits and a question. In general, I'd take a close look ...
10 years ago (2010-12-03 20:00:44 UTC) #25
battre (please use the other)
Thanks for the feedback. http://codereview.chromium.org/5213002/diff/136001/chrome/browser/profile_impl.h File chrome/browser/profile_impl.h (right): http://codereview.chromium.org/5213002/diff/136001/chrome/browser/profile_impl.h#newcode175 chrome/browser/profile_impl.h:175: scoped_ptr<PrefService> prefs_; // Keep this ...
10 years ago (2010-12-06 10:28:49 UTC) #26
Mattias Nissler (ping if slow)
LGTM from my side too.
10 years ago (2010-12-06 16:29:18 UTC) #27
Aaron Boodman
http://codereview.chromium.org/5213002/diff/136001/chrome/browser/profile_impl.h File chrome/browser/profile_impl.h (right): http://codereview.chromium.org/5213002/diff/136001/chrome/browser/profile_impl.h#newcode175 chrome/browser/profile_impl.h:175: scoped_ptr<PrefService> prefs_; // Keep this on top for destruction ...
10 years ago (2010-12-06 18:20:56 UTC) #28
Mattias Nissler (ping if slow)
10 years ago (2010-12-06 19:29:50 UTC) #29
http://codereview.chromium.org/5213002/diff/136001/chrome/browser/profile_impl.h
File chrome/browser/profile_impl.h (right):

http://codereview.chromium.org/5213002/diff/136001/chrome/browser/profile_imp...
chrome/browser/profile_impl.h:175: scoped_ptr<PrefService> prefs_;  // Keep this
on top for destruction order
On 2010/12/06 18:20:56, Aaron Boodman wrote:
> On 2010/12/06 10:28:50, battre wrote:
> > On 2010/12/03 20:00:44, Aaron Boodman wrote:
> > > On 2010/12/03 19:32:58, battre wrote:
> > > > On 2010/12/03 08:58:10, Aaron Boodman wrote:
> > > > > Scary comment is scary. What is causing the destruction order
> dependency?
> > > Can
> > > > we
> > > > > get rid of it?
> > > > 
> > > > Well, this is just playing save. The situation has not changed by this
CL.
> > > > Probably we don't have a real issue here because of threading
guarantees.
> > But
> > > I
> > > > don't know them, yet. I propose to leave this but added a comment
"Please
> > > remove
> > > > comment if you are certain that we don't have an issue here".
> > > 
> > > Sorry, I still don't understand. Can you clarify what you are worried
about
> > > happening?
> > 
> > Maybe this comment is clearer:
> >   // Keep prefs_ on top for destruction order because extension_prefs_,
> >   // net_pref_observer_, web_resource_service_ and
> background_contents_service_
> >   // store pointers to prefs_ and shall be destructed first.
> 
> I talked to a few people in this office about this, and we all agreed. This
> problem probably exists all over Chrome, and we never comment about it in any
of
> those places.
> 
> If somebody actually changed ExtensionPrefs such that it actually needed to
call
> PrefService in its destructor, then a better way to document this would be to
> reset the extension_prefs_ pointer explicitly in ~Profile.
> 
> In general, relying on destruction order seems pretty ugly.

I agree that relying on implicit destruction order for something as central as
the Profile is really ugly.

Actually, while working on a recent CL that touched the profile, I tried to make
PrefService destruction explicit in the ProfileImpl constructor. I gave up after
I realized that I had to put resets for pretty much everything in the profile
before releasing prefs_. This shows that the current code heavily relies on the
ordering here.

Created http://crbug.com/65637 to track this.

Powered by Google App Engine
This is Rietveld 408576698