summaryrefslogtreecommitdiffstats
path: root/chrome/browser/in_process_webkit/webkit_thread.cc
diff options
context:
space:
mode:
authorchase@chromium.org <chase@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-25 19:45:43 +0000
committerchase@chromium.org <chase@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-25 19:45:43 +0000
commitd2e666f0c76155df85618ebaea650115a967a8d8 (patch)
tree1c8284215a951c4ce7a1a42b0aaf41e3e3647796 /chrome/browser/in_process_webkit/webkit_thread.cc
parentd87e22959669aacbf9b5a3c5b6010327050c498a (diff)
downloadchromium_src-d2e666f0c76155df85618ebaea650115a967a8d8.zip
chromium_src-d2e666f0c76155df85618ebaea650115a967a8d8.tar.gz
chromium_src-d2e666f0c76155df85618ebaea650115a967a8d8.tar.bz2
Revert "RESUBMIT of http://codereview.chromium.org/404025/show"
There is a flaky failure in Linux startup tests that started appearing after r33063 landed. Try backing out r33063 to see if this CL is the cause. BUG=24144 TEST=linux startup tests pass TBR=jorlow Review URL: http://codereview.chromium.org/441020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33101 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/in_process_webkit/webkit_thread.cc')
-rw-r--r--chrome/browser/in_process_webkit/webkit_thread.cc31
1 files changed, 18 insertions, 13 deletions
diff --git a/chrome/browser/in_process_webkit/webkit_thread.cc b/chrome/browser/in_process_webkit/webkit_thread.cc
index c3ad81f..6311140 100644
--- a/chrome/browser/in_process_webkit/webkit_thread.cc
+++ b/chrome/browser/in_process_webkit/webkit_thread.cc
@@ -9,7 +9,9 @@
#include "chrome/common/chrome_switches.h"
#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
+// This happens on the UI thread before the IO thread has been shut down.
WebKitThread::WebKitThread() {
+ // The thread is started lazily by InitializeThread() on the IO thread.
}
// This happens on the UI thread after the IO thread has been shut down.
@@ -21,19 +23,11 @@ WebKitThread::~WebKitThread() {
DCHECK(!ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
}
-void WebKitThread::Initialize() {
- DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
- DCHECK(!webkit_thread_.get());
-
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) {
- // TODO(jorlow): This thread should be used (and started) in single process
- // mode rather than following different code paths.
+void WebKitThread::EnsureInitialized() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
+ if (webkit_thread_.get())
return;
- }
-
- webkit_thread_.reset(new InternalWebKitThread);
- bool started = webkit_thread_->Start();
- DCHECK(started);
+ InitializeThread();
}
WebKitThread::InternalWebKitThread::InternalWebKitThread()
@@ -49,10 +43,21 @@ void WebKitThread::InternalWebKitThread::Init() {
webkit_client_.reset(new BrowserWebKitClientImpl);
WebKit::initialize(webkit_client_.get());
// If possible, post initialization tasks to this thread (rather than doing
- // them now) so we don't block the UI thread any longer than we have to.
+ // them now) so we don't block the IO thread any longer than we have to.
}
void WebKitThread::InternalWebKitThread::CleanUp() {
DCHECK(webkit_client_.get());
WebKit::shutdown();
}
+
+MessageLoop* WebKitThread::InitializeThread() {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess))
+ return NULL;
+
+ DCHECK(!webkit_thread_.get());
+ webkit_thread_.reset(new InternalWebKitThread);
+ bool started = webkit_thread_->Start();
+ DCHECK(started);
+ return webkit_thread_->message_loop();
+}