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

Issue 205813002: Separate storage for protected preferences into Protected Preferences file. (Closed)

Created:
6 years, 9 months ago by erikwright (departed)
Modified:
6 years, 8 months ago
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@pp4_profile_pref_store
Visibility:
Public.

Description

Separate storage for protected preferences into Protected Preferences file. Introduces ProtectedPrefStore which delegates to two different backing stores to handle unprotected and protected values. NOTRY=True BUG=349158 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=260387

Patch Set 1 #

Patch Set 2 : Review comments from previous mega-CL. #

Patch Set 3 : Pull some changes into an earlier CL. #

Patch Set 4 : Pre-review. #

Total comments: 44

Patch Set 5 : Enhanced tests for ProtectedPrefStore. #

Patch Set 6 : Review comments. #

Patch Set 7 : Pull out some changes into other CLs. #

Total comments: 31

Patch Set 8 : Review comments. #

Patch Set 9 : Fix copyright. #

Total comments: 10

Patch Set 10 : Increased test coverage. #

Patch Set 11 : Add comments to test. #

Patch Set 12 : Make it compile and pass. #

Total comments: 2

Patch Set 13 : Rename TeeObserver, remove use of GMock. #

Patch Set 14 : Integrate improvement to PrefStoreObserverMock. #

Patch Set 15 : Rebase. #

Patch Set 16 : Fix a compile error on clang. #

Patch Set 17 : Fix MigrateValues test. #

Patch Set 18 : Eliminate spurious metrics. #

Patch Set 19 : Revert code that breaks tests, commit what works. #

Total comments: 23
Unified diffs Side-by-side diffs Delta from patch set Stats (+719 lines, -27 lines) Patch
M base/prefs/pref_service.cc View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -1 line 0 comments Download
M chrome/browser/prefs/pref_hash_filter.h View 1 2 3 4 5 6 7 2 chunks +10 lines, -0 lines 0 comments Download
M chrome/browser/prefs/pref_hash_filter.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +37 lines, -0 lines 7 comments Download
M chrome/browser/prefs/pref_hash_filter_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 20 chunks +112 lines, -26 lines 3 comments Download
M chrome/browser/prefs/profile_pref_store_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +13 lines, -0 lines 4 comments Download
A chrome/browser/prefs/tracked/segregated_pref_store.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +104 lines, -0 lines 1 comment Download
A chrome/browser/prefs/tracked/segregated_pref_store.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +182 lines, -0 lines 8 comments Download
A chrome/browser/prefs/tracked/segregated_pref_store_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +255 lines, -0 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/chrome_tests_unit.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 57 (0 generated)
erikwright (departed)
robert: PTAL. Still pending some tests.
6 years, 9 months ago (2014-03-24 17:45:09 UTC) #1
robertshield
Looks great, some comments and such below https://codereview.chromium.org/205813002/diff/50001/chrome/browser/prefs/pref_hash_filter.cc File chrome/browser/prefs/pref_hash_filter.cc (right): https://codereview.chromium.org/205813002/diff/50001/chrome/browser/prefs/pref_hash_filter.cc#newcode105 chrome/browser/prefs/pref_hash_filter.cc:105: if (source->GetValue(it->first, ...
6 years, 9 months ago (2014-03-25 03:05:12 UTC) #2
erikwright (departed)
PTAL. https://codereview.chromium.org/205813002/diff/50001/chrome/browser/prefs/pref_hash_filter.cc File chrome/browser/prefs/pref_hash_filter.cc (right): https://codereview.chromium.org/205813002/diff/50001/chrome/browser/prefs/pref_hash_filter.cc#newcode105 chrome/browser/prefs/pref_hash_filter.cc:105: if (source->GetValue(it->first, &source_value)) On 2014/03/25 03:05:12, robertshield wrote: ...
6 years, 9 months ago (2014-03-25 20:28:25 UTC) #3
erikwright (departed)
https://codereview.chromium.org/205813002/diff/50001/chrome/browser/prefs/tracked/protected_pref_store.h File chrome/browser/prefs/tracked/protected_pref_store.h (right): https://codereview.chromium.org/205813002/diff/50001/chrome/browser/prefs/tracked/protected_pref_store.h#newcode69 chrome/browser/prefs/tracked/protected_pref_store.h:69: explicit TeeObserver(ProtectedPrefStore* outer); On 2014/03/25 20:28:26, erikwright wrote: > ...
6 years, 9 months ago (2014-03-25 20:41:11 UTC) #4
erikwright (departed)
bauerb: PTAL.
6 years, 9 months ago (2014-03-25 20:41:59 UTC) #5
Bernhard Bauer
https://codereview.chromium.org/205813002/diff/50001/chrome/browser/prefs/profile_pref_store_manager.cc File chrome/browser/prefs/profile_pref_store_manager.cc (right): https://codereview.chromium.org/205813002/diff/50001/chrome/browser/prefs/profile_pref_store_manager.cc#newcode106 chrome/browser/prefs/profile_pref_store_manager.cc:106: scoped_ptr<int> version_; On 2014/03/25 20:28:26, erikwright wrote: > On ...
6 years, 9 months ago (2014-03-26 15:05:50 UTC) #6
erikwright (departed)
Two quick responses. I'll work on the rest now. https://codereview.chromium.org/205813002/diff/250001/chrome/browser/prefs/tracked/protected_pref_store.h File chrome/browser/prefs/tracked/protected_pref_store.h (right): https://codereview.chromium.org/205813002/diff/250001/chrome/browser/prefs/tracked/protected_pref_store.h#newcode68 chrome/browser/prefs/tracked/protected_pref_store.h:68: ...
6 years, 9 months ago (2014-03-26 15:17:14 UTC) #7
Bernhard Bauer
https://codereview.chromium.org/205813002/diff/250001/chrome/browser/prefs/tracked/protected_pref_store.h File chrome/browser/prefs/tracked/protected_pref_store.h (right): https://codereview.chromium.org/205813002/diff/250001/chrome/browser/prefs/tracked/protected_pref_store.h#newcode68 chrome/browser/prefs/tracked/protected_pref_store.h:68: class TeeObserver : public PrefStore::Observer { On 2014/03/26 15:17:14, ...
6 years, 9 months ago (2014-03-26 16:41:11 UTC) #8
erikwright (departed)
https://codereview.chromium.org/205813002/diff/250001/chrome/browser/prefs/profile_pref_store_manager.cc File chrome/browser/prefs/profile_pref_store_manager.cc (right): https://codereview.chromium.org/205813002/diff/250001/chrome/browser/prefs/profile_pref_store_manager.cc#newcode52 chrome/browser/prefs/profile_pref_store_manager.cc:52: return dictionary_; On 2014/03/26 15:05:50, Bernhard Bauer wrote: > ...
6 years, 9 months ago (2014-03-26 18:37:15 UTC) #9
erikwright (departed)
https://codereview.chromium.org/205813002/diff/250001/chrome/browser/prefs/pref_hash_filter.h File chrome/browser/prefs/pref_hash_filter.h (right): https://codereview.chromium.org/205813002/diff/250001/chrome/browser/prefs/pref_hash_filter.h#newcode22 chrome/browser/prefs/pref_hash_filter.h:22: class PersistentPrefStore; On 2014/03/26 15:05:50, Bernhard Bauer wrote: > ...
6 years, 9 months ago (2014-03-26 21:08:11 UTC) #10
robertshield
looking good, few more comments below https://codereview.chromium.org/205813002/diff/440001/chrome/browser/prefs/profile_pref_store_manager_unittest.cc File chrome/browser/prefs/profile_pref_store_manager_unittest.cc (right): https://codereview.chromium.org/205813002/diff/440001/chrome/browser/prefs/profile_pref_store_manager_unittest.cc#newcode191 chrome/browser/prefs/profile_pref_store_manager_unittest.cc:191: EXPECT_EQ((int)pref_file_contents.length(), why is ...
6 years, 9 months ago (2014-03-26 21:41:54 UTC) #11
erikwright (departed)
https://codereview.chromium.org/205813002/diff/440001/chrome/browser/prefs/tracked/segregated_pref_store.cc File chrome/browser/prefs/tracked/segregated_pref_store.cc (right): https://codereview.chromium.org/205813002/diff/440001/chrome/browser/prefs/tracked/segregated_pref_store.cc#newcode19 chrome/browser/prefs/tracked/segregated_pref_store.cc:19: // told about initialization. On 2014/03/26 21:41:54, robertshield wrote: ...
6 years, 9 months ago (2014-03-26 21:51:01 UTC) #12
erikwright (departed)
PTAL. https://codereview.chromium.org/205813002/diff/440001/chrome/browser/prefs/profile_pref_store_manager_unittest.cc File chrome/browser/prefs/profile_pref_store_manager_unittest.cc (right): https://codereview.chromium.org/205813002/diff/440001/chrome/browser/prefs/profile_pref_store_manager_unittest.cc#newcode191 chrome/browser/prefs/profile_pref_store_manager_unittest.cc:191: EXPECT_EQ((int)pref_file_contents.length(), On 2014/03/26 21:41:54, robertshield wrote: > why ...
6 years, 9 months ago (2014-03-27 14:59:19 UTC) #13
Bernhard Bauer
LGTM, just one nit below: https://codereview.chromium.org/205813002/diff/250001/chrome/browser/prefs/profile_pref_store_manager.cc File chrome/browser/prefs/profile_pref_store_manager.cc (right): https://codereview.chromium.org/205813002/diff/250001/chrome/browser/prefs/profile_pref_store_manager.cc#newcode52 chrome/browser/prefs/profile_pref_store_manager.cc:52: return dictionary_; On 2014/03/26 ...
6 years, 9 months ago (2014-03-27 15:10:45 UTC) #14
robertshield
lgtm
6 years, 9 months ago (2014-03-27 16:03:53 UTC) #15
erikwright (departed)
FYI. Waiting on a review from mnissler on https://codereview.chromium.org/210063003/ . https://codereview.chromium.org/205813002/diff/250001/chrome/browser/prefs/profile_pref_store_manager.cc File chrome/browser/prefs/profile_pref_store_manager.cc (right): https://codereview.chromium.org/205813002/diff/250001/chrome/browser/prefs/profile_pref_store_manager.cc#newcode52 ...
6 years, 9 months ago (2014-03-27 19:26:21 UTC) #16
erikwright (departed)
jochen: PTAL for chrome_constants.{cc,h}
6 years, 9 months ago (2014-03-28 12:57:07 UTC) #17
jochen (gone - plz use gerrit)
lgtm
6 years, 9 months ago (2014-03-28 13:03:04 UTC) #18
erikwright (departed)
The CQ bit was checked by erikwright@chromium.org
6 years, 9 months ago (2014-03-28 16:18:30 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/erikwright@chromium.org/205813002/560001
6 years, 9 months ago (2014-03-28 16:21:05 UTC) #20
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 9 months ago (2014-03-28 17:25:53 UTC) #21
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.chromium on linux_chromium_rel
6 years, 9 months ago (2014-03-28 17:25:53 UTC) #22
erikwright (departed)
The CQ bit was checked by erikwright@chromium.org
6 years, 9 months ago (2014-03-28 17:28:23 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/erikwright@chromium.org/205813002/560001
6 years, 9 months ago (2014-03-28 17:28:32 UTC) #24
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 9 months ago (2014-03-28 17:35:13 UTC) #25
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.chromium on linux_chromium_chromeos_rel
6 years, 9 months ago (2014-03-28 17:35:14 UTC) #26
erikwright (departed)
The CQ bit was unchecked by erikwright@chromium.org
6 years, 9 months ago (2014-03-28 17:44:55 UTC) #27
erikwright (departed)
The CQ bit was checked by erikwright@chromium.org
6 years, 9 months ago (2014-03-28 17:45:07 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/erikwright@chromium.org/205813002/560001
6 years, 9 months ago (2014-03-28 17:47:28 UTC) #29
erikwright (departed)
The CQ bit was checked by erikwright@chromium.org
6 years, 9 months ago (2014-03-28 18:08:33 UTC) #30
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.chromium on mac_chromium_rel
6 years, 9 months ago (2014-03-28 18:10:03 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/erikwright@chromium.org/205813002/580001
6 years, 9 months ago (2014-03-28 18:10:57 UTC) #32
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 9 months ago (2014-03-28 19:42:05 UTC) #33
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.chromium on linux_chromium_rel
6 years, 9 months ago (2014-03-28 19:42:06 UTC) #34
erikwright (departed)
The CQ bit was checked by erikwright@chromium.org
6 years, 9 months ago (2014-03-28 20:10:22 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/erikwright@chromium.org/205813002/600001
6 years, 9 months ago (2014-03-28 20:10:35 UTC) #36
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-03-29 00:00:40 UTC) #37
commit-bot: I haz the power
Retried try job too often on win_rel for step(s) browser_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_rel&number=290667
6 years, 8 months ago (2014-03-29 00:00:41 UTC) #38
erikwright (departed)
The CQ bit was checked by erikwright@chromium.org
6 years, 8 months ago (2014-03-29 01:57:38 UTC) #39
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/erikwright@chromium.org/205813002/620001
6 years, 8 months ago (2014-03-29 01:58:53 UTC) #40
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-03-29 03:29:05 UTC) #41
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.chromium on linux_chromium_rel
6 years, 8 months ago (2014-03-29 03:29:06 UTC) #42
erikwright (departed)
The CQ bit was checked by erikwright@chromium.org
6 years, 8 months ago (2014-03-29 03:48:06 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/erikwright@chromium.org/205813002/640001
6 years, 8 months ago (2014-03-29 03:48:25 UTC) #44
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-03-29 04:18:18 UTC) #45
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.chromium on linux_chromium_chromeos_rel
6 years, 8 months ago (2014-03-29 04:18:19 UTC) #46
erikwright (departed)
The CQ bit was checked by erikwright@chromium.org
6 years, 8 months ago (2014-03-29 10:11:58 UTC) #47
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/erikwright@chromium.org/205813002/640001
6 years, 8 months ago (2014-03-29 10:12:17 UTC) #48
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-03-29 11:42:05 UTC) #49
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.chromium on linux_chromium_chromeos_rel
6 years, 8 months ago (2014-03-29 11:42:05 UTC) #50
erikwright (departed)
The CQ bit was checked by erikwright@chromium.org
6 years, 8 months ago (2014-03-29 12:04:47 UTC) #51
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/erikwright@chromium.org/205813002/640001
6 years, 8 months ago (2014-03-29 12:04:57 UTC) #52
commit-bot: I haz the power
Change committed as 260387
6 years, 8 months ago (2014-03-29 17:49:01 UTC) #53
gab
Very nice :)! Some comments below, mostly nits, one question about the correctness of MigrateValues(). ...
6 years, 8 months ago (2014-04-01 18:55:06 UTC) #54
gab
https://codereview.chromium.org/205813002/diff/640001/chrome/browser/prefs/pref_hash_filter.cc File chrome/browser/prefs/pref_hash_filter.cc (right): https://codereview.chromium.org/205813002/diff/640001/chrome/browser/prefs/pref_hash_filter.cc#newcode98 chrome/browser/prefs/pref_hash_filter.cc:98: pref_hash_store_->BeginTransaction(); On 2014/04/01 18:55:06, gab wrote: > Is pref_hash_store_ ...
6 years, 8 months ago (2014-04-01 19:24:13 UTC) #55
erikwright (departed)
Some responses. The changes will be uploaded in a separate CL. https://codereview.chromium.org/205813002/diff/640001/chrome/browser/prefs/pref_hash_filter.cc File chrome/browser/prefs/pref_hash_filter.cc (right): ...
6 years, 8 months ago (2014-04-01 19:46:08 UTC) #56
gab
6 years, 8 months ago (2014-04-02 17:02:02 UTC) #57
Message was sent while issue was closed.
https://codereview.chromium.org/205813002/diff/640001/chrome/browser/prefs/pr...
File chrome/browser/prefs/pref_hash_filter.cc (right):

https://codereview.chromium.org/205813002/diff/640001/chrome/browser/prefs/pr...
chrome/browser/prefs/pref_hash_filter.cc:98:
pref_hash_store_->BeginTransaction();
On 2014/04/01 19:46:08, erikwright wrote:
> On 2014/04/01 18:55:06, gab wrote:
> > Is pref_hash_store_ expected to be the underlying hash store for |source| or
> for
> > |destination| (I'm guessing |source| since this is how it's used in this
> > method). I think a meta-comment in the interface is necessary to clarify
this.
> 
> The method comment for MigrateValues says, in part:
> 
> "Values are migrated if they are protected according to this filter's
> configuration, the corresponding key has no value in |destination|, and the
> value in |source| is trusted according to this filter's PrefHashStore."
> 
> Is that sufficient?

Perhaps adding something like:

"This PrefHashFilter shouldn't be tied to |source| nor |destination|."

?

I don't really like this approach overall, but it's the easiest short term
solution.

https://codereview.chromium.org/205813002/diff/640001/chrome/browser/prefs/pr...
File chrome/browser/prefs/profile_pref_store_manager.cc (right):

https://codereview.chromium.org/205813002/diff/640001/chrome/browser/prefs/pr...
chrome/browser/prefs/profile_pref_store_manager.cc:161: // It's a bit of a
coincidence that this (and ClearResetTime) work(s). The
On 2014/04/01 19:46:08, erikwright wrote:
> On 2014/04/01 18:55:06, gab wrote:
> > :( -- to avoid all of this madness how about we use PrefService to Set/Get
(we
> > can't do this directly at the time of Set() since the PrefService doesn't
> exist
> > yet, but we could post a task to have an anonymous method kick in to do this
> > properly when the message loop starts running).
> > 
> > Feels cleaner than depending so tightly on the implementation for this to
> work.
> 
> The current implementation is cleaner, easier to understand, and has less
moving
> parts than what you propose.
> 
> If I were really worried I would just expose the name of the pref from
> PrefHashFilter and then add it to the list of selected prefs that I pass to
the
> segregated pref store. Then I would know for certain that it was stored in the
> right place.
> 
> But it's not really tightly coupled to anything too far removed. Remember that
> it is _this_ class (ProfilePrefStoreManager) that is responsible for doing the
> configuration - so if the behaviour changes, this class will be part of the
> change.
> 
> Finally, there are unit tests that prevent unintended regressions of this
> functionality.

Okay, makes sense, I agree with you now that I understand the
SegregatedPrefStore (I hadn't reviewed that change yet when I wrote this comment
originally).

This comment might sound more alarming than it needs to be, but that's okay.

https://codereview.chromium.org/205813002/diff/640001/chrome/browser/prefs/tr...
File chrome/browser/prefs/tracked/segregated_pref_store.cc (right):

https://codereview.chromium.org/205813002/diff/640001/chrome/browser/prefs/tr...
chrome/browser/prefs/tracked/segregated_pref_store.cc:22: return;
On 2014/04/01 19:46:08, erikwright wrote:
> On 2014/04/01 18:55:06, gab wrote:
> > Shouldn't we keep this notification around to send it after we send the
> > initialization ping?
> > 
> > i.e.
> > 1) Store 1 is initialized
> > 2) A value is changed in store 1
> > 3) Store 2 is initialized
> > 4) We notify observers of initialization
> > 
> > Shouldn't we then 5) Notify observers of the value changed in (2)?
> > 
> > Is it even possible for (2) to occur before (3) or should this return also
be
> > NOTREACHED()?
> 
> Yes it is possible for (2) to occur before (3). For example, the
PrefHashFilter
> attached to Store 1 might change a value in Store 1.

I was talking about (2) being a "real" change. PrefHashFilter's changes aren't
"real" (i.e. they don't generate OnValueChanged notifications).

I don't think that's possible (since no external user is made aware of the store
before they are both initialized) -- and thus I think this should be a
NOTREACHED().

> 
> Please see previous discussion with Robert about this.
> 
> There is no reason to inform clients of a change in this store when they never
> heard of the original value. The value that is present when they first hear
> about the store _is_ the original value, as far as they are concerned.

Powered by Google App Engine
This is Rietveld 408576698