Chromium Code Reviews| Index: cc/test/layer_tree_test_common.cc | 
| diff --git a/cc/test/layer_tree_test_common.cc b/cc/test/layer_tree_test_common.cc | 
| index 69e99471b849c5a3003324c8fd39d6c37b6ba3d4..00244735184528fd3604241909308939347ac24e 100644 | 
| --- a/cc/test/layer_tree_test_common.cc | 
| +++ b/cc/test/layer_tree_test_common.cc | 
| @@ -26,6 +26,7 @@ | 
| #include "cc/thread_task.h" | 
| #include "cc/timing_function.h" | 
| #include "testing/gmock/include/gmock/gmock.h" | 
| +#include "webkit/compositor_bindings/ccthread_impl.h" | 
| #include <public/Platform.h> | 
| #include <public/WebCompositorSupport.h> | 
| #include <public/WebFilterOperation.h> | 
| @@ -94,9 +95,9 @@ scoped_ptr<WebCompositorOutputSurface> TestHooks::createOutputSurface() | 
| return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3DWithTextureTracking::create(WebGraphicsContext3D::Attributes()).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<WebKit::WebCompositorOutputSurface>(); | 
| } | 
| -scoped_ptr<MockLayerTreeHostImpl> MockLayerTreeHostImpl::create(TestHooks* testHooks, const LayerTreeSettings& settings, LayerTreeHostImplClient* client) | 
| +scoped_ptr<MockLayerTreeHostImpl> MockLayerTreeHostImpl::create(TestHooks* testHooks, const LayerTreeSettings& settings, LayerTreeHostImplClient* client, Proxy* proxy) | 
| { | 
| - return make_scoped_ptr(new MockLayerTreeHostImpl(testHooks, settings, client)); | 
| + return make_scoped_ptr(new MockLayerTreeHostImpl(testHooks, settings, client, proxy)); | 
| } | 
| void MockLayerTreeHostImpl::beginCommit() | 
| @@ -137,8 +138,8 @@ base::TimeDelta MockLayerTreeHostImpl::lowFrequencyAnimationInterval() const | 
| return base::TimeDelta::FromMilliseconds(16); | 
| } | 
| -MockLayerTreeHostImpl::MockLayerTreeHostImpl(TestHooks* testHooks, const LayerTreeSettings& settings, LayerTreeHostImplClient* client) | 
| - : LayerTreeHostImpl(settings, client) | 
| +MockLayerTreeHostImpl::MockLayerTreeHostImpl(TestHooks* testHooks, const LayerTreeSettings& settings, LayerTreeHostImplClient* client, Proxy* proxy) | 
| + : LayerTreeHostImpl(settings, client, proxy) | 
| , m_testHooks(testHooks) | 
| { | 
| } | 
| @@ -146,10 +147,10 @@ MockLayerTreeHostImpl::MockLayerTreeHostImpl(TestHooks* testHooks, const LayerTr | 
| // Adapts LayerTreeHost for test. Injects MockLayerTreeHostImpl. | 
| class MockLayerTreeHost : public cc::LayerTreeHost { | 
| public: | 
| - static scoped_ptr<MockLayerTreeHost> create(TestHooks* testHooks, cc::LayerTreeHostClient* client, scoped_refptr<cc::Layer> rootLayer, const cc::LayerTreeSettings& settings) | 
| + static scoped_ptr<MockLayerTreeHost> create(TestHooks* testHooks, cc::LayerTreeHostClient* client, scoped_refptr<cc::Layer> rootLayer, const cc::LayerTreeSettings& settings, cc::Thread* implThread) | 
| { | 
| scoped_ptr<MockLayerTreeHost> layerTreeHost(new MockLayerTreeHost(testHooks, client, settings)); | 
| - bool success = layerTreeHost->initialize(); | 
| + bool success = layerTreeHost->initialize(implThread); | 
| EXPECT_TRUE(success); | 
| layerTreeHost->setRootLayer(rootLayer); | 
| @@ -163,7 +164,7 @@ public: | 
| virtual scoped_ptr<cc::LayerTreeHostImpl> createLayerTreeHostImpl(cc::LayerTreeHostImplClient* client) | 
| { | 
| - return MockLayerTreeHostImpl::create(m_testHooks, settings(), client).PassAs<cc::LayerTreeHostImpl>(); | 
| + return MockLayerTreeHostImpl::create(m_testHooks, settings(), client, proxy()).PassAs<cc::LayerTreeHostImpl>(); | 
| } | 
| virtual void didAddAnimation() OVERRIDE | 
| @@ -319,6 +320,7 @@ ThreadedTest::ThreadedTest() | 
| , m_finished(false) | 
| , m_scheduled(false) | 
| , m_started(false) | 
| + , m_implThread(0) | 
| { | 
| } | 
| @@ -390,11 +392,10 @@ void ThreadedTest::postDidAddAnimationToMainThread() | 
| void ThreadedTest::doBeginTest() | 
| { | 
| - DCHECK(Proxy::isMainThread()); | 
| 
 
danakj
2012/10/25 05:06:06
Why not call proxy()->isMainThread() etc for all t
 
 | 
| m_client = ThreadedMockLayerTreeHostClient::create(this); | 
| scoped_refptr<Layer> rootLayer = Layer::create(); | 
| - m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, m_settings); | 
| + m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, m_settings, m_implThread); | 
| ASSERT_TRUE(m_layerTreeHost.get()); | 
| rootLayer->setLayerTreeHost(m_layerTreeHost.get()); | 
| m_layerTreeHost->setSurfaceReady(); | 
| @@ -428,14 +429,11 @@ void ThreadedTest::scheduleComposite() | 
| void ThreadedTest::realEndTest() | 
| { | 
| - DCHECK(Proxy::isMainThread()); | 
| WebKit::Platform::current()->currentThread()->exitRunLoop(); | 
| } | 
| void ThreadedTest::dispatchSetNeedsAnimate() | 
| { | 
| - DCHECK(Proxy::isMainThread()); | 
| - | 
| if (m_finished) | 
| return; | 
| @@ -445,8 +443,6 @@ void ThreadedTest::dispatchSetNeedsAnimate() | 
| void ThreadedTest::dispatchAddInstantAnimation() | 
| { | 
| - DCHECK(Proxy::isMainThread()); | 
| - | 
| if (m_finished) | 
| return; | 
| @@ -456,8 +452,6 @@ void ThreadedTest::dispatchAddInstantAnimation() | 
| void ThreadedTest::dispatchAddAnimation() | 
| { | 
| - DCHECK(Proxy::isMainThread()); | 
| - | 
| if (m_finished) | 
| return; | 
| @@ -467,8 +461,6 @@ void ThreadedTest::dispatchAddAnimation() | 
| void ThreadedTest::dispatchSetNeedsAnimateAndCommit() | 
| { | 
| - DCHECK(Proxy::isMainThread()); | 
| - | 
| if (m_finished) | 
| return; | 
| @@ -480,8 +472,6 @@ void ThreadedTest::dispatchSetNeedsAnimateAndCommit() | 
| void ThreadedTest::dispatchSetNeedsCommit() | 
| { | 
| - DCHECK(Proxy::isMainThread()); | 
| - | 
| if (m_finished) | 
| return; | 
| @@ -491,8 +481,6 @@ void ThreadedTest::dispatchSetNeedsCommit() | 
| void ThreadedTest::dispatchAcquireLayerTextures() | 
| { | 
| - DCHECK(Proxy::isMainThread()); | 
| - | 
| if (m_finished) | 
| return; | 
| @@ -502,8 +490,6 @@ void ThreadedTest::dispatchAcquireLayerTextures() | 
| void ThreadedTest::dispatchSetNeedsRedraw() | 
| { | 
| - DCHECK(Proxy::isMainThread()); | 
| - | 
| if (m_finished) | 
| return; | 
| @@ -513,8 +499,6 @@ void ThreadedTest::dispatchSetNeedsRedraw() | 
| void ThreadedTest::dispatchSetVisible(bool visible) | 
| { | 
| - DCHECK(Proxy::isMainThread()); | 
| - | 
| if (m_finished) | 
| return; | 
| @@ -531,8 +515,6 @@ void ThreadedTest::dispatchComposite() | 
| void ThreadedTest::dispatchDidAddAnimation() | 
| { | 
| - DCHECK(Proxy::isMainThread()); | 
| - | 
| if (m_finished) | 
| return; | 
| @@ -547,13 +529,11 @@ void ThreadedTest::runTest(bool threaded) | 
| Settings::setAcceleratedAnimationEnabled(true); | 
| if (threaded) { | 
| - m_webThread.reset(WebKit::Platform::current()->createThread("ThreadedTest")); | 
| - Platform::current()->compositorSupport()->initialize(m_webThread.get()); | 
| - } else | 
| - Platform::current()->compositorSupport()->initialize(0); | 
| + m_webImplThread.reset(WebKit::Platform::current()->createThread("ThreadedTest")); | 
| + m_implThread = CCThreadImpl::createForDifferentThread(m_webImplThread.get()).release(); | 
| + } | 
| - DCHECK(Proxy::isMainThread()); | 
| - m_mainThreadProxy = ScopedThreadProxy::create(Proxy::mainThread()); | 
| + m_mainThreadProxy = ScopedThreadProxy::create(WebKit::CCThreadImpl::createForCurrentThread().release()); | 
| initializeSettings(m_settings); | 
| @@ -574,11 +554,9 @@ void ThreadedTest::runTest(bool threaded) | 
| m_client.reset(); | 
| if (m_timedOut) { | 
| FAIL() << "Test timed out"; | 
| - Platform::current()->compositorSupport()->shutdown(); | 
| return; | 
| } | 
| afterTest(); | 
| - Platform::current()->compositorSupport()->shutdown(); | 
| } | 
| } // namespace WebKitTests |