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

Unified Diff: chrome/browser/io_thread.cc

Issue 18618004: Change BrowserThreadDelegate to run Init() async. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 7 years, 5 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
« no previous file with comments | « chrome/browser/io_thread.h ('k') | content/browser/browser_thread_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/io_thread.cc
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 418e71a113746dca014ff24816acb21426730635..593b1535a9193ddd29c12088df666558a6da7bbe 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -464,7 +464,12 @@ net::URLRequestContextGetter* IOThread::system_url_request_context_getter() {
}
void IOThread::Init() {
- TRACE_EVENT0("startup", "IOThread::Init");
+ // Prefer to use InitAsync unless you need initialization to block
+ // the UI thread
+}
+
+void IOThread::InitAsync() {
+ TRACE_EVENT0("startup", "IOThread::InitAsync");
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
#if defined(USE_NSS) || defined(OS_IOS)
@@ -525,10 +530,10 @@ void IOThread::Init() {
globals_->http_user_agent_settings.reset(
new BasicHttpUserAgentSettings(std::string()));
if (command_line.HasSwitch(switches::kHostRules)) {
- TRACE_EVENT_BEGIN0("startup", "IOThread::Init:SetRulesFromString");
+ TRACE_EVENT_BEGIN0("startup", "IOThread::InitAsync:SetRulesFromString");
globals_->host_mapping_rules->SetRulesFromString(
command_line.GetSwitchValueASCII(switches::kHostRules));
- TRACE_EVENT_END0("startup", "IOThread::Init:SetRulesFromString");
+ TRACE_EVENT_END0("startup", "IOThread::InitAsync:SetRulesFromString");
}
if (command_line.HasSwitch(switches::kIgnoreCertificateErrors))
globals_->ignore_certificate_errors = true;
@@ -564,12 +569,12 @@ void IOThread::Init() {
session_params.proxy_service =
globals_->proxy_script_fetcher_proxy_service.get();
- TRACE_EVENT_BEGIN0("startup", "IOThread::Init:HttpNetworkSession");
+ TRACE_EVENT_BEGIN0("startup", "IOThread::InitAsync:HttpNetworkSession");
scoped_refptr<net::HttpNetworkSession> network_session(
new net::HttpNetworkSession(session_params));
globals_->proxy_script_fetcher_http_transaction_factory
.reset(new net::HttpNetworkLayer(network_session.get()));
- TRACE_EVENT_END0("startup", "IOThread::Init:HttpNetworkSession");
+ TRACE_EVENT_END0("startup", "IOThread::InitAsync:HttpNetworkSession");
scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
new net::URLRequestJobFactoryImpl());
job_factory->SetProtocolHandler(chrome::kDataScheme,
« no previous file with comments | « chrome/browser/io_thread.h ('k') | content/browser/browser_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698