Revert 184967
> Initialize BrowserPolicyConnector after the IOThread is created.
>
> The import process on Windows spawns a subprocess and spins a nested message loop waiting for it to complete. If this subprocess takes longer than 5 seconds then the message loop will execute a delayed initialization task of the policy code, that grabs the system request context; however, since the IOThread hasn't been created yet this leads to a crash.
>
> BUG=177843
>
> Review URL: https://chromiumcodereview.appspot.com/12310100
[email protected]
Review URL: https://codereview.chromium.org/12328146
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184970 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 507e063..fba82ec 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -475,8 +475,10 @@
DCHECK(CalledOnValidThread());
#if defined(ENABLE_CONFIGURATION_POLICY)
if (!created_browser_policy_connector_) {
+ // Init() should not reenter this function. If it does this will DCHECK.
DCHECK(!browser_policy_connector_);
browser_policy_connector_.reset(new policy::BrowserPolicyConnector());
+ browser_policy_connector_->Init();
created_browser_policy_connector_ = true;
}
return browser_policy_connector_.get();
@@ -842,16 +844,6 @@
}
void BrowserProcessImpl::PreMainMessageLoopRun() {
-#if defined(ENABLE_CONFIGURATION_POLICY)
- // browser_policy_connector() is created very early because local_state()
- // needs policy to be initialized with the managed preference values.
- // However, policy fetches from the network and loading of disk caches
- // requires that threads are running; this Init() call lets the connector
- // resume its initialization now that the loops are spinning and the
- // system request context is available for the fetchers.
- browser_policy_connector()->Init(local_state(), system_request_context());
-#endif
-
if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled))
ApplyDefaultBrowserPolicy();