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 6de5665ad07248c01ea9b327e5ca54c62015bd2c..9cc385f56ecb37e2ad70962092342a5b1b395012 100644 |
--- a/cc/layer_tree_host_impl_unittest.cc |
+++ b/cc/layer_tree_host_impl_unittest.cc |
@@ -103,25 +103,27 @@ public: |
void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult = reduceMemoryResult; } |
- scoped_ptr<LayerTreeHostImpl> createLayerTreeHost(bool partialSwap, scoped_ptr<OutputSurface> outputSurface, scoped_ptr<LayerImpl> root) |
+ void createLayerTreeHost(bool partialSwap, scoped_ptr<OutputSurface> outputSurface) |
{ |
LayerTreeSettings settings; |
settings.minimumOcclusionTrackingSize = gfx::Size(); |
settings.partialSwapEnabled = partialSwap; |
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
+ m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
- myHostImpl->initializeRenderer(outputSurface.Pass()); |
- myHostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); |
+ m_hostImpl->initializeRenderer(outputSurface.Pass()); |
+ m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); |
+ } |
+ void setupRootLayerImpl(scoped_ptr<LayerImpl> root) |
+ { |
root->setAnchorPoint(gfx::PointF(0, 0)); |
root->setPosition(gfx::PointF(0, 0)); |
root->setBounds(gfx::Size(10, 10)); |
root->setContentBounds(gfx::Size(10, 10)); |
root->setDrawsContent(true); |
root->drawProperties().visible_content_rect = gfx::Rect(0, 0, 10, 10); |
- myHostImpl->setRootLayer(root.Pass()); |
- return myHostImpl.Pass(); |
+ m_hostImpl->setRootLayer(root.Pass()); |
} |
static void expectClearedScrollDeltasRecursive(LayerImpl* layer) |
@@ -160,7 +162,7 @@ public: |
void setupScrollAndContentsLayers(const gfx::Size& contentSize) |
{ |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.get(), 1); |
root->setScrollable(true); |
root->setScrollOffset(gfx::Vector2d(0, 0)); |
root->setMaxScrollOffset(gfx::Vector2d(contentSize.width(), contentSize.height())); |
@@ -169,7 +171,7 @@ public: |
root->setPosition(gfx::PointF(0, 0)); |
root->setAnchorPoint(gfx::PointF(0, 0)); |
- scoped_ptr<LayerImpl> contents = LayerImpl::create(2); |
+ scoped_ptr<LayerImpl> contents = LayerImpl::create(m_hostImpl.get(), 2); |
contents->setDrawsContent(true); |
contents->setBounds(contentSize); |
contents->setContentBounds(contentSize); |
@@ -179,9 +181,9 @@ public: |
m_hostImpl->setRootLayer(root.Pass()); |
} |
- static scoped_ptr<LayerImpl> createScrollableLayer(int id, const gfx::Size& size) |
+ scoped_ptr<LayerImpl> createScrollableLayer(int id, const gfx::Size& size) |
{ |
- scoped_ptr<LayerImpl> layer = LayerImpl::create(id); |
+ scoped_ptr<LayerImpl> layer = LayerImpl::create(m_hostImpl.get(), id); |
layer->setScrollable(true); |
layer->setDrawsContent(true); |
layer->setBounds(size); |
@@ -295,12 +297,12 @@ TEST_P(LayerTreeHostImplTest, scrollDeltaNoLayers) |
TEST_P(LayerTreeHostImplTest, scrollDeltaTreeButNoChanges) |
{ |
{ |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
- root->addChild(LayerImpl::create(2)); |
- root->addChild(LayerImpl::create(3)); |
- root->children()[1]->addChild(LayerImpl::create(4)); |
- root->children()[1]->addChild(LayerImpl::create(5)); |
- root->children()[1]->children()[0]->addChild(LayerImpl::create(6)); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.get(), 1); |
+ root->addChild(LayerImpl::create(m_hostImpl.get(), 2)); |
+ root->addChild(LayerImpl::create(m_hostImpl.get(), 3)); |
+ root->children()[1]->addChild(LayerImpl::create(m_hostImpl.get(), 4)); |
+ root->children()[1]->addChild(LayerImpl::create(m_hostImpl.get(), 5)); |
+ root->children()[1]->children()[0]->addChild(LayerImpl::create(m_hostImpl.get(), 6)); |
m_hostImpl->setRootLayer(root.Pass()); |
} |
LayerImpl* root = m_hostImpl->rootLayer(); |
@@ -323,7 +325,7 @@ TEST_P(LayerTreeHostImplTest, scrollDeltaRepeatedScrolls) |
gfx::Vector2d scrollOffset(20, 30); |
gfx::Vector2d scrollDelta(11, -15); |
{ |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.get(), 1); |
root->setScrollOffset(scrollOffset); |
root->setScrollable(true); |
root->setMaxScrollOffset(gfx::Vector2d(100, 100)); |
@@ -878,7 +880,7 @@ TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPage |
class DidDrawCheckLayer : public TiledLayerImpl { |
public: |
- static scoped_ptr<LayerImpl> create(int id) { return scoped_ptr<LayerImpl>(new DidDrawCheckLayer(id)); } |
+ static scoped_ptr<LayerImpl> create(LayerTreeHostImpl* hostImpl, int id) { return scoped_ptr<LayerImpl>(new DidDrawCheckLayer(hostImpl, id)); } |
virtual void didDraw(ResourceProvider*) OVERRIDE |
{ |
@@ -900,8 +902,8 @@ public: |
} |
protected: |
- explicit DidDrawCheckLayer(int id) |
- : TiledLayerImpl(id) |
+ DidDrawCheckLayer(LayerTreeHostImpl* hostImpl, int id) |
+ : TiledLayerImpl(hostImpl, id) |
, m_didDrawCalled(false) |
, m_willDrawCalled(false) |
{ |
@@ -926,11 +928,11 @@ TEST_P(LayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) |
{ |
// The root layer is always drawn, so run this test on a child layer that |
// will be masked out by the root layer's bounds. |
- m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); |
+ m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl.get(), 1)); |
DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); |
root->setMasksToBounds(true); |
- root->addChild(DidDrawCheckLayer::create(2)); |
+ root->addChild(DidDrawCheckLayer::create(m_hostImpl.get(), 2)); |
DidDrawCheckLayer* layer = static_cast<DidDrawCheckLayer*>(root->children()[0]); |
// Ensure visibleContentRect for layer is empty |
layer->setPosition(gfx::PointF(100, 100)); |
@@ -972,13 +974,13 @@ TEST_P(LayerTreeHostImplTest, willDrawNotCalledOnOccludedLayer) |
gfx::Size bigSize(1000, 1000); |
m_hostImpl->setViewportSize(bigSize, bigSize); |
- m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); |
+ m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl.get(), 1)); |
DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); |
- root->addChild(DidDrawCheckLayer::create(2)); |
+ root->addChild(DidDrawCheckLayer::create(m_hostImpl.get(), 2)); |
DidDrawCheckLayer* occludedLayer = static_cast<DidDrawCheckLayer*>(root->children()[0]); |
- root->addChild(DidDrawCheckLayer::create(3)); |
+ root->addChild(DidDrawCheckLayer::create(m_hostImpl.get(), 3)); |
DidDrawCheckLayer* topLayer = static_cast<DidDrawCheckLayer*>(root->children()[1]); |
// This layer covers the occludedLayer above. Make this layer large so it can occlude. |
topLayer->setBounds(bigSize); |
@@ -1004,13 +1006,13 @@ TEST_P(LayerTreeHostImplTest, willDrawNotCalledOnOccludedLayer) |
TEST_P(LayerTreeHostImplTest, didDrawCalledOnAllLayers) |
{ |
- m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); |
+ m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl.get(), 1)); |
DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); |
- root->addChild(DidDrawCheckLayer::create(2)); |
+ root->addChild(DidDrawCheckLayer::create(m_hostImpl.get(), 2)); |
DidDrawCheckLayer* layer1 = static_cast<DidDrawCheckLayer*>(root->children()[0]); |
- layer1->addChild(DidDrawCheckLayer::create(3)); |
+ layer1->addChild(DidDrawCheckLayer::create(m_hostImpl.get(), 3)); |
DidDrawCheckLayer* layer2 = static_cast<DidDrawCheckLayer*>(layer1->children()[0]); |
layer1->setOpacity(0.3f); |
@@ -1035,14 +1037,14 @@ TEST_P(LayerTreeHostImplTest, didDrawCalledOnAllLayers) |
class MissingTextureAnimatingLayer : public DidDrawCheckLayer { |
public: |
- static scoped_ptr<LayerImpl> create(int id, bool tileMissing, bool skipsDraw, bool animating, ResourceProvider* resourceProvider) |
+ static scoped_ptr<LayerImpl> create(LayerTreeHostImpl* hostImpl, int id, bool tileMissing, bool skipsDraw, bool animating, ResourceProvider* resourceProvider) |
{ |
- return scoped_ptr<LayerImpl>(new MissingTextureAnimatingLayer(id, tileMissing, skipsDraw, animating, resourceProvider)); |
+ return scoped_ptr<LayerImpl>(new MissingTextureAnimatingLayer(hostImpl, id, tileMissing, skipsDraw, animating, resourceProvider)); |
} |
private: |
- explicit MissingTextureAnimatingLayer(int id, bool tileMissing, bool skipsDraw, bool animating, ResourceProvider* resourceProvider) |
- : DidDrawCheckLayer(id) |
+ MissingTextureAnimatingLayer(LayerTreeHostImpl* hostImpl, int id, bool tileMissing, bool skipsDraw, bool animating, ResourceProvider* resourceProvider) |
+ : DidDrawCheckLayer(hostImpl, id) |
{ |
scoped_ptr<LayerTilingData> tilingData = LayerTilingData::create(gfx::Size(10, 10), LayerTilingData::NoBorderTexels); |
tilingData->setBounds(bounds()); |
@@ -1060,9 +1062,9 @@ private: |
TEST_P(LayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) |
{ |
// When the texture is not missing, we draw as usual. |
- m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); |
+ m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl.get(), 1)); |
DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); |
- root->addChild(MissingTextureAnimatingLayer::create(2, false, false, true, m_hostImpl->resourceProvider())); |
+ root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl.get(), 2, false, false, true, m_hostImpl->resourceProvider())); |
LayerTreeHostImpl::FrameData frame; |
@@ -1071,27 +1073,27 @@ TEST_P(LayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) |
m_hostImpl->didDrawAllLayers(frame); |
// When a texture is missing and we're not animating, we draw as usual with checkerboarding. |
- m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); |
+ m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl.get(), 1)); |
root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); |
- root->addChild(MissingTextureAnimatingLayer::create(2, true, false, false, m_hostImpl->resourceProvider())); |
+ root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl.get(), 2, true, false, false, m_hostImpl->resourceProvider())); |
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
m_hostImpl->drawLayers(frame); |
m_hostImpl->didDrawAllLayers(frame); |
// When a texture is missing and we're animating, we don't want to draw anything. |
- m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); |
+ m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl.get(), 1)); |
root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); |
- root->addChild(MissingTextureAnimatingLayer::create(2, true, false, true, m_hostImpl->resourceProvider())); |
+ root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl.get(), 2, true, false, true, m_hostImpl->resourceProvider())); |
EXPECT_FALSE(m_hostImpl->prepareToDraw(frame)); |
m_hostImpl->drawLayers(frame); |
m_hostImpl->didDrawAllLayers(frame); |
// When the layer skips draw and we're animating, we still draw the frame. |
- m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); |
+ m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl.get(), 1)); |
root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); |
- root->addChild(MissingTextureAnimatingLayer::create(2, false, true, true, m_hostImpl->resourceProvider())); |
+ root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl.get(), 2, false, true, true, m_hostImpl->resourceProvider())); |
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
m_hostImpl->drawLayers(frame); |
@@ -1100,7 +1102,7 @@ TEST_P(LayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) |
TEST_P(LayerTreeHostImplTest, scrollRootIgnored) |
{ |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.get(), 1); |
root->setScrollable(false); |
m_hostImpl->setRootLayer(root.Pass()); |
initializeRendererAndDrawFrame(); |
@@ -1117,7 +1119,7 @@ TEST_P(LayerTreeHostImplTest, scrollNonCompositedRoot) |
// scrollable outer layer. |
gfx::Size surfaceSize(10, 10); |
- scoped_ptr<LayerImpl> contentLayer = LayerImpl::create(1); |
+ scoped_ptr<LayerImpl> contentLayer = LayerImpl::create(m_hostImpl.get(), 1); |
contentLayer->setUseLCDText(true); |
contentLayer->setDrawsContent(true); |
contentLayer->setPosition(gfx::PointF(0, 0)); |
@@ -1126,7 +1128,7 @@ TEST_P(LayerTreeHostImplTest, scrollNonCompositedRoot) |
contentLayer->setContentBounds(gfx::Size(surfaceSize.width() * 2, surfaceSize.height() * 2)); |
contentLayer->setContentsScale(2, 2); |
- scoped_ptr<LayerImpl> scrollLayer = LayerImpl::create(2); |
+ scoped_ptr<LayerImpl> scrollLayer = LayerImpl::create(m_hostImpl.get(), 2); |
scrollLayer->setScrollable(true); |
scrollLayer->setMaxScrollOffset(gfx::Vector2d(surfaceSize.width(), surfaceSize.height())); |
scrollLayer->setBounds(surfaceSize); |
@@ -1149,7 +1151,7 @@ TEST_P(LayerTreeHostImplTest, scrollNonCompositedRoot) |
TEST_P(LayerTreeHostImplTest, scrollChildCallsCommitAndRedraw) |
{ |
gfx::Size surfaceSize(10, 10); |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.get(), 1); |
root->setBounds(surfaceSize); |
root->setContentBounds(surfaceSize); |
root->addChild(createScrollableLayer(2, surfaceSize)); |
@@ -1167,7 +1169,7 @@ TEST_P(LayerTreeHostImplTest, scrollChildCallsCommitAndRedraw) |
TEST_P(LayerTreeHostImplTest, scrollMissesChild) |
{ |
gfx::Size surfaceSize(10, 10); |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.get(), 1); |
root->addChild(createScrollableLayer(2, surfaceSize)); |
m_hostImpl->setRootLayer(root.Pass()); |
m_hostImpl->setViewportSize(surfaceSize, surfaceSize); |
@@ -1182,7 +1184,7 @@ TEST_P(LayerTreeHostImplTest, scrollMissesChild) |
TEST_P(LayerTreeHostImplTest, scrollMissesBackfacingChild) |
{ |
gfx::Size surfaceSize(10, 10); |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.get(), 1); |
scoped_ptr<LayerImpl> child = createScrollableLayer(2, surfaceSize); |
m_hostImpl->setViewportSize(surfaceSize, surfaceSize); |
@@ -1356,7 +1358,7 @@ TEST_P(LayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly) |
TEST_P(LayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread) |
{ |
gfx::Size surfaceSize(10, 10); |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.get(), 1); |
root->setBounds(surfaceSize); |
root->setContentBounds(surfaceSize); |
// Also mark the root scrollable so it becomes the root scroll layer. |
@@ -1632,7 +1634,7 @@ private: |
class BlendStateCheckLayer : public LayerImpl { |
public: |
- static scoped_ptr<LayerImpl> create(int id, ResourceProvider* resourceProvider) { return scoped_ptr<LayerImpl>(new BlendStateCheckLayer(id, resourceProvider)); } |
+ static scoped_ptr<LayerImpl> create(LayerTreeHostImpl* hostImpl, int id, ResourceProvider* resourceProvider) { return scoped_ptr<LayerImpl>(new BlendStateCheckLayer(hostImpl, id, resourceProvider)); } |
virtual void appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData) OVERRIDE |
{ |
@@ -1667,8 +1669,8 @@ public: |
void setOpaqueContentRect(const gfx::Rect& rect) { m_opaqueContentRect = rect; } |
private: |
- explicit BlendStateCheckLayer(int id, ResourceProvider* resourceProvider) |
- : LayerImpl(id) |
+ BlendStateCheckLayer(LayerTreeHostImpl* hostImpl, int id, ResourceProvider* resourceProvider) |
+ : LayerImpl(hostImpl, id) |
, m_blend(false) |
, m_hasRenderSurface(false) |
, m_quadsAppended(false) |
@@ -1694,7 +1696,7 @@ private: |
TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) |
{ |
{ |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.get(), 1); |
root->setAnchorPoint(gfx::PointF(0, 0)); |
root->setBounds(gfx::Size(10, 10)); |
root->setContentBounds(root->bounds()); |
@@ -1703,7 +1705,7 @@ TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) |
} |
LayerImpl* root = m_hostImpl->rootLayer(); |
- root->addChild(BlendStateCheckLayer::create(2, m_hostImpl->resourceProvider())); |
+ root->addChild(BlendStateCheckLayer::create(m_hostImpl.get(), 2, m_hostImpl->resourceProvider())); |
BlendStateCheckLayer* layer1 = static_cast<BlendStateCheckLayer*>(root->children()[0]); |
layer1->setPosition(gfx::PointF(2, 2)); |
@@ -1743,7 +1745,7 @@ TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) |
EXPECT_TRUE(layer1->quadsAppended()); |
m_hostImpl->didDrawAllLayers(frame); |
- layer1->addChild(BlendStateCheckLayer::create(3, m_hostImpl->resourceProvider())); |
+ layer1->addChild(BlendStateCheckLayer::create(m_hostImpl.get(), 3, m_hostImpl->resourceProvider())); |
BlendStateCheckLayer* layer2 = static_cast<BlendStateCheckLayer*>(layer1->children()[0]); |
layer2->setPosition(gfx::PointF(4, 4)); |
@@ -1891,8 +1893,8 @@ TEST_P(LayerTreeHostImplTest, viewportCovered) |
gfx::Size viewportSize(1000, 1000); |
m_hostImpl->setViewportSize(viewportSize, viewportSize); |
- m_hostImpl->setRootLayer(LayerImpl::create(1)); |
- m_hostImpl->rootLayer()->addChild(BlendStateCheckLayer::create(2, m_hostImpl->resourceProvider())); |
+ m_hostImpl->setRootLayer(LayerImpl::create(m_hostImpl.get(), 1)); |
+ m_hostImpl->rootLayer()->addChild(BlendStateCheckLayer::create(m_hostImpl.get(), 2, m_hostImpl->resourceProvider())); |
BlendStateCheckLayer* child = static_cast<BlendStateCheckLayer*>(m_hostImpl->rootLayer()->children()[0]); |
child->setExpectation(false, false); |
child->setContentsOpaque(true); |
@@ -1987,9 +1989,9 @@ private: |
class FakeDrawableLayerImpl: public LayerImpl { |
public: |
- static scoped_ptr<LayerImpl> create(int id) { return scoped_ptr<LayerImpl>(new FakeDrawableLayerImpl(id)); } |
+ static scoped_ptr<LayerImpl> create(LayerTreeHostImpl* hostImpl, int id) { return scoped_ptr<LayerImpl>(new FakeDrawableLayerImpl(hostImpl, id)); } |
protected: |
- explicit FakeDrawableLayerImpl(int id) : LayerImpl(id) { } |
+ FakeDrawableLayerImpl(LayerTreeHostImpl* hostImpl, int id) : LayerImpl(hostImpl, id) { } |
}; |
// Only reshape when we know we are going to draw. Otherwise, the reshape |
@@ -2001,7 +2003,7 @@ TEST_P(LayerTreeHostImplTest, reshapeNotCalledUntilDraw) |
ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(outputSurface->context3D()); |
m_hostImpl->initializeRenderer(outputSurface.Pass()); |
- scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1); |
+ scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(m_hostImpl.get(), 1); |
root->setAnchorPoint(gfx::PointF(0, 0)); |
root->setBounds(gfx::Size(10, 10)); |
root->setDrawsContent(true); |
@@ -2051,8 +2053,8 @@ TEST_P(LayerTreeHostImplTest, partialSwapReceivesDamageRect) |
layerTreeHostImpl->initializeRenderer(outputSurface.Pass()); |
layerTreeHostImpl->setViewportSize(gfx::Size(500, 500), gfx::Size(500, 500)); |
- scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1); |
- scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(2); |
+ scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(m_hostImpl.get(), 1); |
+ scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(m_hostImpl.get(), 2); |
child->setPosition(gfx::PointF(12, 13)); |
child->setAnchorPoint(gfx::PointF(0, 0)); |
child->setBounds(gfx::Size(14, 15)); |
@@ -2114,8 +2116,8 @@ TEST_P(LayerTreeHostImplTest, partialSwapReceivesDamageRect) |
TEST_P(LayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) |
{ |
- scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1); |
- scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(2); |
+ scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(m_hostImpl.get(), 1); |
+ scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(m_hostImpl.get(), 2); |
child->setAnchorPoint(gfx::PointF(0, 0)); |
child->setBounds(gfx::Size(10, 10)); |
child->setContentBounds(gfx::Size(10, 10)); |
@@ -2141,7 +2143,7 @@ TEST_P(LayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) |
class FakeLayerWithQuads : public LayerImpl { |
public: |
- static scoped_ptr<LayerImpl> create(int id) { return scoped_ptr<LayerImpl>(new FakeLayerWithQuads(id)); } |
+ static scoped_ptr<LayerImpl> create(LayerTreeHostImpl* hostImpl, int id) { return scoped_ptr<LayerImpl>(new FakeLayerWithQuads(hostImpl, id)); } |
virtual void appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData) OVERRIDE |
{ |
@@ -2155,8 +2157,8 @@ public: |
} |
private: |
- FakeLayerWithQuads(int id) |
- : LayerImpl(id) |
+ FakeLayerWithQuads(LayerTreeHostImpl* hostImpl, int id) |
+ : LayerImpl(hostImpl, id) |
{ |
} |
}; |
@@ -2260,28 +2262,29 @@ TEST_P(LayerTreeHostImplTest, noPartialSwap) |
MockContextHarness harness(mockContext); |
// Run test case |
- scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, outputSurface.Pass(), FakeLayerWithQuads::create(1)); |
+ createLayerTreeHost(false, outputSurface.Pass()); |
+ setupRootLayerImpl(FakeLayerWithQuads::create(m_hostImpl.get(), 1)); |
// without partial swap, and no clipping, no scissor is set. |
harness.mustDrawSolidQuad(); |
harness.mustSetNoScissor(); |
{ |
LayerTreeHostImpl::FrameData frame; |
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); |
- myHostImpl->drawLayers(frame); |
- myHostImpl->didDrawAllLayers(frame); |
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
+ m_hostImpl->drawLayers(frame); |
+ m_hostImpl->didDrawAllLayers(frame); |
} |
Mock::VerifyAndClearExpectations(&mockContext); |
// without partial swap, but a layer does clip its subtree, one scissor is set. |
- myHostImpl->rootLayer()->setMasksToBounds(true); |
+ m_hostImpl->rootLayer()->setMasksToBounds(true); |
harness.mustDrawSolidQuad(); |
harness.mustSetScissor(0, 0, 10, 10); |
{ |
LayerTreeHostImpl::FrameData frame; |
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); |
- myHostImpl->drawLayers(frame); |
- myHostImpl->didDrawAllLayers(frame); |
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
+ m_hostImpl->drawLayers(frame); |
+ m_hostImpl->didDrawAllLayers(frame); |
} |
Mock::VerifyAndClearExpectations(&mockContext); |
} |
@@ -2292,30 +2295,31 @@ TEST_P(LayerTreeHostImplTest, partialSwap) |
MockContext* mockContext = static_cast<MockContext*>(outputSurface->context3D()); |
MockContextHarness harness(mockContext); |
- scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, outputSurface.Pass(), FakeLayerWithQuads::create(1)); |
+ createLayerTreeHost(true, outputSurface.Pass()); |
+ setupRootLayerImpl(FakeLayerWithQuads::create(m_hostImpl.get(), 1)); |
// The first frame is not a partially-swapped one. |
harness.mustSetScissor(0, 0, 10, 10); |
harness.mustDrawSolidQuad(); |
{ |
LayerTreeHostImpl::FrameData frame; |
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); |
- myHostImpl->drawLayers(frame); |
- myHostImpl->didDrawAllLayers(frame); |
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
+ m_hostImpl->drawLayers(frame); |
+ m_hostImpl->didDrawAllLayers(frame); |
} |
Mock::VerifyAndClearExpectations(&mockContext); |
// Damage a portion of the frame. |
- myHostImpl->rootLayer()->setUpdateRect(gfx::Rect(0, 0, 2, 3)); |
+ m_hostImpl->rootLayer()->setUpdateRect(gfx::Rect(0, 0, 2, 3)); |
// The second frame will be partially-swapped (the y coordinates are flipped). |
harness.mustSetScissor(0, 7, 2, 3); |
harness.mustDrawSolidQuad(); |
{ |
LayerTreeHostImpl::FrameData frame; |
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); |
- myHostImpl->drawLayers(frame); |
- myHostImpl->didDrawAllLayers(frame); |
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
+ m_hostImpl->drawLayers(frame); |
+ m_hostImpl->didDrawAllLayers(frame); |
} |
Mock::VerifyAndClearExpectations(&mockContext); |
} |
@@ -2370,9 +2374,9 @@ static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay |
Layers 1, 2 have render surfaces |
*/ |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
- scoped_ptr<LayerImpl> child = LayerImpl::create(2); |
- scoped_ptr<LayerImpl> grandChild = FakeLayerWithQuads::create(3); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(myHostImpl.get(), 1); |
+ scoped_ptr<LayerImpl> child = LayerImpl::create(myHostImpl.get(), 2); |
+ scoped_ptr<LayerImpl> grandChild = FakeLayerWithQuads::create(myHostImpl.get(), 3); |
gfx::Rect rootRect(0, 0, 100, 100); |
gfx::Rect childRect(10, 10, 50, 50); |
@@ -2453,7 +2457,7 @@ TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorNoPartialSwap) |
// Make sure that output surface lost notifications are propagated through the tree. |
class OutputSurfaceLostNotificationCheckLayer : public LayerImpl { |
public: |
- static scoped_ptr<LayerImpl> create(int id) { return scoped_ptr<LayerImpl>(new OutputSurfaceLostNotificationCheckLayer(id)); } |
+ static scoped_ptr<LayerImpl> create(LayerTreeHostImpl* hostImpl, int id) { return scoped_ptr<LayerImpl>(new OutputSurfaceLostNotificationCheckLayer(hostImpl, id)); } |
virtual void didLoseOutputSurface() OVERRIDE |
{ |
@@ -2463,8 +2467,8 @@ public: |
bool didLoseOutputSurfaceCalled() const { return m_didLoseOutputSurfaceCalled; } |
private: |
- explicit OutputSurfaceLostNotificationCheckLayer(int id) |
- : LayerImpl(id) |
+ OutputSurfaceLostNotificationCheckLayer(LayerTreeHostImpl* hostImpl, int id) |
+ : LayerImpl(hostImpl, id) |
, m_didLoseOutputSurfaceCalled(false) |
{ |
} |
@@ -2474,13 +2478,13 @@ private: |
TEST_P(LayerTreeHostImplTest, outputSurfaceLostAndRestoredNotificationSentToAllLayers) |
{ |
- m_hostImpl->setRootLayer(OutputSurfaceLostNotificationCheckLayer::create(1)); |
+ m_hostImpl->setRootLayer(OutputSurfaceLostNotificationCheckLayer::create(m_hostImpl.get(), 1)); |
OutputSurfaceLostNotificationCheckLayer* root = static_cast<OutputSurfaceLostNotificationCheckLayer*>(m_hostImpl->rootLayer()); |
- root->addChild(OutputSurfaceLostNotificationCheckLayer::create(1)); |
+ root->addChild(OutputSurfaceLostNotificationCheckLayer::create(m_hostImpl.get(), 1)); |
OutputSurfaceLostNotificationCheckLayer* layer1 = static_cast<OutputSurfaceLostNotificationCheckLayer*>(root->children()[0]); |
- layer1->addChild(OutputSurfaceLostNotificationCheckLayer::create(2)); |
+ layer1->addChild(OutputSurfaceLostNotificationCheckLayer::create(m_hostImpl.get(), 2)); |
OutputSurfaceLostNotificationCheckLayer* layer2 = static_cast<OutputSurfaceLostNotificationCheckLayer*>(layer1->children()[0]); |
EXPECT_FALSE(root->didLoseOutputSurfaceCalled()); |
@@ -2740,9 +2744,9 @@ class FakeWebScrollbarThemeGeometryNonEmpty : public FakeWebScrollbarThemeGeomet |
class FakeScrollbarLayerImpl : public ScrollbarLayerImpl { |
public: |
- static scoped_ptr<FakeScrollbarLayerImpl> create(int id) |
+ static scoped_ptr<FakeScrollbarLayerImpl> create(LayerTreeHostImpl* hostImpl, int id) |
{ |
- return make_scoped_ptr(new FakeScrollbarLayerImpl(id)); |
+ return make_scoped_ptr(new FakeScrollbarLayerImpl(hostImpl, id)); |
} |
void createResources(ResourceProvider* provider) |
@@ -2760,8 +2764,8 @@ public: |
} |
protected: |
- explicit FakeScrollbarLayerImpl(int id) |
- : ScrollbarLayerImpl(id) |
+ FakeScrollbarLayerImpl(LayerTreeHostImpl* hostImpl, int id) |
+ : ScrollbarLayerImpl(hostImpl, id) |
{ |
} |
}; |
@@ -2787,11 +2791,11 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostOutputSurface) |
{ |
int layerId = 1; |
- scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(layerId++)); |
+ scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(m_hostImpl.get(), layerId++)); |
rootLayer->setBounds(gfx::Size(10, 10)); |
rootLayer->setAnchorPoint(gfx::PointF(0, 0)); |
- scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(layerId++); |
+ scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(m_hostImpl.get(), layerId++); |
tileLayer->setBounds(gfx::Size(10, 10)); |
tileLayer->setAnchorPoint(gfx::PointF(0, 0)); |
tileLayer->setContentBounds(gfx::Size(10, 10)); |
@@ -2803,7 +2807,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostOutputSurface) |
tileLayer->pushTileProperties(0, 0, 1, gfx::Rect(0, 0, 10, 10), false); |
rootLayer->addChild(tileLayer.PassAs<LayerImpl>()); |
- scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(layerId++); |
+ scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(m_hostImpl.get(), layerId++); |
textureLayer->setBounds(gfx::Size(10, 10)); |
textureLayer->setAnchorPoint(gfx::PointF(0, 0)); |
textureLayer->setContentBounds(gfx::Size(10, 10)); |
@@ -2811,7 +2815,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostOutputSurface) |
textureLayer->setTextureId(StrictWebGraphicsContext3D::kExternalTextureId); |
rootLayer->addChild(textureLayer.PassAs<LayerImpl>()); |
- scoped_ptr<TiledLayerImpl> maskLayer = TiledLayerImpl::create(layerId++); |
+ scoped_ptr<TiledLayerImpl> maskLayer = TiledLayerImpl::create(m_hostImpl.get(), layerId++); |
maskLayer->setBounds(gfx::Size(10, 10)); |
maskLayer->setAnchorPoint(gfx::PointF(0, 0)); |
maskLayer->setContentBounds(gfx::Size(10, 10)); |
@@ -2820,7 +2824,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostOutputSurface) |
maskLayer->setTilingData(*tilingData); |
maskLayer->pushTileProperties(0, 0, 1, gfx::Rect(0, 0, 10, 10), false); |
- scoped_ptr<TextureLayerImpl> textureLayerWithMask = TextureLayerImpl::create(layerId++); |
+ scoped_ptr<TextureLayerImpl> textureLayerWithMask = TextureLayerImpl::create(m_hostImpl.get(), layerId++); |
textureLayerWithMask->setBounds(gfx::Size(10, 10)); |
textureLayerWithMask->setAnchorPoint(gfx::PointF(0, 0)); |
textureLayerWithMask->setContentBounds(gfx::Size(10, 10)); |
@@ -2836,62 +2840,55 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostOutputSurface) |
base::Bind(FakeVideoFrame::toVideoFrame); |
FakeVideoFrameProvider provider; |
provider.setFrame(&videoFrame); |
- scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(layerId++, &provider, unwrapper); |
+ scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(m_hostImpl.get(), layerId++, &provider, unwrapper); |
videoLayer->setBounds(gfx::Size(10, 10)); |
videoLayer->setAnchorPoint(gfx::PointF(0, 0)); |
videoLayer->setContentBounds(gfx::Size(10, 10)); |
videoLayer->setDrawsContent(true); |
- videoLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
rootLayer->addChild(videoLayer.PassAs<LayerImpl>()); |
FakeVideoFrameProvider providerScaled; |
- scoped_ptr<VideoLayerImpl> videoLayerScaled = VideoLayerImpl::create(layerId++, &providerScaled, unwrapper); |
+ scoped_ptr<VideoLayerImpl> videoLayerScaled = VideoLayerImpl::create(m_hostImpl.get(), layerId++, &providerScaled, unwrapper); |
videoLayerScaled->setBounds(gfx::Size(10, 10)); |
videoLayerScaled->setAnchorPoint(gfx::PointF(0, 0)); |
videoLayerScaled->setContentBounds(gfx::Size(10, 10)); |
videoLayerScaled->setDrawsContent(true); |
- videoLayerScaled->setLayerTreeHostImpl(m_hostImpl.get()); |
rootLayer->addChild(videoLayerScaled.PassAs<LayerImpl>()); |
FakeVideoFrameProvider hwProvider; |
- scoped_ptr<VideoLayerImpl> hwVideoLayer = VideoLayerImpl::create(layerId++, &hwProvider, unwrapper); |
+ scoped_ptr<VideoLayerImpl> hwVideoLayer = VideoLayerImpl::create(m_hostImpl.get(), layerId++, &hwProvider, unwrapper); |
hwVideoLayer->setBounds(gfx::Size(10, 10)); |
hwVideoLayer->setAnchorPoint(gfx::PointF(0, 0)); |
hwVideoLayer->setContentBounds(gfx::Size(10, 10)); |
hwVideoLayer->setDrawsContent(true); |
- hwVideoLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
rootLayer->addChild(hwVideoLayer.PassAs<LayerImpl>()); |
- scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(layerId++); |
+ scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(m_hostImpl.get(), layerId++); |
ioSurfaceLayer->setBounds(gfx::Size(10, 10)); |
ioSurfaceLayer->setAnchorPoint(gfx::PointF(0, 0)); |
ioSurfaceLayer->setContentBounds(gfx::Size(10, 10)); |
ioSurfaceLayer->setDrawsContent(true); |
ioSurfaceLayer->setIOSurfaceProperties(1, gfx::Size(10, 10)); |
- ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
rootLayer->addChild(ioSurfaceLayer.PassAs<LayerImpl>()); |
- scoped_ptr<HeadsUpDisplayLayerImpl> hudLayer = HeadsUpDisplayLayerImpl::create(layerId++); |
+ scoped_ptr<HeadsUpDisplayLayerImpl> hudLayer = HeadsUpDisplayLayerImpl::create(m_hostImpl.get(), layerId++); |
hudLayer->setBounds(gfx::Size(10, 10)); |
hudLayer->setAnchorPoint(gfx::PointF(0, 0)); |
hudLayer->setContentBounds(gfx::Size(10, 10)); |
hudLayer->setDrawsContent(true); |
- hudLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
rootLayer->addChild(hudLayer.PassAs<LayerImpl>()); |
- scoped_ptr<FakeScrollbarLayerImpl> scrollbarLayer(FakeScrollbarLayerImpl::create(layerId++)); |
+ scoped_ptr<FakeScrollbarLayerImpl> scrollbarLayer(FakeScrollbarLayerImpl::create(m_hostImpl.get(), layerId++)); |
scrollbarLayer->setBounds(gfx::Size(10, 10)); |
scrollbarLayer->setContentBounds(gfx::Size(10, 10)); |
scrollbarLayer->setDrawsContent(true); |
- scrollbarLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
scrollbarLayer->createResources(m_hostImpl->resourceProvider()); |
rootLayer->addChild(scrollbarLayer.PassAs<LayerImpl>()); |
- scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer(DelegatedRendererLayerImpl::create(layerId++)); |
+ scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer(DelegatedRendererLayerImpl::create(m_hostImpl.get(), layerId++)); |
delegatedRendererLayer->setBounds(gfx::Size(10, 10)); |
delegatedRendererLayer->setContentBounds(gfx::Size(10, 10)); |
delegatedRendererLayer->setDrawsContent(true); |
- delegatedRendererLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
ScopedPtrVector<RenderPass> passList; |
passList.append(createRenderPassWithResource(m_hostImpl->resourceProvider())); |
delegatedRendererLayer->setRenderPasses(passList); |
@@ -3003,11 +3000,11 @@ private: |
TEST_P(LayerTreeHostImplTest, layersFreeTextures) |
{ |
- scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(1)); |
+ scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(m_hostImpl.get(), 1)); |
rootLayer->setBounds(gfx::Size(10, 10)); |
rootLayer->setAnchorPoint(gfx::PointF(0, 0)); |
- scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(2); |
+ scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(m_hostImpl.get(), 2); |
tileLayer->setBounds(gfx::Size(10, 10)); |
tileLayer->setAnchorPoint(gfx::PointF(0, 0)); |
tileLayer->setContentBounds(gfx::Size(10, 10)); |
@@ -3019,7 +3016,7 @@ TEST_P(LayerTreeHostImplTest, layersFreeTextures) |
tileLayer->pushTileProperties(0, 0, 1, gfx::Rect(0, 0, 10, 10), false); |
rootLayer->addChild(tileLayer.PassAs<LayerImpl>()); |
- scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(3); |
+ scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(m_hostImpl.get(), 3); |
textureLayer->setBounds(gfx::Size(10, 10)); |
textureLayer->setAnchorPoint(gfx::PointF(0, 0)); |
textureLayer->setContentBounds(gfx::Size(10, 10)); |
@@ -3030,21 +3027,19 @@ TEST_P(LayerTreeHostImplTest, layersFreeTextures) |
VideoLayerImpl::FrameUnwrapper unwrapper = |
base::Bind(FakeVideoFrame::toVideoFrame); |
FakeVideoFrameProvider provider; |
- scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(4, &provider, unwrapper); |
+ scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(m_hostImpl.get(), 4, &provider, unwrapper); |
videoLayer->setBounds(gfx::Size(10, 10)); |
videoLayer->setAnchorPoint(gfx::PointF(0, 0)); |
videoLayer->setContentBounds(gfx::Size(10, 10)); |
videoLayer->setDrawsContent(true); |
- videoLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
rootLayer->addChild(videoLayer.PassAs<LayerImpl>()); |
- scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(5); |
+ scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(m_hostImpl.get(), 5); |
ioSurfaceLayer->setBounds(gfx::Size(10, 10)); |
ioSurfaceLayer->setAnchorPoint(gfx::PointF(0, 0)); |
ioSurfaceLayer->setContentBounds(gfx::Size(10, 10)); |
ioSurfaceLayer->setDrawsContent(true); |
ioSurfaceLayer->setIOSurfaceProperties(1, gfx::Size(10, 10)); |
- ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
rootLayer->addChild(ioSurfaceLayer.PassAs<LayerImpl>()); |
// Lose the WebGraphicsContext3D, replacing it with a TrackingWebGraphicsContext3D (which the LayerTreeHostImpl takes ownership of). |
@@ -3063,7 +3058,7 @@ TEST_P(LayerTreeHostImplTest, layersFreeTextures) |
EXPECT_GT(trackingWebGraphicsContext3D->numTextures(), 0u); |
// Kill the layer tree. |
- m_hostImpl->setRootLayer(LayerImpl::create(100)); |
+ m_hostImpl->setRootLayer(LayerImpl::create(m_hostImpl.get(), 100)); |
// There should be no textures left in use after. |
EXPECT_EQ(0u, trackingWebGraphicsContext3D->numTextures()); |
} |
@@ -3080,32 +3075,33 @@ TEST_P(LayerTreeHostImplTest, hasTransparentBackground) |
MockDrawQuadsToFillScreenContext* mockContext = static_cast<MockDrawQuadsToFillScreenContext*>(outputSurface->context3D()); |
// Run test case |
- scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, outputSurface.Pass(), LayerImpl::create(1)); |
- myHostImpl->setBackgroundColor(SK_ColorWHITE); |
+ createLayerTreeHost(false, outputSurface.Pass()); |
+ setupRootLayerImpl(LayerImpl::create(m_hostImpl.get(), 1)); |
+ m_hostImpl->setBackgroundColor(SK_ColorWHITE); |
// Verify one quad is drawn when transparent background set is not set. |
- myHostImpl->setHasTransparentBackground(false); |
+ m_hostImpl->setHasTransparentBackground(false); |
EXPECT_CALL(*mockContext, useProgram(_)) |
.Times(1); |
EXPECT_CALL(*mockContext, drawElements(_, _, _, _)) |
.Times(1); |
LayerTreeHostImpl::FrameData frame; |
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); |
- myHostImpl->drawLayers(frame); |
- myHostImpl->didDrawAllLayers(frame); |
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
+ m_hostImpl->drawLayers(frame); |
+ m_hostImpl->didDrawAllLayers(frame); |
Mock::VerifyAndClearExpectations(&mockContext); |
// Verify no quads are drawn when transparent background is set. |
- myHostImpl->setHasTransparentBackground(true); |
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); |
- myHostImpl->drawLayers(frame); |
- myHostImpl->didDrawAllLayers(frame); |
+ m_hostImpl->setHasTransparentBackground(true); |
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
+ m_hostImpl->drawLayers(frame); |
+ m_hostImpl->didDrawAllLayers(frame); |
Mock::VerifyAndClearExpectations(&mockContext); |
} |
static void addDrawingLayerTo(LayerImpl* parent, int id, const gfx::Rect& layerRect, LayerImpl** result) |
{ |
- scoped_ptr<LayerImpl> layer = FakeLayerWithQuads::create(id); |
+ scoped_ptr<LayerImpl> layer = FakeLayerWithQuads::create(parent->layerTreeHostImpl(), id); |
LayerImpl* layerPtr = layer.get(); |
layerPtr->setAnchorPoint(gfx::PointF(0, 0)); |
layerPtr->setPosition(gfx::PointF(layerRect.origin())); |
@@ -3125,7 +3121,7 @@ static void setupLayersForTextureCaching(LayerTreeHostImpl* layerTreeHostImpl, L |
layerTreeHostImpl->initializeRenderer(outputSurface.Pass()); |
layerTreeHostImpl->setViewportSize(rootSize, rootSize); |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(layerTreeHostImpl, 1); |
rootPtr = root.get(); |
root->setAnchorPoint(gfx::PointF(0, 0)); |
@@ -3171,7 +3167,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithClipping) |
myHostImpl->initializeRenderer(outputSurface.Pass()); |
myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height())); |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(myHostImpl.get(), 1); |
rootPtr = root.get(); |
root->setAnchorPoint(gfx::PointF(0, 0)); |
@@ -3282,7 +3278,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusion) |
myHostImpl->initializeRenderer(outputSurface.Pass()); |
myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height())); |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(myHostImpl.get(), 1); |
rootPtr = root.get(); |
root->setAnchorPoint(gfx::PointF(0, 0)); |
@@ -3393,7 +3389,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) |
myHostImpl->initializeRenderer(outputSurface.Pass()); |
myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height())); |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(myHostImpl.get(), 1); |
rootPtr = root.get(); |
root->setAnchorPoint(gfx::PointF(0, 0)); |
@@ -3505,7 +3501,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) |
myHostImpl->initializeRenderer(outputSurface.Pass()); |
myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height())); |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(myHostImpl.get(), 1); |
rootPtr = root.get(); |
root->setAnchorPoint(gfx::PointF(0, 0)); |
@@ -3586,7 +3582,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) |
myHostImpl->initializeRenderer(outputSurface.Pass()); |
myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height())); |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(myHostImpl.get(), 1); |
rootPtr = root.get(); |
root->setAnchorPoint(gfx::PointF(0, 0)); |
@@ -3670,7 +3666,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) |
myHostImpl->initializeRenderer(outputSurface.Pass()); |
myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height())); |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(myHostImpl.get(), 1); |
rootPtr = root.get(); |
root->setAnchorPoint(gfx::PointF(0, 0)); |
@@ -3774,9 +3770,9 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithScissor) |
Layers 1, 2 have render surfaces |
*/ |
- scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
- scoped_ptr<TiledLayerImpl> child = TiledLayerImpl::create(2); |
- scoped_ptr<LayerImpl> grandChild = LayerImpl::create(3); |
+ scoped_ptr<LayerImpl> root = LayerImpl::create(myHostImpl.get(), 1); |
+ scoped_ptr<TiledLayerImpl> child = TiledLayerImpl::create(myHostImpl.get(), 2); |
+ scoped_ptr<LayerImpl> grandChild = LayerImpl::create(myHostImpl.get(), 3); |
gfx::Rect rootRect(0, 0, 100, 100); |
gfx::Rect childRect(10, 10, 50, 50); |