Index: cc/layer_tree_host_impl_unittest.cc |
diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc |
index 9611d68ef580906c13ee0dc90e4a5f963baca868..83351ba3edab6ddd26fa54d8e6a97be325b3ded0 100644 |
--- a/cc/layer_tree_host_impl_unittest.cc |
+++ b/cc/layer_tree_host_impl_unittest.cc |
@@ -22,6 +22,7 @@ |
#include "cc/single_thread_proxy.h" |
#include "cc/solid_color_draw_quad.h" |
#include "cc/test/animation_test_common.h" |
+#include "cc/test/fake_proxy.h" |
#include "cc/test/fake_web_compositor_output_surface.h" |
#include "cc/test/fake_web_graphics_context_3d.h" |
#include "cc/test/fake_web_scrollbar_theme_geometry.h" |
@@ -58,7 +59,10 @@ class LayerTreeHostImplTest : public testing::TestWithParam<bool>, |
public LayerTreeHostImplClient { |
public: |
LayerTreeHostImplTest() |
- : m_onCanDrawStateChangedCalled(false) |
+ : m_proxy(0) |
+ , m_alwaysImplThread(&m_proxy) |
+ , m_alwaysMainThreadBlocked(&m_proxy) |
+ , m_onCanDrawStateChangedCalled(false) |
, m_didRequestCommit(false) |
, m_didRequestRedraw(false) |
, m_reduceMemoryResult(true) |
@@ -71,7 +75,7 @@ public: |
LayerTreeSettings settings; |
settings.minimumOcclusionTrackingSize = IntSize(); |
- m_hostImpl = LayerTreeHostImpl::create(settings, this); |
+ m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
m_hostImpl->initializeRenderer(createContext()); |
m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); |
} |
@@ -98,7 +102,7 @@ public: |
LayerTreeSettings settings; |
settings.minimumOcclusionTrackingSize = IntSize(); |
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); |
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
myHostImpl->initializeRenderer(graphicsContext.Pass()); |
myHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); |
@@ -182,6 +186,7 @@ protected: |
return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<GraphicsContext>(); |
} |
+ FakeProxy m_proxy; |
DebugScopedSetImplThread m_alwaysImplThread; |
DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; |
@@ -345,7 +350,7 @@ TEST_P(LayerTreeHostImplTest, scrollWithoutRootLayer) |
TEST_P(LayerTreeHostImplTest, scrollWithoutRenderer) |
{ |
LayerTreeSettings settings; |
- m_hostImpl = LayerTreeHostImpl::create(settings, this); |
+ m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
// Initialization will fail here. |
m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<GraphicsContext>()); |
@@ -1941,7 +1946,7 @@ TEST_P(LayerTreeHostImplTest, partialSwapReceivesDamageRect) |
// that we can force partial swap enabled. |
LayerTreeSettings settings; |
Settings::setPartialSwapEnabled(true); |
- scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::create(settings, this); |
+ scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
layerTreeHostImpl->initializeRenderer(outputSurface.Pass()); |
layerTreeHostImpl->setViewportSize(IntSize(500, 500), IntSize(500, 500)); |
@@ -2221,14 +2226,14 @@ public: |
} |
}; |
-static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, LayerTreeHostImplClient* client) |
+static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, LayerTreeHostImplClient* client, Proxy* proxy) |
{ |
Settings::setPartialSwapEnabled(partialSwap); |
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); |
LayerTreeSettings settings; |
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, client); |
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, client, proxy); |
myHostImpl->initializeRenderer(context.Pass()); |
myHostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); |
@@ -2291,7 +2296,7 @@ static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay |
TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap) |
{ |
- scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(true, this); |
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(true, this, &m_proxy); |
{ |
LayerTreeHostImpl::FrameData frame; |
@@ -2312,7 +2317,7 @@ TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap) |
TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorNoPartialSwap) |
{ |
- scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(false, this); |
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(false, this, &m_proxy); |
{ |
LayerTreeHostImpl::FrameData frame; |
@@ -2378,7 +2383,7 @@ TEST_P(LayerTreeHostImplTest, contextLostAndRestoredNotificationSentToAllLayers) |
TEST_P(LayerTreeHostImplTest, finishAllRenderingAfterContextLost) |
{ |
LayerTreeSettings settings; |
- m_hostImpl = LayerTreeHostImpl::create(settings, this); |
+ m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
// The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects. |
m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<GraphicsContext>()); |
@@ -2402,7 +2407,7 @@ private: |
TEST_P(LayerTreeHostImplTest, contextLostDuringInitialize) |
{ |
LayerTreeSettings settings; |
- m_hostImpl = LayerTreeHostImpl::create(settings, this); |
+ m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
// Initialize into a known successful state. |
EXPECT_TRUE(m_hostImpl->initializeRenderer(createContext())); |
@@ -2992,7 +2997,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithClipping) |
LayerTreeSettings settings; |
settings.minimumOcclusionTrackingSize = IntSize(); |
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); |
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
LayerImpl* rootPtr; |
LayerImpl* surfaceLayerPtr; |
@@ -3089,7 +3094,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusion) |
LayerTreeSettings settings; |
settings.minimumOcclusionTrackingSize = IntSize(); |
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); |
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
// Layers are structure as follows: |
// |
@@ -3205,7 +3210,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) |
LayerTreeSettings settings; |
settings.minimumOcclusionTrackingSize = IntSize(); |
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); |
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
// Layers are structure as follows: |
// |
@@ -3321,7 +3326,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) |
LayerTreeSettings settings; |
settings.minimumOcclusionTrackingSize = IntSize(); |
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); |
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
// Layers are structured as follows: |
// |
@@ -3409,7 +3414,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) |
Settings::setPartialSwapEnabled(false); |
LayerTreeSettings settings; |
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); |
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
// Layers are structured as follows: |
// |
@@ -3484,7 +3489,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) |
LayerTreeSettings settings; |
settings.minimumOcclusionTrackingSize = IntSize(); |
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); |
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
// Layers are structure as follows: |
// |
@@ -3597,7 +3602,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithScissor) |
LayerTreeSettings settings; |
settings.minimumOcclusionTrackingSize = IntSize(); |
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); |
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
/* |
Layers are created as follows: |
@@ -3704,7 +3709,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCaching) |
LayerTreeSettings settings; |
settings.minimumOcclusionTrackingSize = IntSize(); |
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); |
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
LayerImpl* rootPtr; |
LayerImpl* intermediateLayerPtr; |
@@ -3865,7 +3870,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) |
LayerTreeSettings settings; |
settings.minimumOcclusionTrackingSize = IntSize(); |
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this); |
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
LayerImpl* rootPtr; |
LayerImpl* intermediateLayerPtr; |
@@ -4057,9 +4062,9 @@ struct RenderPassRemovalTestData : public LayerTreeHostImpl::FrameData { |
class TestRenderer : public GLRenderer, public RendererClient { |
public: |
- static scoped_ptr<TestRenderer> create(ResourceProvider* resourceProvider) |
+ static scoped_ptr<TestRenderer> create(ResourceProvider* resourceProvider, Proxy* proxy) |
{ |
- scoped_ptr<TestRenderer> renderer(new TestRenderer(resourceProvider)); |
+ scoped_ptr<TestRenderer> renderer(new TestRenderer(resourceProvider, proxy)); |
if (!renderer->initialize()) |
return scoped_ptr<TestRenderer>(); |
@@ -4081,7 +4086,7 @@ public: |
virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE { } |
protected: |
- TestRenderer(ResourceProvider* resourceProvider) : GLRenderer(this, resourceProvider) { } |
+ TestRenderer(ResourceProvider* resourceProvider, Proxy* proxy) : GLRenderer(this, resourceProvider, proxy->hasImplThread()) { } |
private: |
LayerTreeSettings m_settings; |
@@ -4365,7 +4370,7 @@ TEST_P(LayerTreeHostImplTest, testRemoveRenderPasses) |
ASSERT_TRUE(context->context3D()); |
scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get())); |
- scoped_ptr<TestRenderer> renderer(TestRenderer::create(resourceProvider.get())); |
+ scoped_ptr<TestRenderer> renderer(TestRenderer::create(resourceProvider.get(), &m_proxy)); |
int testCaseIndex = 0; |
while (removeRenderPassesCases[testCaseIndex].name) { |