Commit e684cc74 authored by Guillaume Jenkins's avatar Guillaume Jenkins Committed by Commit Bot

[iOS Policy] Add comments about BrowserStatePolicyConnector lifecycle

Adds some comments clarifying why BrowserStatePolicyConnector isn't a
keyed service. Comments are added in the impl class, the mock class, and
the parent object (both the mock and the real application context).

Change-Id: I3a48a3ac903a3b37c916275ae18b78e77edf691f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2499961Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Guillaume Jenkins <gujen@google.com>
Cr-Commit-Position: refs/heads/master@{#821306}
parent a796d4da
......@@ -100,7 +100,10 @@ class ApplicationContextImpl : public ApplicationContext {
std::unique_ptr<BreadcrumbPersistentStorageManager>
breadcrumb_persistent_storage_manager_;
// Must be destroyed after |local_state_|.
// Must be destroyed after |local_state_|. BrowserStatePolicyConnector isn't a
// keyed service because the pref service, which isn't a keyed service, has a
// hard dependency on the policy infrastructure. In order to outlive the pref
// service, the policy connector must live outside the keyed services.
std::unique_ptr<BrowserPolicyConnectorIOS> browser_policy_connector_;
std::unique_ptr<PrefService> local_state_;
......
......@@ -18,6 +18,10 @@ class SchemaRegistry;
// BrowserStatePolicyConnector creates and manages the per-BrowserState policy
// components and their integration with PrefService.
// BrowserStatePolicyConnector isn't a keyed service because the pref service,
// which isn't a keyed service, has a hard dependency on the policy
// infrastructure. In order to outlive the pref service, the policy connector
// must live outside the keyed services.
class BrowserStatePolicyConnector {
public:
BrowserStatePolicyConnector();
......
......@@ -16,6 +16,10 @@ class SchemaRegistry;
// BrowserStatePolicyConnector creates and manages the per-BrowserState policy
// components and their integration with PrefService.
// BrowserStatePolicyConnector isn't a keyed service because the pref service,
// which isn't a keyed service, has a hard dependency on the policy
// infrastructure. In order to outlive the pref service, the policy connector
// must live outside the keyed services.
class BrowserStatePolicyConnectorMock : public BrowserStatePolicyConnector {
public:
BrowserStatePolicyConnectorMock(
......
......@@ -70,8 +70,13 @@ class TestingApplicationContext : public ApplicationContext {
base::ThreadChecker thread_checker_;
std::string application_locale_;
PrefService* local_state_;
// Must be destroyed after |local_state_|.
// Must be destroyed after |local_state_|. BrowserStatePolicyConnector isn't a
// keyed service because the pref service, which isn't a keyed service, has a
// hard dependency on the policy infrastructure. In order to outlive the pref
// service, the policy connector must live outside the keyed services.
std::unique_ptr<BrowserPolicyConnectorIOS> browser_policy_connector_;
ios::ChromeBrowserStateManager* chrome_browser_state_manager_;
std::unique_ptr<network_time::NetworkTimeTracker> network_time_tracker_;
bool was_last_shutdown_clean_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment