summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_thread_impl.cc
diff options
context:
space:
mode:
authormariakhomenko@chromium.org <mariakhomenko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-17 08:58:39 +0000
committermariakhomenko@chromium.org <mariakhomenko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-17 08:58:39 +0000
commita5e73b82ea201491089a17bb90fed0ca45e38a56 (patch)
tree11f40c445f8838f45d626b906641e495889ce90a /content/browser/browser_thread_impl.cc
parent37b5e2f1f402b3a2f8372604c776d650b5ae90ff (diff)
downloadchromium_src-a5e73b82ea201491089a17bb90fed0ca45e38a56.zip
chromium_src-a5e73b82ea201491089a17bb90fed0ca45e38a56.tar.gz
chromium_src-a5e73b82ea201491089a17bb90fed0ca45e38a56.tar.bz2
Change BrowserThreadDelegate to run Init() async.
After this change Init() method will be run as the first task on the thread asynchronously from the UI thread initialization. This allows us to speed up the startup by making IOThread Init() a non-blocking task for the UI. Changes AwUrlRequestContextGetter to create a CookieMonster on UI thread since it needs to happen synchonously. BUG=258231 Review URL: https://chromiumcodereview.appspot.com/18618004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212003 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/browser_thread_impl.cc')
-rw-r--r--content/browser/browser_thread_impl.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/content/browser/browser_thread_impl.cc b/content/browser/browser_thread_impl.cc
index 4220114..0905f54 100644
--- a/content/browser/browser_thread_impl.cc
+++ b/content/browser/browser_thread_impl.cc
@@ -103,8 +103,14 @@ void BrowserThreadImpl::Init() {
AtomicWord stored_pointer = base::subtle::NoBarrier_Load(storage);
BrowserThreadDelegate* delegate =
reinterpret_cast<BrowserThreadDelegate*>(stored_pointer);
- if (delegate)
+ if (delegate) {
delegate->Init();
+ message_loop()->PostTask(FROM_HERE,
+ base::Bind(&BrowserThreadDelegate::InitAsync,
+ // Delegate is expected to exist for the
+ // duration of the thread's lifetime
+ base::Unretained(delegate)));
+ }
}
// We disable optimizations for this block of functions so the compiler doesn't