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

Unified Diff: chrome/browser/profiles/profile_io_data.cc

Issue 10912132: Move ProxyConfigService construction onto the IO thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove extra blank line Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/profile_io_data.cc
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index 86e8045b5399b6d890b20a980df56c56a7a1b85e..222fded59853e49b70e484788256532125232fb0 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -135,6 +135,18 @@ Profile* GetProfileOnUI(ProfileManager* profile_manager, Profile* profile) {
return NULL;
}
+// Inform PrefProxyConfigTracker of underlying ChromeProxyConfigService.
+void SetChromeProxyConfigService(
+ base::Callback<Profile*(void)> profile_getter,
+ ChromeProxyConfigService* chrome_proxy_config_service) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ Profile* profile = profile_getter.Run();
+ if (profile) {
+ profile->GetProxyConfigTracker()->SetChromeProxyConfigService(
+ chrome_proxy_config_service);
+ }
+}
+
} // namespace
void ProfileIOData::InitializeOnUIThread(Profile* profile) {
@@ -199,11 +211,7 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) {
params->protocol_handler_interceptor.reset(
protocol_handler_registry->CreateURLInterceptor());
- ChromeProxyConfigService* proxy_config_service =
- ProxyServiceFactory::CreateProxyConfigService(true);
- params->proxy_config_service.reset(proxy_config_service);
- profile->GetProxyConfigTracker()->SetChromeProxyConfigService(
- proxy_config_service);
+ params->profile_getter = profile_getter;
params->profile = profile;
profile_params_.reset(params.release());
@@ -552,11 +560,18 @@ void ProfileIOData::LazyInitialize() const {
new chrome_browser_net::ChromeFraudulentCertificateReporter(
main_request_context_.get()));
+ ChromeProxyConfigService* proxy_config_service =
+ ProxyServiceFactory::CreateProxyConfigService(true);
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ base::Bind(&SetChromeProxyConfigService,
+ profile_params_->profile_getter,
+ proxy_config_service));
+
proxy_service_.reset(
ProxyServiceFactory::CreateProxyService(
io_thread->net_log(),
io_thread_globals->proxy_script_fetcher_context.get(),
- profile_params_->proxy_config_service.release(),
+ proxy_config_service,
command_line));
transport_security_state_.reset(new net::TransportSecurityState());
@@ -677,6 +692,8 @@ void ProfileIOData::ShutdownOnUIThread() {
if (url_blacklist_manager_.get())
url_blacklist_manager_->ShutdownOnUIThread();
#endif
+ if (proxy_service_.get())
+ proxy_service_->StartTearDown();
bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this);
if (!posted)
delete this;

Powered by Google App Engine
This is Rietveld 408576698