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

Issue 24153012: Fix cyclic dependency between ProfilePolicyConnector and PrefService. (Closed)

Created:
7 years, 3 months ago by pneubeck (no reviews)
Modified:
7 years, 1 month ago
CC:
chromium-reviews
Visibility:
Public.

Description

Fix cyclic dependency between ProfilePolicyConnector and PrefService. PolicyCertVerifier lives (at least partially) on IO to provide certificate trust anchors to the net subsystem. The list of trust anchors is provided by the policy subsystem, which lives on UI. On each usage of one of the trust anchors, the profile must be tainted by setting a specific Pref value, which must happen on UI. There were several problems and bugs, all of which are solved with this CL: - NetworkConfigurationUpdater keeps a PolicyCertVerifier* until destruction, although PolicyCertVerifier is invalidated earlier and destructed in parallel on IO. - Instead of explicitly managing lifetime/dependencies, PolicyCertVerifier accesses ProfilePolicyConnector through a WeakPtr. - Cyclic static dependency between ProfilePolicyConnector and PrefService. - Each, the original profile and the OffTheRecordProfile (OTRProfile), have a separate PolicyCertVerifier instance. The ProfilePolicyConnector/UserNetworkConfigurationUpdater are shared however. This wasn't considered during the implementation of the latter. They only have a SetPolicyCertVerifier instead of a AddPolicyCertVerifier method. - ProfilePolicyConnector stores a Profile* instead of a PrefService* . This CL moves the certificate related parts out of ProfilePolicyConnector and puts them into a separate keyed service NetworkPolicyService (living on UI, taking care of syncing with IO) which is tightly coupled with the PolicyCertVerifier (purely living on IO). The new dependencies are: NetworkConfigurationUpdater --(Observer::OnTrustAnchorsChanged)-> NetworkPolicyService --(post to IO)-> PolicyCertVerifier --(run callback, post to UI)-> NetworkPolicyService For a summary of the dependencies see the accompanying bug. Depends on: https://codereview.chromium.org/53923004/ BUG=312660, 77155 TBR=ben@chromium.org,jcivelli@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=234806

Patch Set 1 : #

Patch Set 2 : Fix some includes and nits. #

Total comments: 12

Patch Set 3 : Fix NetworkPolicyServiceFactory to shared service for incognito with original profile. #

Total comments: 25

Patch Set 4 : Addressed comments. #

Patch Set 5 : Use callback_list in PolicyCertVerifier. #

Total comments: 45

Patch Set 6 : Addressed Joao's comments. #

Patch Set 7 : Rebased. #

Patch Set 8 : Addressed last comment and fixed compilation. #

Patch Set 9 : Reverted back to callbacks without callback_list. Fixed tests. #

Patch Set 10 : Addressed issues as discussed. #

Patch Set 11 : Fixed another bug for OTRProfile. #

Total comments: 8

Patch Set 12 : Addressed comments. #

Total comments: 8

Patch Set 13 : Incorporated Will's suggestions. #

Patch Set 14 : Rebased. #

Patch Set 15 : Rebased #

Patch Set 16 : Fix/Extend NetworkConfigurationUpdater unit test. #

Total comments: 14

Patch Set 17 : Addressed comments. #

Patch Set 18 : Rebased. #

Patch Set 19 : Rebased. #

Patch Set 20 : Renamed NetworkPolicyService to PolicyCertService. #

Patch Set 21 : Moved the files. #

Patch Set 22 : Rebased and resolved conflict. #

Total comments: 1

Patch Set 23 : Fixed. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+517 lines, -202 lines) Patch
M chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 7 chunks +99 lines, -24 lines 0 comments Download
A chrome/browser/chromeos/policy/policy_cert_service.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +74 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/policy/policy_cert_service.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +87 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/policy/policy_cert_service_factory.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +60 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/policy/policy_cert_service_factory.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +81 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/policy/policy_cert_verifier.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +9 lines, -4 lines 0 comments Download
M chrome/browser/chromeos/policy/policy_cert_verifier.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +1 line, -2 lines 0 comments Download
M chrome/browser/chromeos/policy/user_network_configuration_updater.h View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +14 lines, -14 lines 0 comments Download
M chrome/browser/chromeos/policy/user_network_configuration_updater.cc View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +16 lines, -19 lines 0 comments Download
M chrome/browser/policy/profile_policy_connector.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 4 chunks +7 lines, -35 lines 0 comments Download
M chrome/browser/policy/profile_policy_connector.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 5 chunks +13 lines, -36 lines 0 comments Download
M chrome/browser/policy/profile_policy_connector_factory.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 5 chunks +7 lines, -9 lines 0 comments Download
M chrome/browser/policy/profile_policy_connector_stub.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +1 line, -5 lines 0 comments Download
M chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +2 lines, -0 lines 0 comments Download
M chrome/browser/profiles/off_the_record_profile_io_data.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/browser/profiles/profile_io_data.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 3 chunks +1 line, -6 lines 0 comments Download
M chrome/browser/profiles/profile_io_data.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 6 chunks +12 lines, -30 lines 0 comments Download
M chrome/browser/ui/toolbar/toolbar_model_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 4 chunks +13 lines, -7 lines 0 comments Download
M chrome/browser/ui/website_settings/website_settings.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +15 lines, -7 lines 0 comments Download
M chrome/chrome_browser_chromeos.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/test/base/testing_profile.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +1 line, -2 lines 0 comments Download

Messages

Total messages: 39 (0 generated)
pneubeck (no reviews)
I still have to see if all tests are passing and maybe add/update some comments.
7 years, 3 months ago (2013-09-19 13:55:38 UTC) #1
Mattias Nissler (ping if slow)
https://chromiumcodereview-hr.appspot.com/24153012/diff/49001/chrome/browser/chromeos/policy/network_policy_service.cc File chrome/browser/chromeos/policy/network_policy_service.cc (right): https://chromiumcodereview-hr.appspot.com/24153012/diff/49001/chrome/browser/chromeos/policy/network_policy_service.cc#newcode40 chrome/browser/chromeos/policy/network_policy_service.cc:40: // Allow trusted certs from policy only for managed ...
7 years, 3 months ago (2013-09-20 12:35:23 UTC) #2
pneubeck (no reviews)
https://codereview.chromium.org/24153012/diff/49001/chrome/browser/chromeos/policy/network_policy_service.h File chrome/browser/chromeos/policy/network_policy_service.h (right): https://codereview.chromium.org/24153012/diff/49001/chrome/browser/chromeos/policy/network_policy_service.h#newcode47 chrome/browser/chromeos/policy/network_policy_service.h:47: // the UI thread) even after this Connector is ...
7 years, 3 months ago (2013-09-20 12:39:36 UTC) #3
Joao da Silva
This is quite a nice cleanup. First round of comments! https://codereview.chromium.org/24153012/diff/55001/chrome/browser/chromeos/policy/network_policy_service.cc File chrome/browser/chromeos/policy/network_policy_service.cc (right): https://codereview.chromium.org/24153012/diff/55001/chrome/browser/chromeos/policy/network_policy_service.cc#newcode25 ...
7 years, 3 months ago (2013-09-20 13:00:01 UTC) #4
pneubeck (no reviews)
https://codereview.chromium.org/24153012/diff/49001/chrome/browser/chromeos/policy/network_policy_service.cc File chrome/browser/chromeos/policy/network_policy_service.cc (right): https://codereview.chromium.org/24153012/diff/49001/chrome/browser/chromeos/policy/network_policy_service.cc#newcode40 chrome/browser/chromeos/policy/network_policy_service.cc:40: // Allow trusted certs from policy only for managed ...
7 years, 2 months ago (2013-10-15 13:23:10 UTC) #5
Joao da Silva
Almost there. This is a quite a nice cleanup. https://codereview.chromium.org/24153012/diff/151001/chrome/browser/chromeos/policy/network_policy_service.cc File chrome/browser/chromeos/policy/network_policy_service.cc (right): https://codereview.chromium.org/24153012/diff/151001/chrome/browser/chromeos/policy/network_policy_service.cc#newcode29 chrome/browser/chromeos/policy/network_policy_service.cc:29: ...
7 years, 2 months ago (2013-10-16 12:44:58 UTC) #6
pneubeck (no reviews)
https://codereview.chromium.org/24153012/diff/151001/chrome/browser/chromeos/policy/network_policy_service.cc File chrome/browser/chromeos/policy/network_policy_service.cc (right): https://codereview.chromium.org/24153012/diff/151001/chrome/browser/chromeos/policy/network_policy_service.cc#newcode29 chrome/browser/chromeos/policy/network_policy_service.cc:29: chromeos::User* user = user_manager->GetActiveUser(); On 2013/10/16 12:44:58, Joao da ...
7 years, 2 months ago (2013-10-22 18:47:41 UTC) #7
Joao da Silva
lgtm This change is quite substantial, it's a good idea to manually verify everything still ...
7 years, 2 months ago (2013-10-23 07:45:54 UTC) #8
pneubeck (no reviews)
Ok. The problem is now: OTRProfile reuses the same NetworkPolicyService as the regular profile. Both ...
7 years, 2 months ago (2013-10-23 11:22:09 UTC) #9
pneubeck (no reviews)
On 2013/10/23 11:22:09, pneubeck wrote: > Ok. The problem is now: > > OTRProfile reuses ...
7 years, 2 months ago (2013-10-23 11:25:04 UTC) #10
pneubeck (no reviews)
apart from some debug logs that i have to remove, this should be good now.
7 years, 2 months ago (2013-10-24 20:45:03 UTC) #11
pneubeck (no reviews)
@William, could you please take a look at the profile* changes? The additional ReleaseFromBrowserContextServices methods ...
7 years, 2 months ago (2013-10-24 20:52:17 UTC) #12
pneubeck (no reviews)
@Joao, ptal.
7 years, 1 month ago (2013-10-25 08:46:05 UTC) #13
Joao da Silva
lgtm https://codereview.chromium.org/24153012/diff/1198001/chrome/browser/chromeos/policy/policy_cert_verifier.h File chrome/browser/chromeos/policy/policy_cert_verifier.h (right): https://codereview.chromium.org/24153012/diff/1198001/chrome/browser/chromeos/policy/policy_cert_verifier.h#newcode35 chrome/browser/chromeos/policy/policy_cert_verifier.h:35: // anchors (set with SetTrustAnchors) is used. This ...
7 years, 1 month ago (2013-10-25 11:57:10 UTC) #14
pneubeck (no reviews)
https://codereview.chromium.org/24153012/diff/1198001/chrome/browser/chromeos/policy/policy_cert_verifier.h File chrome/browser/chromeos/policy/policy_cert_verifier.h (right): https://codereview.chromium.org/24153012/diff/1198001/chrome/browser/chromeos/policy/policy_cert_verifier.h#newcode35 chrome/browser/chromeos/policy/policy_cert_verifier.h:35: // anchors (set with SetTrustAnchors) is used. This notifications ...
7 years, 1 month ago (2013-10-25 12:16:59 UTC) #15
willchan no longer on Chromium
I'm trying to digest the dependency graph and am having some trouble. Can you explain ...
7 years, 1 month ago (2013-10-29 01:21:09 UTC) #16
pneubeck (no reviews)
On 2013/10/29 01:21:09, willchan wrote: > I'm trying to digest the dependency graph and am ...
7 years, 1 month ago (2013-10-29 09:55:47 UTC) #17
pneubeck (no reviews)
https://codereview.chromium.org/24153012/diff/1498001/chrome/browser/profiles/profile_impl.cc File chrome/browser/profiles/profile_impl.cc (right): https://codereview.chromium.org/24153012/diff/1498001/chrome/browser/profiles/profile_impl.cc#newcode392 chrome/browser/profiles/profile_impl.cc:392: is_login_profile_ = chromeos::ProfileHelper::IsSigninProfile(this); On 2013/10/29 01:21:09, willchan wrote: > ...
7 years, 1 month ago (2013-10-29 09:56:21 UTC) #18
willchan no longer on Chromium
Thanks for the explanation, this makes sense to me now. I have one dependency ordering ...
7 years, 1 month ago (2013-10-30 01:12:30 UTC) #19
pneubeck (no reviews)
https://codereview.chromium.org/24153012/diff/1498001/chrome/browser/profiles/profile_impl.cc File chrome/browser/profiles/profile_impl.cc (right): https://codereview.chromium.org/24153012/diff/1498001/chrome/browser/profiles/profile_impl.cc#newcode392 chrome/browser/profiles/profile_impl.cc:392: is_login_profile_ = chromeos::ProfileHelper::IsSigninProfile(this); On 2013/10/29 09:56:22, pneubeck wrote: > ...
7 years, 1 month ago (2013-10-30 08:32:02 UTC) #20
willchan no longer on Chromium
https://codereview.chromium.org/24153012/diff/1498001/chrome/browser/profiles/profile_impl.cc File chrome/browser/profiles/profile_impl.cc (right): https://codereview.chromium.org/24153012/diff/1498001/chrome/browser/profiles/profile_impl.cc#newcode392 chrome/browser/profiles/profile_impl.cc:392: is_login_profile_ = chromeos::ProfileHelper::IsSigninProfile(this); On 2013/10/30 08:32:03, pneubeck wrote: > ...
7 years, 1 month ago (2013-10-30 17:20:48 UTC) #21
pneubeck (no reviews)
https://codereview.chromium.org/24153012/diff/1498001/chrome/browser/profiles/profile_impl.cc File chrome/browser/profiles/profile_impl.cc (right): https://codereview.chromium.org/24153012/diff/1498001/chrome/browser/profiles/profile_impl.cc#newcode392 chrome/browser/profiles/profile_impl.cc:392: is_login_profile_ = chromeos::ProfileHelper::IsSigninProfile(this); On 2013/10/30 17:20:48, willchan wrote: > ...
7 years, 1 month ago (2013-10-31 08:41:39 UTC) #22
pneubeck (no reviews)
Thanks William for thorough review. I think, I could address all your points and the ...
7 years, 1 month ago (2013-11-05 15:37:33 UTC) #23
willchan no longer on Chromium
Apologies, I'm in Vancouver IETF now. I hope to have time today to get to ...
7 years, 1 month ago (2013-11-05 17:01:36 UTC) #24
willchan no longer on Chromium
LGTM, thanks for incorporating my feedback.
7 years, 1 month ago (2013-11-06 18:04:01 UTC) #25
pneubeck (no reviews)
@Joao, please take another look.
7 years, 1 month ago (2013-11-07 15:30:21 UTC) #26
Joao da Silva
IIUC this isn't working in incognito, but I might be wrong. Did you test it? ...
7 years, 1 month ago (2013-11-11 12:38:18 UTC) #27
pneubeck (no reviews)
https://codereview.chromium.org/24153012/diff/2418001/chrome/browser/chromeos/policy/network_policy_service.h File chrome/browser/chromeos/policy/network_policy_service.h (right): https://codereview.chromium.org/24153012/diff/2418001/chrome/browser/chromeos/policy/network_policy_service.h#newcode20 chrome/browser/chromeos/policy/network_policy_service.h:20: class User; On 2013/11/11 12:38:19, Joao da Silva wrote: ...
7 years, 1 month ago (2013-11-12 10:07:53 UTC) #28
pneubeck (no reviews)
@Ben: chrome/browser/ui/** @Jay: chrome/test/base/testing_profile.cc
7 years, 1 month ago (2013-11-12 10:09:15 UTC) #29
Joao da Silva
lgtm, thanks!
7 years, 1 month ago (2013-11-12 14:29:37 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pneubeck@chromium.org/24153012/2878001
7 years, 1 month ago (2013-11-12 15:03:31 UTC) #31
commit-bot: I haz the power
Step "update" is always a major failure. Look at the try server FAQ for more ...
7 years, 1 month ago (2013-11-12 15:17:43 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pneubeck@chromium.org/24153012/2878001
7 years, 1 month ago (2013-11-12 15:41:16 UTC) #33
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 1 month ago (2013-11-12 16:14:16 UTC) #34
pneubeck (no reviews)
@Joao, I had to rebase onto your SchemaRegistryService addition to ProfilePolicyConnector. As with the other ...
7 years, 1 month ago (2013-11-13 09:38:59 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pneubeck@chromium.org/24153012/3338001
7 years, 1 month ago (2013-11-13 09:39:21 UTC) #36
Joao da Silva
https://codereview.chromium.org/24153012/diff/3338001/chrome/browser/policy/profile_policy_connector_factory.cc File chrome/browser/policy/profile_policy_connector_factory.cc (right): https://codereview.chromium.org/24153012/diff/3338001/chrome/browser/policy/profile_policy_connector_factory.cc#newcode96 chrome/browser/policy/profile_policy_connector_factory.cc:96: schema_registry = SchemaRegistryServiceFactory::GetForContext(profile); The schema_registry is also needed for ...
7 years, 1 month ago (2013-11-13 09:45:57 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pneubeck@chromium.org/24153012/3468001
7 years, 1 month ago (2013-11-13 10:09:36 UTC) #38
commit-bot: I haz the power
7 years, 1 month ago (2013-11-13 12:33:41 UTC) #39
Message was sent while issue was closed.
Change committed as 234806

Powered by Google App Engine
This is Rietveld 408576698