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

Issue 2858060: Changing policy while Chrome is running should refresh preferences without relaunching (Closed)

Created:
10 years, 5 months ago by danno
Modified:
9 years, 7 months ago
CC:
chromium-reviews, ben+cc_chromium.org, Paweł Hajdan Jr., brettw-cc_chromium.org
Visibility:
Public.

Description

Changing policy while Chrome is running should refresh preferences without relaunching Includes windows-only Group Policy watcher that triggers policy refresh. BUG=45324 TEST=--gtest_filter=PrefValueStoreTest.* and manual Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=54902

Patch Set 1 #

Patch Set 2 : finish implementation, add unit tests #

Patch Set 3 : fix windows build #

Patch Set 4 : make lint happy #

Patch Set 5 : refactoring based on discussions with team #

Patch Set 6 : make windows build work #

Patch Set 7 : nits #

Patch Set 8 : merge to latest #

Patch Set 9 : fix windows build #

Patch Set 10 : merge with latest #

Patch Set 11 : make trybots work #

Patch Set 12 : fix sync problems in tests, add message loop for threading #

Patch Set 13 : fix windows tests #

Patch Set 14 : re-add accidentally removed build flag #

Total comments: 78

Patch Set 15 : review feedback #

Patch Set 16 : address review feedback, put values* changes in a second cl #

Total comments: 24

Patch Set 17 : rediscover lost file #

Patch Set 18 : address review feedback #

Patch Set 19 : changed name of mock #

Unified diffs Side-by-side diffs Delta from patch set Stats (+461 lines, -29 lines) Patch
M chrome/browser/configuration_policy_provider.h View 1 2 3 4 5 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/browser/configuration_policy_provider.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +9 lines, -0 lines 0 comments Download
M chrome/browser/configuration_policy_provider_win.h View 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 3 chunks +22 lines, -0 lines 0 comments Download
M chrome/browser/configuration_policy_provider_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +38 lines, -0 lines 0 comments Download
M chrome/browser/configuration_policy_provider_win_unittest.cc View 13 14 15 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/browser/pref_service.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +27 lines, -3 lines 0 comments Download
M chrome/browser/pref_service.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +35 lines, -0 lines 0 comments Download
M chrome/browser/pref_value_store.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 4 chunks +45 lines, -1 line 0 comments Download
M chrome/browser/pref_value_store.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +83 lines, -1 line 0 comments Download
M chrome/browser/pref_value_store_unittest.cc View 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 7 chunks +186 lines, -24 lines 0 comments Download
M chrome/common/notification_type.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
danno
Please review, thanks!
10 years, 4 months ago (2010-07-29 08:53:38 UTC) #1
Mattias Nissler (ping if slow)
Here is your review! http://codereview.chromium.org/2858060/diff/45013/59001 File chrome/browser/configuration_policy_provider.cc (right): http://codereview.chromium.org/2858060/diff/45013/59001#newcode79 chrome/browser/configuration_policy_provider.cc:79: type, I believe it's possible ...
10 years, 4 months ago (2010-07-29 20:37:24 UTC) #2
danno
Addressed feedback. Note that this CL now requires http://codereview.chromium.org/3035045 applied first to work. http://codereview.chromium.org/2858060/diff/45013/59001 File ...
10 years, 4 months ago (2010-08-03 16:18:04 UTC) #3
markusheintz_
Quick drive by: What happened to the changes in base/value.* (introduces in patch_set 15)? You ...
10 years, 4 months ago (2010-08-03 17:08:22 UTC) #4
Mattias Nissler (ping if slow)
Just a couple of nits. I'm OK with doing the PrefValueStore->PrefService notification refactoring in a ...
10 years, 4 months ago (2010-08-04 10:07:47 UTC) #5
Mattias Nissler (ping if slow)
LGTM if you consider my previous comments and make the trybots happy.
10 years, 4 months ago (2010-08-04 10:13:28 UTC) #6
danno
10 years, 4 months ago (2010-08-04 12:10:08 UTC) #7
addressed your feedback

http://codereview.chromium.org/2858060/diff/44014/64003
File chrome/browser/configuration_policy_provider_win.h (right):

http://codereview.chromium.org/2858060/diff/44014/64003#newcode11
chrome/browser/configuration_policy_provider_win.h:11: #include
"base/scoped_ptr.h"
On 2010/08/04 10:07:47, mnissler wrote:
> Swap for correct lexicographic sorting.

Done.

http://codereview.chromium.org/2858060/diff/44014/64003#newcode23
chrome/browser/configuration_policy_provider_win.h:23: // Keeps watch on
Window's Group Policy notification event to trigger
On 2010/08/04 10:07:47, mnissler wrote:
> Shouldn't it be Windows'?

Done.

http://codereview.chromium.org/2858060/diff/44014/64005
File chrome/browser/pref_service.cc (right):

http://codereview.chromium.org/2858060/diff/44014/64005#newcode844
chrome/browser/pref_service.cc:844:
FireObservers(UTF8ToWide(current->data()).data());
On 2010/08/04 10:07:47, mnissler wrote:
> Maybe it's cleaner to convert them to wchar directly after computing them?
That
> would also save the conversions in the unit test. Your call.
I am on the fence for this. trungl did a bunch of work to remove wstring from
all key/path-related APIs in Values.h/.cc, so I think anything that deals with
paths should stay a strings and the client of the API should do the conversion
if necessary.

http://codereview.chromium.org/2858060/diff/44014/64007
File chrome/browser/pref_value_store.cc (right):

http://codereview.chromium.org/2858060/diff/44014/64007#newcode160
chrome/browser/pref_value_store.cc:160: changed_paths.resize(last_insert -
changed_paths.begin());
On 2010/08/04 10:07:47, mnissler wrote:
> What's the point of calling this?
The changed_path vector is allocated with enough space to hold the result of the
merge in the "worst" case. However, merge itself doesn't change the size of the
vector. After the merge is complete, it's necessary to trim the unused items off
the end of the vector in the case that everything turned out better than the
worst case.

http://codereview.chromium.org/2858060/diff/44014/64008
File chrome/browser/pref_value_store.h (right):

http://codereview.chromium.org/2858060/diff/44014/64008#newcode10
chrome/browser/pref_value_store.h:10: #include <set>
On 2010/08/04 10:07:47, mnissler wrote:
> Are these needed?

Done.

http://codereview.chromium.org/2858060/diff/44014/64009
File chrome/browser/pref_value_store_unittest.cc (right):

http://codereview.chromium.org/2858060/diff/44014/64009#newcode25
chrome/browser/pref_value_store_unittest.cc:25: : paths_(paths) {}
On 2010/08/04 10:07:47, mnissler wrote:
> indent

Done.

http://codereview.chromium.org/2858060/diff/44014/64009#newcode489
chrome/browser/pref_value_store_unittest.cc:489: class TestPolicyRefreshCallback
{
On 2010/08/04 10:07:47, mnissler wrote:
> I think this would be a perfect candidate for gmock's EXPECT_CALL() mechanism.
> You decide :)

Done.

http://codereview.chromium.org/2858060/diff/44014/64009#newcode548
chrome/browser/pref_value_store_unittest.cc:548:
&TestPolicyRefreshCallback::DoCallback));
On 2010/08/04 10:07:47, mnissler wrote:
> You should check that the callback has run here.

Done.

http://codereview.chromium.org/2858060/diff/44014/64009#newcode559
chrome/browser/pref_value_store_unittest.cc:559:
&TestPolicyRefreshCallback::DoCallback));
On 2010/08/04 10:07:47, mnissler wrote:
> and here.

Done.

http://codereview.chromium.org/2858060/diff/44014/64009#newcode573
chrome/browser/pref_value_store_unittest.cc:573:
&TestPolicyRefreshCallback::DoCallback));
On 2010/08/04 10:07:47, mnissler wrote:
> and here.

Done.

http://codereview.chromium.org/2858060/diff/44014/64009#newcode589
chrome/browser/pref_value_store_unittest.cc:589:
&TestPolicyRefreshCallback::DoCallback));
On 2010/08/04 10:07:47, mnissler wrote:
> and here.

Done.

http://codereview.chromium.org/2858060/diff/44014/64009#newcode633
chrome/browser/pref_value_store_unittest.cc:633:
EXPECT_TRUE(callback3.HasCompleted());
They don't expect the same thing. Notice the clear of the expected path vector
after the first call.
On 2010/08/04 10:07:47, mnissler wrote:
> So all three refresh operations detect the same changes, since they run
> interlocked, right? I guess I'm OK with that, shouldn't happen much in
reality,
> right?

Powered by Google App Engine
This is Rietveld 408576698