From a5e73b82ea201491089a17bb90fed0ca45e38a56 Mon Sep 17 00:00:00 2001 From: "mariakhomenko@chromium.org" <mariakhomenko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> Date: Wed, 17 Jul 2013 08:58:39 +0000 Subject: 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 --- content/browser/browser_thread_impl.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'content/browser/browser_thread_impl.cc') 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 -- cgit v1.1