summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-20 23:53:07 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-20 23:53:07 +0000
commitbe9f308e84cf78ead9a1a64fec10a51c36bb0074 (patch)
tree4ee7f7b03c37ae311193d482c4618087de2b427e /webkit
parent1a7cb56cd60e0ccdc0135bead6f12a07f7dedd35 (diff)
downloadchromium_src-be9f308e84cf78ead9a1a64fec10a51c36bb0074.zip
chromium_src-be9f308e84cf78ead9a1a64fec10a51c36bb0074.tar.gz
chromium_src-be9f308e84cf78ead9a1a64fec10a51c36bb0074.tar.bz2
Add support for Run, Quit, and RunAllPending to WebKit::WebThread
BUG=none Review URL: https://chromiumcodereview.appspot.com/9167034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118548 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/webthread_impl.cc24
-rw-r--r--webkit/glue/webthread_impl.h16
2 files changed, 35 insertions, 5 deletions
diff --git a/webkit/glue/webthread_impl.cc b/webkit/glue/webthread_impl.cc
index 439137f..5648be0 100644
--- a/webkit/glue/webthread_impl.cc
+++ b/webkit/glue/webthread_impl.cc
@@ -70,6 +70,18 @@ void WebThreadImpl::postDelayedTask(
base::TimeDelta::FromMilliseconds(delay_ms));
}
+void WebThreadImpl::enterRunLoop() {
+ CHECK(IsCurrentThread());
+ CHECK(!thread_->message_loop()->is_running()); // We don't support nesting.
+ thread_->message_loop()->Run();
+}
+
+void WebThreadImpl::exitRunLoop() {
+ CHECK(IsCurrentThread());
+ CHECK(thread_->message_loop()->is_running());
+ thread_->message_loop()->Quit();
+}
+
bool WebThreadImpl::IsCurrentThread() const {
return thread_->thread_id() == base::PlatformThread::CurrentId();
}
@@ -96,6 +108,18 @@ void WebThreadImplForMessageLoop::postDelayedTask(
delay_ms);
}
+void WebThreadImplForMessageLoop::enterRunLoop() {
+ CHECK(IsCurrentThread());
+ CHECK(!MessageLoop::current()->is_running()); // We don't support nesting.
+ MessageLoop::current()->Run();
+}
+
+void WebThreadImplForMessageLoop::exitRunLoop() {
+ CHECK(IsCurrentThread());
+ CHECK(MessageLoop::current()->is_running());
+ MessageLoop::current()->Quit();
+}
+
bool WebThreadImplForMessageLoop::IsCurrentThread() const {
return message_loop_->BelongsToCurrentThread();
}
diff --git a/webkit/glue/webthread_impl.h b/webkit/glue/webthread_impl.h
index e39d6bf..9873686 100644
--- a/webkit/glue/webthread_impl.h
+++ b/webkit/glue/webthread_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef WEBKIT_GLUE_WEBTHREAD_IMPL_H_
@@ -37,8 +37,11 @@ class WebThreadImpl : public WebThreadBase {
WEBKIT_GLUE_EXPORT explicit WebThreadImpl(const char* name);
WEBKIT_GLUE_EXPORT virtual ~WebThreadImpl();
- virtual void postTask(Task* task) OVERRIDE;
- virtual void postDelayedTask(Task* task, long long delay_ms) OVERRIDE;
+ virtual void postTask(Task* task);
+ virtual void postDelayedTask(Task* task, long long delay_ms);
+
+ virtual void enterRunLoop();
+ virtual void exitRunLoop();
MessageLoop* message_loop() const { return thread_->message_loop(); }
@@ -52,8 +55,11 @@ class WebThreadImplForMessageLoop : public WebThreadBase {
explicit WebThreadImplForMessageLoop(base::MessageLoopProxy* message_loop);
virtual ~WebThreadImplForMessageLoop();
- virtual void postTask(Task* task) OVERRIDE;
- virtual void postDelayedTask(Task* task, long long delay_ms) OVERRIDE;
+ virtual void postTask(Task* task);
+ virtual void postDelayedTask(Task* task, long long delay_ms);
+
+ virtual void enterRunLoop();
+ virtual void exitRunLoop();
private:
virtual bool IsCurrentThread() const OVERRIDE;