Diff
Modified: trunk/Source/WebCore/ChangeLog (97689 => 97690)
--- trunk/Source/WebCore/ChangeLog 2011-10-18 01:12:46 UTC (rev 97689)
+++ trunk/Source/WebCore/ChangeLog 2011-10-18 01:15:14 UTC (rev 97690)
@@ -1,3 +1,33 @@
+2011-10-17 James Robinson <jam...@chromium.org>
+
+ [chromium] Fix shutdown race when posting main thread task to CCThreadProxy and enable tests
+ https://bugs.webkit.org/show_bug.cgi?id=70161
+
+ Reviewed by David Levin.
+
+ Adds a weak pointer mechanism to cancel main thread tasks posted to CCThreadProxy instances from the compositor
+ thread. Previously there was a race condition where main thread tasks could run even after the CCThreadProxy was
+ destroyed.
+
+ This race does not exist in the other direction because when tearing down a CCThreadProxy we first post a quit
+ task to the compositor thread and then suspend execution of the main thread until all compositor tasks for the
+ CCThreadProxy have been drained.
+
+ Covered by the now-enabled CCLayerTreeHostTest* unit tests.
+
+ * WebCore.gypi:
+ * platform/graphics/chromium/cc/CCScopedMainThreadProxy.h: Added.
+ (WebCore::CCScopedMainThreadProxy::create):
+ (WebCore::CCScopedMainThreadProxy::postTask):
+ (WebCore::CCScopedMainThreadProxy::shutdown):
+ (WebCore::CCScopedMainThreadProxy::CCScopedMainThreadProxy):
+ (WebCore::CCScopedMainThreadProxy::runTaskIfNotShutdown):
+ * platform/graphics/chromium/cc/CCThreadProxy.cpp:
+ (WebCore::CCThreadProxy::CCThreadProxy):
+ (WebCore::CCThreadProxy::~CCThreadProxy):
+ (WebCore::CCThreadProxy::createBeginFrameAndCommitTaskOnCCThread):
+ * platform/graphics/chromium/cc/CCThreadProxy.h:
+
2011-10-17 Sheriff Bot <webkit.review....@gmail.com>
Unreviewed, rolling out r97641.
Modified: trunk/Source/WebCore/WebCore.gypi (97689 => 97690)
--- trunk/Source/WebCore/WebCore.gypi 2011-10-18 01:12:46 UTC (rev 97689)
+++ trunk/Source/WebCore/WebCore.gypi 2011-10-18 01:15:14 UTC (rev 97690)
@@ -3538,6 +3538,8 @@
'platform/graphics/chromium/cc/CCRenderSurface.h',
'platform/graphics/chromium/cc/CCScheduler.cpp',
'platform/graphics/chromium/cc/CCScheduler.h',
+ 'platform/graphics/chromium/cc/CCScopedMainThreadProxy.h',
+ 'platform/graphics/chromium/cc/CCScrollController.h',
'platform/graphics/chromium/cc/CCSingleThreadProxy.cpp',
'platform/graphics/chromium/cc/CCSingleThreadProxy.h',
'platform/graphics/chromium/cc/CCThread.h',
@@ -3548,7 +3550,6 @@
'platform/graphics/chromium/cc/CCTiledLayerImpl.h',
'platform/graphics/chromium/cc/CCVideoLayerImpl.cpp',
'platform/graphics/chromium/cc/CCVideoLayerImpl.h',
- 'platform/graphics/chromium/cc/CCScrollController.h',
'platform/graphics/cocoa/FontPlatformDataCocoa.mm',
'platform/graphics/efl/FontEfl.cpp',
'platform/graphics/efl/IconEfl.cpp',
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCMainThread.h (97689 => 97690)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCMainThread.h 2011-10-18 01:12:46 UTC (rev 97689)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCMainThread.h 2011-10-18 01:15:14 UTC (rev 97690)
@@ -29,7 +29,10 @@
namespace WebCore {
+class CCScopedMainThreadProxy;
+
// Task wrapper around WTF::callOnMainThreadThread
+// To post a Task to run on the main thread, see CCScopedMainThreadProxy.
class CCMainThread {
public:
class Task {
@@ -44,8 +47,12 @@
};
static void initialize();
- static void postTask(PassOwnPtr<Task>); // Executes the task on main thread asynchronously.
private:
+ friend class CCScopedMainThreadProxy;
+ // Executes the task on main thread asynchronously.
+ // Only visible to CCScopedMainThreadProxy.
+ static void postTask(PassOwnPtr<Task>);
+
static void performTask(void*);
};
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCMainThreadTask.h (97689 => 97690)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCMainThreadTask.h 2011-10-18 01:12:46 UTC (rev 97689)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCMainThreadTask.h 2011-10-18 01:15:14 UTC (rev 97690)
@@ -243,11 +243,6 @@
template<typename T>
PassOwnPtr<CCMainThread::Task> createMainThreadTask(
T* const callee,
- void (T::*method)());
-
-template<typename T>
-PassOwnPtr<CCMainThread::Task> createMainThreadTask(
- T* const callee,
void (T::*method)())
{
return MainThreadTask0<T>::create(
Added: trunk/Source/WebCore/platform/graphics/chromium/cc/CCScopedMainThreadProxy.h (0 => 97690)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCScopedMainThreadProxy.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCScopedMainThreadProxy.h 2011-10-18 01:15:14 UTC (rev 97690)
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CCScopedMainThreadProxy_h
+#define CCScopedMainThreadProxy_h
+
+#include "cc/CCMainThreadTask.h"
+#include "cc/CCProxy.h"
+#include <wtf/ThreadSafeRefCounted.h>
+
+namespace WebCore {
+
+// This class is a proxy used to post tasks to the main thread from any other thread. The proxy may be shut down at
+// any point from the main thread after which no more tasks posted to the proxy will run. In other words, all
+// tasks posted via a proxy are scoped to the lifecycle of the proxy. Use this when posting tasks to an object that
+// might die with tasks in flight.
+//
+// The proxy must be created and shut down from the main thread, tasks may be posted from any thread.
+//
+// Implementation note: Unlike ScopedRunnableMethodFactory in Chromium, pending tasks are not cancelled by actually
+// destroying the proxy. Instead each pending task holds a reference to the proxy to avoid maintaining an explicit
+// list of outstanding tasks.
+class CCScopedMainThreadProxy : public ThreadSafeRefCounted<CCScopedMainThreadProxy> {
+public:
+ static PassRefPtr<CCScopedMainThreadProxy> create()
+ {
+ ASSERT(CCProxy::isMainThread());
+ return adoptRef(new CCScopedMainThreadProxy);
+ }
+
+ // Can be called from any thread. Posts a task to the main thread that runs unless
+ // shutdown() is called before it runs.
+ void postTask(PassOwnPtr<CCMainThread::Task> task)
+ {
+ ref();
+ CCMainThread::postTask(createMainThreadTask(this, &CCScopedMainThreadProxy::runTaskIfNotShutdown, task));
+ }
+
+ void shutdown()
+ {
+ ASSERT(CCProxy::isMainThread());
+ ASSERT(!m_shutdown);
+ m_shutdown = true;
+ }
+
+private:
+ CCScopedMainThreadProxy()
+ : m_shutdown(false)
+ {
+ }
+
+ void runTaskIfNotShutdown(PassOwnPtr<CCMainThread::Task> popTask)
+ {
+ ASSERT(CCProxy::isMainThread());
+ OwnPtr<CCMainThread::Task> task = popTask;
+ if (!m_shutdown)
+ task->performTask();
+ deref();
+ }
+
+ bool m_shutdown; // Only accessed on the main thread
+};
+
+}
+
+#endif
Property changes on: trunk/Source/WebCore/platform/graphics/chromium/cc/CCScopedMainThreadProxy.h
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp (97689 => 97690)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp 2011-10-18 01:12:46 UTC (rev 97689)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp 2011-10-18 01:15:14 UTC (rev 97690)
@@ -32,6 +32,7 @@
#include "cc/CCLayerTreeHost.h"
#include "cc/CCMainThreadTask.h"
#include "cc/CCScheduler.h"
+#include "cc/CCScopedMainThreadProxy.h"
#include "cc/CCScrollController.h"
#include "cc/CCThreadTask.h"
#include <wtf/CurrentTime.h>
@@ -61,7 +62,7 @@
virtual void scheduleBeginFrameAndCommit()
{
- CCMainThread::postTask(m_proxy->createBeginFrameAndCommitTaskOnCCThread());
+ m_proxy->postBeginFrameAndCommitOnCCThread();
}
virtual void scheduleDrawAndPresent()
@@ -114,6 +115,7 @@
, m_started(false)
, m_lastExecutedBeginFrameAndCommitSequenceNumber(-1)
, m_numBeginFrameAndCommitsIssuedOnCCThread(0)
+ , m_mainThreadProxy(CCScopedMainThreadProxy::create())
{
TRACE_EVENT("CCThreadProxy::CCThreadProxy", this, 0);
ASSERT(isMainThread());
@@ -299,6 +301,8 @@
s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::layerTreeHostClosedOnCCThread, AllowCrossThreadAccess(&completion)));
completion.wait();
+ m_mainThreadProxy->shutdown(); // Stop running tasks posted to us.
+
ASSERT(!m_layerTreeHostImpl); // verify that the impl deleted.
m_layerTreeHost = 0;
m_started = false;
@@ -317,6 +321,11 @@
completion->signal();
}
+void CCThreadProxy::postBeginFrameAndCommitOnCCThread()
+{
+ m_mainThreadProxy->postTask(createBeginFrameAndCommitTaskOnCCThread());
+}
+
void CCThreadProxy::obtainBeginFrameAndCommitTaskFromCCThread(CCCompletionEvent* completion, CCMainThread::Task** taskPtr)
{
OwnPtr<CCMainThread::Task> task = createBeginFrameAndCommitTaskOnCCThread();
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h (97689 => 97690)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h 2011-10-18 01:12:46 UTC (rev 97689)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h 2011-10-18 01:15:14 UTC (rev 97690)
@@ -36,6 +36,7 @@
class CCInputHandler;
class CCLayerTreeHost;
class CCScheduler;
+class CCScopedMainThreadProxy;
class CCThread;
class CCThreadProxySchedulerClient;
class CCThreadProxyScrollControllerAdapter;
@@ -72,6 +73,7 @@
void beginFrameAndCommit(int sequenceNumber, double frameBeginTime, PassOwnPtr<CCScrollUpdateSet>);
// Called on CCThread
+ void postBeginFrameAndCommitOnCCThread();
PassOwnPtr<CCMainThread::Task> createBeginFrameAndCommitTaskOnCCThread();
void obtainBeginFrameAndCommitTaskFromCCThread(CCCompletionEvent*, CCMainThread::Task**);
void commitOnCCThread(CCCompletionEvent*);
@@ -105,6 +107,8 @@
OwnPtr<CCScheduler> m_schedulerOnCCThread;
OwnPtr<CCThreadProxySchedulerClient> m_schedulerClientOnCCThread;
+ RefPtr<CCScopedMainThreadProxy> m_mainThreadProxy;
+
static CCThread* s_ccThread;
};
Modified: trunk/Source/WebKit/chromium/ChangeLog (97689 => 97690)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-10-18 01:12:46 UTC (rev 97689)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-10-18 01:15:14 UTC (rev 97690)
@@ -1,3 +1,28 @@
+2011-10-17 James Robinson <jam...@chromium.org>
+
+ [chromium] Fix shutdown race when posting main thread task to CCThreadProxy and enable tests
+ https://bugs.webkit.org/show_bug.cgi?id=70161
+
+ Reviewed by David Levin.
+
+ Enables the CCLayerTreeHostTest* tests by default. Most tests are run twice in a single thread and multiple
+ thread configuration. Some tests run only in the multiple thread configuration if they depend on the compositor
+ thread scheduling draws by itself.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (::CCLayerTreeHostTest::timeout):
+ (::CCLayerTreeHostTest::clearTimeout):
+ (::CCLayerTreeHostTest::CCLayerTreeHostTest):
+ (::CCLayerTreeHostTest::onEndTest):
+ (::CCLayerTreeHostTest::TimeoutTask::TimeoutTask):
+ (::CCLayerTreeHostTest::TimeoutTask::clearTest):
+ (::CCLayerTreeHostTest::TimeoutTask::~TimeoutTask):
+ (::CCLayerTreeHostTest::TimeoutTask::Run):
+ (::CCLayerTreeHostTest::runTest):
+ (::CCLayerTreeHostTest::doBeginTest):
+ (::CCLayerTreeHostTestThreadOnly::runTest):
+ (::CCLayerTreeHostTestSetNeedsRedraw::commitCompleteOnCCThread):
+
2011-10-17 Alok Priyadarshi <al...@chromium.org>
Add layout tests for WebPlugin compositor path
Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (97689 => 97690)
--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2011-10-18 01:12:46 UTC (rev 97689)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2011-10-18 01:15:14 UTC (rev 97690)
@@ -24,13 +24,12 @@
#include "config.h"
-#if USE(THREADED_COMPOSITING)
-
#include "cc/CCLayerTreeHost.h"
#include "cc/CCLayerImpl.h"
#include "cc/CCLayerTreeHostImpl.h"
#include "cc/CCMainThreadTask.h"
+#include "cc/CCScopedMainThreadProxy.h"
#include "cc/CCThreadTask.h"
#include "GraphicsContext3DPrivate.h"
#include <gtest/gtest.h>
@@ -170,9 +169,7 @@
{
}
-#if !USE(THREADED_COMPOSITING)
virtual void scheduleComposite() { }
-#endif
private:
explicit MockLayerTreeHostClient(TestHooks* testHooks) : m_testHooks(testHooks) { }
@@ -207,20 +204,27 @@
callOnMainThread(CCLayerTreeHostTest::dispatchSetNeedsRedraw, this);
}
+ void timeout()
+ {
+ m_timedOut = true;
+ endTest();
+ }
+
+ void clearTimeout()
+ {
+ m_timeoutTask = 0;
+ }
+
+
protected:
CCLayerTreeHostTest()
: m_beginning(false)
, m_endWhenBeginReturns(false)
- , m_running(false)
, m_timedOut(false)
+ , m_mainThreadProxy(CCScopedMainThreadProxy::create())
{
m_webThread = adoptPtr(webKitPlatformSupport()->createThread("CCLayerTreeHostTest"));
WebCompositor::setThread(m_webThread.get());
-#if USE(THREADED_COMPOSITING)
- m_settings.enableCompositorThread = true;
-#else
- m_settings.enableCompositorThread = false;
-#endif
}
void doBeginTest();
@@ -234,6 +238,7 @@
{
ASSERT(isMainThread());
webkit_support::QuitMessageLoop();
+ webkit_support::RunAllPendingMessages();
CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
ASSERT(test);
test->m_layerTreeHost.clear();
@@ -257,32 +262,55 @@
test->m_layerTreeHost->setNeedsRedraw();
}
- virtual void runTest()
+ class TimeoutTask : public webkit_support::TaskAdaptor {
+ public:
+ explicit TimeoutTask(CCLayerTreeHostTest* test)
+ : m_test(test)
+ {
+ }
+
+ void clearTest()
+ {
+ m_test = 0;
+ }
+
+ virtual ~TimeoutTask()
+ {
+ if (m_test)
+ m_test->clearTimeout();
+ }
+
+ virtual void Run()
+ {
+ if (m_test)
+ m_test->timeout();
+ }
+
+ private:
+ CCLayerTreeHostTest* m_test;
+ };
+
+ virtual void runTest(bool threaded)
{
+ m_settings.enableCompositorThread = threaded;
webkit_support::PostDelayedTask(CCLayerTreeHostTest::onBeginTest, static_cast<void*>(this), 0);
- webkit_support::PostDelayedTask(CCLayerTreeHostTest::testTimeout, static_cast<void*>(this), 5000);
+ m_timeoutTask = new TimeoutTask(this);
+ webkit_support::PostDelayedTask(m_timeoutTask, 5000); // webkit_support takes ownership of the task
webkit_support::RunMessageLoop();
- m_running = false;
- bool timedOut = m_timedOut; // Save whether we're timed out in case RunAllPendingMessages has the timeout.
webkit_support::RunAllPendingMessages();
+
+ if (m_timeoutTask)
+ m_timeoutTask->clearTest();
+
ASSERT(!m_layerTreeHost.get());
m_client.clear();
- if (timedOut) {
+ if (m_timedOut) {
FAIL() << "Test timed out";
return;
}
afterTest();
}
- static void testTimeout(void* self)
- {
- CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
- if (!test->m_running)
- return;
- test->m_timedOut = true;
- test->endTest();
- }
-
CCSettings m_settings;
OwnPtr<MockLayerTreeHostClient> m_client;
RefPtr<CCLayerTreeHost> m_layerTreeHost;
@@ -290,17 +318,16 @@
private:
bool m_beginning;
bool m_endWhenBeginReturns;
- bool m_running;
bool m_timedOut;
OwnPtr<WebThread> m_webThread;
+ RefPtr<CCScopedMainThreadProxy> m_mainThreadProxy;
+ TimeoutTask* m_timeoutTask;
};
void CCLayerTreeHostTest::doBeginTest()
{
ASSERT(isMainThread());
- ASSERT(!m_running);
- m_running = true;
m_client = MockLayerTreeHostClient::create(this);
RefPtr<LayerChromium> rootLayer = LayerChromium::create(0);
@@ -318,7 +345,7 @@
{
// If we are called from the CCThread, re-call endTest on the main thread.
if (!isMainThread())
- CCMainThread::postTask(createMainThreadTask(this, &CCLayerTreeHostTest::endTest));
+ m_mainThreadProxy->postTask(createMainThreadTask(this, &CCLayerTreeHostTest::endTest));
else {
// For the case where we endTest during beginTest(), set a flag to indicate that
// the test should end the second beginTest regains control.
@@ -331,10 +358,9 @@
class CCLayerTreeHostTestThreadOnly : public CCLayerTreeHostTest {
public:
- virtual void runTest()
+ void runTest()
{
- if (m_settings.enableCompositorThread)
- CCLayerTreeHostTest::runTest();
+ CCLayerTreeHostTest::runTest(true);
}
};
@@ -352,11 +378,19 @@
{
}
};
-TEST_F(CCLayerTreeHostTestShortlived1, run)
-{
- runTest();
-}
+#define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \
+ TEST_F(TEST_FIXTURE_NAME, runSingleThread) \
+ { \
+ runTest(false); \
+ } \
+ TEST_F(TEST_FIXTURE_NAME, runMultiThread) \
+ { \
+ runTest(true); \
+ }
+
+SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestShortlived1)
+
// Shortlived layerTreeHosts shouldn't die with a commit in flight.
class CCLayerTreeHostTestShortlived2 : public CCLayerTreeHostTest {
public:
@@ -372,11 +406,9 @@
{
}
};
-TEST_F(CCLayerTreeHostTestShortlived2, run)
-{
- runTest();
-}
+SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestShortlived2)
+
// Shortlived layerTreeHosts shouldn't die with a redraw in flight.
class CCLayerTreeHostTestShortlived3 : public CCLayerTreeHostTest {
public:
@@ -392,11 +424,9 @@
{
}
};
-TEST_F(CCLayerTreeHostTestShortlived3, run)
-{
- runTest();
-}
+SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestShortlived3)
+
// Constantly redrawing layerTreeHosts shouldn't die when they commit
class CCLayerTreeHostTestCommitingWithContinuousRedraw : public CCLayerTreeHostTest {
public:
@@ -435,14 +465,12 @@
int m_numCompleteCommits;
int m_numDraws;
};
-TEST_F(CCLayerTreeHostTestCommitingWithContinuousRedraw, run)
-{
- runTest();
-}
+SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestCommitingWithContinuousRedraw)
+
// Two setNeedsCommits in a row should lead to at least 1 commit and at least 1
// draw with frame 0.
-class CCLayerTreeHostTestSetNeedsCommit1 : public CCLayerTreeHostTest {
+class CCLayerTreeHostTestSetNeedsCommit1 : public CCLayerTreeHostTestThreadOnly {
public:
CCLayerTreeHostTestSetNeedsCommit1()
: m_numCommits(0)
@@ -478,14 +506,15 @@
int m_numCommits;
int m_numDraws;
};
-TEST_F(CCLayerTreeHostTestSetNeedsCommit1, run)
+
+TEST_F(CCLayerTreeHostTestSetNeedsCommit1, runMultiThread)
{
runTest();
}
// A setNeedsCommit should lead to 1 commit. Issuing a second commit after that
// first committed frame draws should lead to another commit.
-class CCLayerTreeHostTestSetNeedsCommit2 : public CCLayerTreeHostTest {
+class CCLayerTreeHostTestSetNeedsCommit2 : public CCLayerTreeHostTestThreadOnly {
public:
CCLayerTreeHostTestSetNeedsCommit2()
: m_numCommits(0)
@@ -521,14 +550,15 @@
int m_numCommits;
int m_numDraws;
};
-TEST_F(CCLayerTreeHostTestSetNeedsCommit2, run)
+
+TEST_F(CCLayerTreeHostTestSetNeedsCommit2, runMultiThread)
{
runTest();
}
// 1 setNeedsRedraw after the first commit has completed should lead to 1
// additional draw.
-class CCLayerTreeHostTestSetNeedsRedraw : public CCLayerTreeHostTest {
+class CCLayerTreeHostTestSetNeedsRedraw : public CCLayerTreeHostTestThreadOnly {
public:
CCLayerTreeHostTestSetNeedsRedraw()
: m_numCommits(0)
@@ -553,6 +583,7 @@
virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*)
{
+ EXPECT_EQ(0, m_numDraws);
m_numCommits++;
}
@@ -566,9 +597,9 @@
int m_numCommits;
int m_numDraws;
};
-TEST_F(CCLayerTreeHostTestSetNeedsRedraw, run)
+
+TEST_F(CCLayerTreeHostTestSetNeedsRedraw, runMultiThread)
{
- CCSettings setings;
runTest();
}
@@ -637,7 +668,8 @@
IntSize m_scrollAmount;
int m_scrolls;
};
-TEST_F(CCLayerTreeHostTestScrollSimple, run)
+
+TEST_F(CCLayerTreeHostTestScrollSimple, runMultiThread)
{
runTest();
}
@@ -710,11 +742,11 @@
IntSize m_scrollAmount;
int m_scrolls;
};
-TEST_F(CCLayerTreeHostTestScrollMultipleRedraw, run)
+
+TEST_F(CCLayerTreeHostTestScrollMultipleRedraw, runMultiThread)
{
runTest();
}
} // namespace
-#endif
Modified: trunk/Source/WebKit/chromium/tests/CCThreadTest.cpp (97689 => 97690)
--- trunk/Source/WebKit/chromium/tests/CCThreadTest.cpp 2011-10-18 01:12:46 UTC (rev 97689)
+++ trunk/Source/WebKit/chromium/tests/CCThreadTest.cpp 2011-10-18 01:15:14 UTC (rev 97690)
@@ -32,6 +32,7 @@
#include "WebThread.h"
#include "cc/CCCompletionEvent.h"
#include "cc/CCMainThreadTask.h"
+#include "cc/CCScopedMainThreadProxy.h"
#include "cc/CCThreadTask.h"
#include <gtest/gtest.h>
@@ -71,9 +72,14 @@
class PingPongTestUsingTasks {
public:
+ PingPongTestUsingTasks()
+ : m_mainThreadProxy(CCScopedMainThreadProxy::create())
+ {
+ }
+
void ping()
{
- CCMainThread::postTask(createMainThreadTask(this, &PingPongTestUsingTasks::pong));
+ m_mainThreadProxy->postTask(createMainThreadTask(this, &PingPongTestUsingTasks::pong));
hit = true;
}
@@ -84,6 +90,9 @@
}
bool hit;
+
+private:
+ RefPtr<CCScopedMainThreadProxy> m_mainThreadProxy;
};
#if OS(WINDOWS) || OS(MAC_OS_X)