summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_process_impl.cc
diff options
context:
space:
mode:
authorjoaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-28 09:07:24 +0000
committerjoaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-28 09:07:24 +0000
commit362d694f7b1122e10a5f0353f2c0f6079a6cf829 (patch)
tree9571248b133968e6f18098a556175ca701c41aa8 /chrome/browser/browser_process_impl.cc
parent9ed6463dce1e8bf17ab0b7886b755415967e641e (diff)
downloadchromium_src-362d694f7b1122e10a5f0353f2c0f6079a6cf829.zip
chromium_src-362d694f7b1122e10a5f0353f2c0f6079a6cf829.tar.gz
chromium_src-362d694f7b1122e10a5f0353f2c0f6079a6cf829.tar.bz2
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. TBR=jochen@chromium.org BUG=177843 Review URL: https://chromiumcodereview.appspot.com/12317149 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185186 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_process_impl.cc')
-rw-r--r--chrome/browser/browser_process_impl.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 4533377..8f6a95d 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -475,10 +475,8 @@ policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() {
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();
@@ -844,6 +842,16 @@ void BrowserProcessImpl::PreCreateThreads() {
}
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();