Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to 165064 Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 e2ecdcefdce85d30a5aedd661f7376573840713f..d816728fa8aaf822ad3ff3ea6262a4a0339ed332 100644
--- a/cc/layer_tree_host_impl_unittest.cc
+++ b/cc/layer_tree_host_impl_unittest.cc
@@ -23,6 +23,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"
@@ -62,7 +63,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)
@@ -76,7 +80,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));
}
@@ -104,7 +108,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));
@@ -188,6 +192,7 @@ protected:
return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<GraphicsContext>();
}
+ FakeProxy m_proxy;
DebugScopedSetImplThread m_alwaysImplThread;
DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked;
@@ -351,7 +356,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>());
@@ -1947,7 +1952,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));
@@ -2227,14 +2232,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));
@@ -2297,7 +2302,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;
@@ -2318,7 +2323,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;
@@ -2384,7 +2389,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>());
@@ -2408,7 +2413,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()));
@@ -3022,7 +3027,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;
@@ -3119,7 +3124,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:
//
@@ -3235,7 +3240,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:
//
@@ -3351,7 +3356,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:
//
@@ -3439,7 +3444,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:
//
@@ -3514,7 +3519,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:
//
@@ -3627,7 +3632,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:
@@ -3734,7 +3739,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;
@@ -3895,7 +3900,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;
@@ -4087,9 +4092,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>();
@@ -4109,9 +4114,10 @@ public:
virtual void setFullRootLayerDamage() OVERRIDE { }
virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE { }
virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE { }
+ virtual bool hasImplThread() const OVERRIDE { return false; }
protected:
- TestRenderer(ResourceProvider* resourceProvider) : GLRenderer(this, resourceProvider) { }
+ TestRenderer(ResourceProvider* resourceProvider, Proxy* proxy) : GLRenderer(this, resourceProvider) { }
private:
LayerTreeSettings m_settings;
@@ -4395,7 +4401,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) {

Powered by Google App Engine
This is Rietveld 408576698