Title: [106044] trunk/Source/WebKit/chromium
- Revision
- 106044
- Author
- [email protected]
- Date
- 2012-01-26 14:26:23 -0800 (Thu, 26 Jan 2012)
Log Message
[chromium] Add enter/exitRunLoop to WebThread API
https://bugs.webkit.org/show_bug.cgi?id=76012
Reviewed by Darin Fisher.
This adds those two APIs to WebKit::WebThread and converts CCLayerTreeHostTest over to use these APIs instead
of webkit_support. The immediate motivation is that we can't use webkit_support in webkit_unit_tests in the
component build.
* WebKit.gyp:
* public/platform/WebThread.h:
* tests/CCLayerTreeHostTest.cpp:
(WTF::CCLayerTreeHostTest::onEndTest):
(WTF::CCLayerTreeHostTest::TimeoutTask::run):
(WTF::CCLayerTreeHostTest::BeginTask::BeginTask):
(WTF::CCLayerTreeHostTest::BeginTask::~BeginTask):
(WTF::CCLayerTreeHostTest::BeginTask::run):
(WTF::CCLayerTreeHostTest::runTest):
Modified Paths
Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (106043 => 106044)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-01-26 22:24:10 UTC (rev 106043)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-01-26 22:26:23 UTC (rev 106044)
@@ -1,3 +1,24 @@
+2012-01-10 James Robinson <[email protected]>
+
+ [chromium] Add enter/exitRunLoop to WebThread API
+ https://bugs.webkit.org/show_bug.cgi?id=76012
+
+ Reviewed by Darin Fisher.
+
+ This adds those two APIs to WebKit::WebThread and converts CCLayerTreeHostTest over to use these APIs instead
+ of webkit_support. The immediate motivation is that we can't use webkit_support in webkit_unit_tests in the
+ component build.
+
+ * WebKit.gyp:
+ * public/platform/WebThread.h:
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTest::onEndTest):
+ (WTF::CCLayerTreeHostTest::TimeoutTask::run):
+ (WTF::CCLayerTreeHostTest::BeginTask::BeginTask):
+ (WTF::CCLayerTreeHostTest::BeginTask::~BeginTask):
+ (WTF::CCLayerTreeHostTest::BeginTask::run):
+ (WTF::CCLayerTreeHostTest::runTest):
+
2012-01-26 John Bates <[email protected]>
Roll chromium_rev to 119248
Modified: trunk/Source/WebKit/chromium/WebKit.gyp (106043 => 106044)
--- trunk/Source/WebKit/chromium/WebKit.gyp 2012-01-26 22:24:10 UTC (rev 106043)
+++ trunk/Source/WebKit/chromium/WebKit.gyp 2012-01-26 22:26:23 UTC (rev 106044)
@@ -736,7 +736,6 @@
# These tests depend on webkit_support and
# functions defined only in !WEBKIT_IMPLEMENTATION.
'tests/AssociatedURLLoaderTest.cpp',
- 'tests/CCLayerTreeHostTest.cpp',
'tests/FrameTestHelpers.cpp',
'tests/PopupMenuTest.cpp',
'tests/RenderTableCellTest.cpp',
Modified: trunk/Source/WebKit/chromium/public/platform/WebThread.h (106043 => 106044)
--- trunk/Source/WebKit/chromium/public/platform/WebThread.h 2012-01-26 22:24:10 UTC (rev 106043)
+++ trunk/Source/WebKit/chromium/public/platform/WebThread.h 2012-01-26 22:26:23 UTC (rev 106044)
@@ -51,9 +51,19 @@
virtual void postTask(Task*) = 0;
virtual void postDelayedTask(Task*, long long delayMs) = 0;
+
virtual void addTaskObserver(TaskObserver*) { }
virtual void removeTaskObserver(TaskObserver*) { }
+ // enterRunLoop() processes tasks posted to this WebThread. This call does not return until some task calls exitRunLoop().
+ // WebThread does not support nesting, meaning that once the run loop is entered for a given WebThread it is not valid to
+ // call enterRunLoop() again.
+ virtual void enterRunLoop() = 0;
+
+ // exitRunLoop() runs tasks until there are no tasks available to run, then returns control to the caller of enterRunLoop().
+ // Must be called when the WebThread is running.
+ virtual void exitRunLoop() = 0;
+
virtual ~WebThread() { }
};
Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (106043 => 106044)
--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-01-26 22:24:10 UTC (rev 106043)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-01-26 22:26:23 UTC (rev 106044)
@@ -42,7 +42,6 @@
#include "platform/WebThread.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-#include <webkit/support/webkit_support.h>
#include <wtf/MainThread.h>
#include <wtf/PassRefPtr.h>
#include <wtf/Vector.h>
@@ -298,16 +297,10 @@
void doBeginTest();
- static void onBeginTest(void* self)
- {
- static_cast<CCLayerTreeHostTest*>(self)->doBeginTest();
- }
-
static void onEndTest(void* self)
{
ASSERT(isMainThread());
- webkit_support::QuitMessageLoop();
- webkit_support::RunAllPendingMessages();
+ webKitPlatformSupport()->currentThread()->exitRunLoop();
}
static void dispatchSetNeedsAnimate(void* self)
@@ -366,7 +359,7 @@
test->m_layerTreeHost->setVisible(false);
}
- class TimeoutTask : public webkit_support::TaskAdaptor {
+ class TimeoutTask : public WebThread::Task {
public:
explicit TimeoutTask(CCLayerTreeHostTest* test)
: m_test(test)
@@ -384,7 +377,7 @@
m_test->clearTimeout();
}
- virtual void Run()
+ virtual void run()
{
if (m_test)
m_test->timeout();
@@ -394,6 +387,22 @@
CCLayerTreeHostTest* m_test;
};
+ class BeginTask : public WebThread::Task {
+ public:
+ explicit BeginTask(CCLayerTreeHostTest* test)
+ : m_test(test)
+ {
+ }
+
+ virtual ~BeginTask() { }
+ virtual void run()
+ {
+ m_test->doBeginTest();
+ }
+ private:
+ CCLayerTreeHostTest* m_test;
+ };
+
virtual void runTest(bool threaded)
{
if (threaded) {
@@ -405,11 +414,11 @@
ASSERT(CCProxy::isMainThread());
m_mainThreadProxy = CCScopedThreadProxy::create(CCProxy::mainThread());
- webkit_support::PostDelayedTask(CCLayerTreeHostTest::onBeginTest, static_cast<void*>(this), 0);
+ m_beginTask = new BeginTask(this);
+ webKitPlatformSupport()->currentThread()->postDelayedTask(m_beginTask, 0); // postDelayedTask takes ownership of the task
m_timeoutTask = new TimeoutTask(this);
- webkit_support::PostDelayedTask(m_timeoutTask, 5000); // webkit_support takes ownership of the task
- webkit_support::RunMessageLoop();
- webkit_support::RunAllPendingMessages();
+ webKitPlatformSupport()->currentThread()->postDelayedTask(m_timeoutTask, 5000);
+ webKitPlatformSupport()->currentThread()->enterRunLoop();
if (m_layerTreeHost && m_layerTreeHost->rootLayer())
m_layerTreeHost->rootLayer()->setLayerTreeHost(0);
@@ -441,6 +450,7 @@
OwnPtr<WebThread> m_webThread;
RefPtr<CCScopedThreadProxy> m_mainThreadProxy;
TimeoutTask* m_timeoutTask;
+ BeginTask* m_beginTask;
};
void CCLayerTreeHostTest::doBeginTest()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes