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 84939bc79568acace54605be588bc3b31566ac4f..c6927954ab30ca831609aeed2e33f1e4846f8de9 100644 |
--- a/cc/layer_tree_host_impl_unittest.cc |
+++ b/cc/layer_tree_host_impl_unittest.cc |
@@ -120,6 +120,7 @@ public: |
root->setContentBounds(gfx::Size(10, 10)); |
root->setDrawsContent(true); |
root->drawProperties().visible_content_rect = gfx::Rect(0, 0, 10, 10); |
+ root->setLayerTreeHostImpl(myHostImpl.get()); |
myHostImpl->setRootLayer(root.Pass()); |
return myHostImpl.Pass(); |
} |
@@ -168,6 +169,7 @@ public: |
root->setContentBounds(contentSize); |
root->setPosition(gfx::PointF(0, 0)); |
root->setAnchorPoint(gfx::PointF(0, 0)); |
+ root->setLayerTreeHostImpl(m_hostImpl.get()); |
scoped_ptr<LayerImpl> contents = LayerImpl::create(2); |
contents->setDrawsContent(true); |
@@ -175,11 +177,12 @@ public: |
contents->setContentBounds(contentSize); |
contents->setPosition(gfx::PointF(0, 0)); |
contents->setAnchorPoint(gfx::PointF(0, 0)); |
+ contents->setLayerTreeHostImpl(m_hostImpl.get()); |
root->addChild(contents.Pass()); |
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); |
layer->setScrollable(true); |
@@ -187,6 +190,7 @@ public: |
layer->setBounds(size); |
layer->setContentBounds(size); |
layer->setMaxScrollOffset(gfx::Vector2d(size.width() * 2, size.height() * 2)); |
+ layer->setLayerTreeHostImpl(m_hostImpl.get()); |
return layer.Pass(); |
} |
@@ -929,9 +933,12 @@ TEST_P(LayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) |
m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); |
DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); |
root->setMasksToBounds(true); |
+ root->setLayerTreeHostImpl(m_hostImpl.get()); |
root->addChild(DidDrawCheckLayer::create(2)); |
DidDrawCheckLayer* layer = static_cast<DidDrawCheckLayer*>(root->children()[0]); |
+ layer->setLayerTreeHostImpl(m_hostImpl.get()); |
+ |
// Ensure visibleContentRect for layer is empty |
layer->setPosition(gfx::PointF(100, 100)); |
layer->setBounds(gfx::Size(10, 10)); |
@@ -974,12 +981,15 @@ TEST_P(LayerTreeHostImplTest, willDrawNotCalledOnOccludedLayer) |
m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); |
DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); |
+ root->setLayerTreeHostImpl(m_hostImpl.get()); |
root->addChild(DidDrawCheckLayer::create(2)); |
DidDrawCheckLayer* occludedLayer = static_cast<DidDrawCheckLayer*>(root->children()[0]); |
+ occludedLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
root->addChild(DidDrawCheckLayer::create(3)); |
DidDrawCheckLayer* topLayer = static_cast<DidDrawCheckLayer*>(root->children()[1]); |
+ topLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
// This layer covers the occludedLayer above. Make this layer large so it can occlude. |
topLayer->setBounds(bigSize); |
topLayer->setContentBounds(bigSize); |
@@ -1006,12 +1016,15 @@ TEST_P(LayerTreeHostImplTest, didDrawCalledOnAllLayers) |
{ |
m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); |
DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); |
+ root->setLayerTreeHostImpl(m_hostImpl.get()); |
root->addChild(DidDrawCheckLayer::create(2)); |
DidDrawCheckLayer* layer1 = static_cast<DidDrawCheckLayer*>(root->children()[0]); |
+ layer1->setLayerTreeHostImpl(m_hostImpl.get()); |
layer1->addChild(DidDrawCheckLayer::create(3)); |
DidDrawCheckLayer* layer2 = static_cast<DidDrawCheckLayer*>(layer1->children()[0]); |
+ layer2->setLayerTreeHostImpl(m_hostImpl.get()); |
layer1->setOpacity(0.3f); |
layer1->setPreserves3D(false); |
@@ -1063,6 +1076,8 @@ TEST_P(LayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) |
m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); |
DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); |
root->addChild(MissingTextureAnimatingLayer::create(2, false, false, true, m_hostImpl->resourceProvider())); |
+ root->setLayerTreeHostImpl(m_hostImpl.get()); |
+ root->children()[0]->setLayerTreeHostImpl(m_hostImpl.get()); |
LayerTreeHostImpl::FrameData frame; |
@@ -1074,6 +1089,8 @@ TEST_P(LayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) |
m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); |
root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); |
root->addChild(MissingTextureAnimatingLayer::create(2, true, false, false, m_hostImpl->resourceProvider())); |
+ root->setLayerTreeHostImpl(m_hostImpl.get()); |
+ root->children()[0]->setLayerTreeHostImpl(m_hostImpl.get()); |
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
m_hostImpl->drawLayers(frame); |
@@ -1083,6 +1100,8 @@ TEST_P(LayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) |
m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); |
root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); |
root->addChild(MissingTextureAnimatingLayer::create(2, true, false, true, m_hostImpl->resourceProvider())); |
+ root->setLayerTreeHostImpl(m_hostImpl.get()); |
+ root->children()[0]->setLayerTreeHostImpl(m_hostImpl.get()); |
EXPECT_FALSE(m_hostImpl->prepareToDraw(frame)); |
m_hostImpl->drawLayers(frame); |
@@ -1092,6 +1111,8 @@ TEST_P(LayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) |
m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); |
root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); |
root->addChild(MissingTextureAnimatingLayer::create(2, false, true, true, m_hostImpl->resourceProvider())); |
+ root->setLayerTreeHostImpl(m_hostImpl.get()); |
+ root->children()[0]->setLayerTreeHostImpl(m_hostImpl.get()); |
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
m_hostImpl->drawLayers(frame); |
@@ -1125,6 +1146,7 @@ TEST_P(LayerTreeHostImplTest, scrollNonCompositedRoot) |
contentLayer->setBounds(surfaceSize); |
contentLayer->setContentBounds(gfx::Size(surfaceSize.width() * 2, surfaceSize.height() * 2)); |
contentLayer->setContentsScale(2, 2); |
+ contentLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
scoped_ptr<LayerImpl> scrollLayer = LayerImpl::create(2); |
scrollLayer->setScrollable(true); |
@@ -1134,6 +1156,7 @@ TEST_P(LayerTreeHostImplTest, scrollNonCompositedRoot) |
scrollLayer->setPosition(gfx::PointF(0, 0)); |
scrollLayer->setAnchorPoint(gfx::PointF(0, 0)); |
scrollLayer->addChild(contentLayer.Pass()); |
+ scrollLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
m_hostImpl->setRootLayer(scrollLayer.Pass()); |
m_hostImpl->setViewportSize(surfaceSize, surfaceSize); |
@@ -1152,6 +1175,7 @@ TEST_P(LayerTreeHostImplTest, scrollChildCallsCommitAndRedraw) |
scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
root->setBounds(surfaceSize); |
root->setContentBounds(surfaceSize); |
+ root->setLayerTreeHostImpl(m_hostImpl.get()); |
root->addChild(createScrollableLayer(2, surfaceSize)); |
m_hostImpl->setRootLayer(root.Pass()); |
m_hostImpl->setViewportSize(surfaceSize, surfaceSize); |
@@ -1168,6 +1192,7 @@ TEST_P(LayerTreeHostImplTest, scrollMissesChild) |
{ |
gfx::Size surfaceSize(10, 10); |
scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
+ root->setLayerTreeHostImpl(m_hostImpl.get()); |
root->addChild(createScrollableLayer(2, surfaceSize)); |
m_hostImpl->setRootLayer(root.Pass()); |
m_hostImpl->setViewportSize(surfaceSize, surfaceSize); |
@@ -1183,7 +1208,9 @@ TEST_P(LayerTreeHostImplTest, scrollMissesBackfacingChild) |
{ |
gfx::Size surfaceSize(10, 10); |
scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
+ root->setLayerTreeHostImpl(m_hostImpl.get()); |
scoped_ptr<LayerImpl> child = createScrollableLayer(2, surfaceSize); |
+ child->setLayerTreeHostImpl(m_hostImpl.get()); |
m_hostImpl->setViewportSize(surfaceSize, surfaceSize); |
gfx::Transform matrix; |
@@ -1208,9 +1235,11 @@ TEST_P(LayerTreeHostImplTest, scrollBlockedByContentLayer) |
scoped_ptr<LayerImpl> contentLayer = createScrollableLayer(1, surfaceSize); |
contentLayer->setShouldScrollOnMainThread(true); |
contentLayer->setScrollable(false); |
+ contentLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
scoped_ptr<LayerImpl> scrollLayer = createScrollableLayer(2, surfaceSize); |
scrollLayer->addChild(contentLayer.Pass()); |
+ scrollLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
m_hostImpl->setRootLayer(scrollLayer.Pass()); |
m_hostImpl->setViewportSize(surfaceSize, surfaceSize); |
@@ -1225,6 +1254,7 @@ TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread) |
gfx::Size surfaceSize(10, 10); |
float pageScale = 2; |
scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize); |
+ root->setLayerTreeHostImpl(m_hostImpl.get()); |
m_hostImpl->setRootLayer(root.Pass()); |
m_hostImpl->setViewportSize(surfaceSize, surfaceSize); |
initializeRendererAndDrawFrame(); |
@@ -1277,6 +1307,7 @@ TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread) |
gfx::Size surfaceSize(10, 10); |
float pageScale = 2; |
scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize); |
+ root->setLayerTreeHostImpl(m_hostImpl.get()); |
m_hostImpl->setRootLayer(root.Pass()); |
m_hostImpl->setViewportSize(surfaceSize, surfaceSize); |
m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale); |
@@ -1699,6 +1730,7 @@ TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) |
root->setBounds(gfx::Size(10, 10)); |
root->setContentBounds(root->bounds()); |
root->setDrawsContent(false); |
+ root->setLayerTreeHostImpl(m_hostImpl.get()); |
m_hostImpl->setRootLayer(root.Pass()); |
} |
LayerImpl* root = m_hostImpl->rootLayer(); |
@@ -1706,6 +1738,7 @@ TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) |
root->addChild(BlendStateCheckLayer::create(2, m_hostImpl->resourceProvider())); |
BlendStateCheckLayer* layer1 = static_cast<BlendStateCheckLayer*>(root->children()[0]); |
layer1->setPosition(gfx::PointF(2, 2)); |
+ layer1->setLayerTreeHostImpl(m_hostImpl.get()); |
LayerTreeHostImpl::FrameData frame; |
@@ -1746,6 +1779,7 @@ TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) |
layer1->addChild(BlendStateCheckLayer::create(3, m_hostImpl->resourceProvider())); |
BlendStateCheckLayer* layer2 = static_cast<BlendStateCheckLayer*>(layer1->children()[0]); |
layer2->setPosition(gfx::PointF(4, 4)); |
+ layer2->setLayerTreeHostImpl(m_hostImpl.get()); |
// 2 opaque layers, drawn without blending. |
layer1->setContentsOpaque(true); |
@@ -1893,9 +1927,11 @@ TEST_P(LayerTreeHostImplTest, viewportCovered) |
m_hostImpl->setRootLayer(LayerImpl::create(1)); |
m_hostImpl->rootLayer()->addChild(BlendStateCheckLayer::create(2, m_hostImpl->resourceProvider())); |
+ m_hostImpl->rootLayer()->setLayerTreeHostImpl(m_hostImpl.get()); |
BlendStateCheckLayer* child = static_cast<BlendStateCheckLayer*>(m_hostImpl->rootLayer()->children()[0]); |
child->setExpectation(false, false); |
child->setContentsOpaque(true); |
+ child->setLayerTreeHostImpl(m_hostImpl.get()); |
// No gutter rects |
{ |
@@ -1907,6 +1943,7 @@ TEST_P(LayerTreeHostImplTest, viewportCovered) |
child->setQuadVisibleRect(gfx::Rect(gfx::Point(), layerRect.size())); |
LayerTreeHostImpl::FrameData frame; |
+ EXPECT_TRUE(m_hostImpl->needsUpdateLayers()); |
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
ASSERT_EQ(1u, frame.renderPasses.size()); |
@@ -1930,9 +1967,9 @@ TEST_P(LayerTreeHostImplTest, viewportCovered) |
child->setQuadVisibleRect(gfx::Rect(gfx::Point(), layerRect.size())); |
LayerTreeHostImpl::FrameData frame; |
+ EXPECT_TRUE(m_hostImpl->needsUpdateLayers()); |
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
ASSERT_EQ(1u, frame.renderPasses.size()); |
- m_hostImpl->didDrawAllLayers(frame); |
size_t numGutterQuads = 0; |
for (size_t i = 0; i < frame.renderPasses[0]->quad_list.size(); ++i) |
@@ -1954,6 +1991,7 @@ TEST_P(LayerTreeHostImplTest, viewportCovered) |
child->setQuadVisibleRect(gfx::Rect(gfx::Point(), layerRect.size())); |
LayerTreeHostImpl::FrameData frame; |
+ EXPECT_TRUE(m_hostImpl->needsUpdateLayers()); |
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
ASSERT_EQ(1u, frame.renderPasses.size()); |
@@ -2058,11 +2096,13 @@ TEST_P(LayerTreeHostImplTest, partialSwapReceivesDamageRect) |
child->setBounds(gfx::Size(14, 15)); |
child->setContentBounds(gfx::Size(14, 15)); |
child->setDrawsContent(true); |
+ child->setLayerTreeHostImpl(layerTreeHostImpl.get()); |
root->setAnchorPoint(gfx::PointF(0, 0)); |
root->setBounds(gfx::Size(500, 500)); |
root->setContentBounds(gfx::Size(500, 500)); |
root->setDrawsContent(true); |
root->addChild(child.Pass()); |
+ root->setLayerTreeHostImpl(layerTreeHostImpl.get()); |
layerTreeHostImpl->setRootLayer(root.Pass()); |
LayerTreeHostImpl::FrameData frame; |
@@ -2120,12 +2160,14 @@ TEST_P(LayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) |
child->setBounds(gfx::Size(10, 10)); |
child->setContentBounds(gfx::Size(10, 10)); |
child->setDrawsContent(true); |
+ child->setLayerTreeHostImpl(m_hostImpl.get()); |
root->setAnchorPoint(gfx::PointF(0, 0)); |
root->setBounds(gfx::Size(10, 10)); |
root->setContentBounds(gfx::Size(10, 10)); |
root->setDrawsContent(true); |
root->setOpacity(0.7f); |
root->addChild(child.Pass()); |
+ root->setLayerTreeHostImpl(m_hostImpl.get()); |
m_hostImpl->setRootLayer(root.Pass()); |
@@ -2386,6 +2428,7 @@ static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay |
root->drawProperties().visible_content_rect = rootRect; |
root->setDrawsContent(false); |
root->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), gfx::Size(rootRect.width(), rootRect.height()))); |
+ root->setLayerTreeHostImpl(myHostImpl.get()); |
child->setAnchorPoint(gfx::PointF(0, 0)); |
child->setPosition(gfx::PointF(childRect.x(), childRect.y())); |
@@ -2395,6 +2438,7 @@ static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay |
child->drawProperties().visible_content_rect = childRect; |
child->setDrawsContent(false); |
child->setForceRenderSurface(true); |
+ child->setLayerTreeHostImpl(myHostImpl.get()); |
grandChild->setAnchorPoint(gfx::PointF(0, 0)); |
grandChild->setPosition(gfx::Point(grandChildRect.x(), grandChildRect.y())); |
@@ -2402,6 +2446,7 @@ static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay |
grandChild->setContentBounds(grandChild->bounds()); |
grandChild->drawProperties().visible_content_rect = grandChildRect; |
grandChild->setDrawsContent(true); |
+ grandChild->setLayerTreeHostImpl(myHostImpl.get()); |
child->addChild(grandChild.Pass()); |
root->addChild(child.Pass()); |
@@ -2790,6 +2835,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) |
scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(layerId++)); |
rootLayer->setBounds(gfx::Size(10, 10)); |
rootLayer->setAnchorPoint(gfx::PointF(0, 0)); |
+ rootLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(layerId++); |
tileLayer->setBounds(gfx::Size(10, 10)); |
@@ -2801,6 +2847,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) |
tilingData->setBounds(gfx::Size(10, 10)); |
tileLayer->setTilingData(*tilingData); |
tileLayer->pushTileProperties(0, 0, 1, gfx::Rect(0, 0, 10, 10), false); |
+ tileLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
rootLayer->addChild(tileLayer.PassAs<LayerImpl>()); |
scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(layerId++); |
@@ -2809,6 +2856,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) |
textureLayer->setContentBounds(gfx::Size(10, 10)); |
textureLayer->setDrawsContent(true); |
textureLayer->setTextureId(StrictWebGraphicsContext3D::kExternalTextureId); |
+ textureLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
rootLayer->addChild(textureLayer.PassAs<LayerImpl>()); |
scoped_ptr<TiledLayerImpl> maskLayer = TiledLayerImpl::create(layerId++); |
@@ -2819,6 +2867,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) |
maskLayer->setSkipsDraw(false); |
maskLayer->setTilingData(*tilingData); |
maskLayer->pushTileProperties(0, 0, 1, gfx::Rect(0, 0, 10, 10), false); |
+ maskLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
scoped_ptr<TextureLayerImpl> textureLayerWithMask = TextureLayerImpl::create(layerId++); |
textureLayerWithMask->setBounds(gfx::Size(10, 10)); |
@@ -2827,6 +2876,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) |
textureLayerWithMask->setDrawsContent(true); |
textureLayerWithMask->setTextureId(StrictWebGraphicsContext3D::kExternalTextureId); |
textureLayerWithMask->setMaskLayer(maskLayer.PassAs<LayerImpl>()); |
+ textureLayerWithMask->setLayerTreeHostImpl(m_hostImpl.get()); |
rootLayer->addChild(textureLayerWithMask.PassAs<LayerImpl>()); |
FakeVideoFrame videoFrame(VideoFrame::CreateColorFrame(gfx::Size(4, 4), |
@@ -3006,6 +3056,7 @@ TEST_P(LayerTreeHostImplTest, layersFreeTextures) |
scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(1)); |
rootLayer->setBounds(gfx::Size(10, 10)); |
rootLayer->setAnchorPoint(gfx::PointF(0, 0)); |
+ rootLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(2); |
tileLayer->setBounds(gfx::Size(10, 10)); |
@@ -3017,6 +3068,7 @@ TEST_P(LayerTreeHostImplTest, layersFreeTextures) |
tilingData->setBounds(gfx::Size(10, 10)); |
tileLayer->setTilingData(*tilingData); |
tileLayer->pushTileProperties(0, 0, 1, gfx::Rect(0, 0, 10, 10), false); |
+ tileLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
rootLayer->addChild(tileLayer.PassAs<LayerImpl>()); |
scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(3); |
@@ -3025,6 +3077,7 @@ TEST_P(LayerTreeHostImplTest, layersFreeTextures) |
textureLayer->setContentBounds(gfx::Size(10, 10)); |
textureLayer->setDrawsContent(true); |
textureLayer->setTextureId(1); |
+ textureLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
rootLayer->addChild(textureLayer.PassAs<LayerImpl>()); |
VideoLayerImpl::FrameUnwrapper unwrapper = |
@@ -3113,6 +3166,7 @@ static void addDrawingLayerTo(LayerImpl* parent, int id, const gfx::Rect& layerR |
layerPtr->setContentBounds(layerRect.size()); |
layerPtr->setDrawsContent(true); // only children draw content |
layerPtr->setContentsOpaque(true); |
+ layerPtr->setLayerTreeHostImpl(parent ? parent->layerTreeHostImpl() : 0); |
parent->addChild(layer.Pass()); |
if (result) |
*result = layerPtr; |
@@ -3133,6 +3187,7 @@ static void setupLayersForTextureCaching(LayerTreeHostImpl* layerTreeHostImpl, L |
root->setBounds(rootSize); |
root->setContentBounds(rootSize); |
root->setDrawsContent(true); |
+ root->setLayerTreeHostImpl(layerTreeHostImpl); |
layerTreeHostImpl->setRootLayer(root.Pass()); |
addDrawingLayerTo(rootPtr, 2, gfx::Rect(10, 10, rootSize.width(), rootSize.height()), &intermediateLayerPtr); |
@@ -3180,6 +3235,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithClipping) |
root->setContentBounds(rootSize); |
root->setDrawsContent(true); |
root->setMasksToBounds(true); |
+ root->setLayerTreeHostImpl(myHostImpl.get()); |
myHostImpl->setRootLayer(root.Pass()); |
addDrawingLayerTo(rootPtr, 3, gfx::Rect(0, 0, rootSize.width(), rootSize.height()), &surfaceLayerPtr); |
@@ -3291,16 +3347,20 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusion) |
root->setContentBounds(rootSize); |
root->setDrawsContent(true); |
root->setMasksToBounds(true); |
+ root->setLayerTreeHostImpl(myHostImpl.get()); |
+ root->setLayerTreeHostImpl(myHostImpl.get()); |
myHostImpl->setRootLayer(root.Pass()); |
addDrawingLayerTo(rootPtr, 2, gfx::Rect(300, 300, 300, 300), &layerS1Ptr); |
layerS1Ptr->setForceRenderSurface(true); |
+ layerS1Ptr->setLayerTreeHostImpl(myHostImpl.get()); |
addDrawingLayerTo(layerS1Ptr, 3, gfx::Rect(10, 10, 10, 10), 0); // L11 |
addDrawingLayerTo(layerS1Ptr, 4, gfx::Rect(0, 0, 30, 30), 0); // L12 |
addDrawingLayerTo(rootPtr, 5, gfx::Rect(550, 250, 300, 400), &layerS2Ptr); |
layerS2Ptr->setForceRenderSurface(true); |
+ layerS2Ptr->setLayerTreeHostImpl(myHostImpl.get()); |
addDrawingLayerTo(layerS2Ptr, 6, gfx::Rect(20, 20, 5, 5), 0); // L21 |
@@ -3350,6 +3410,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusion) |
transform = layerS2Ptr->transform(); |
transform.Translate(-15, -15); |
layerS2Ptr->setTransform(transform); |
+ EXPECT_TRUE(myHostImpl->needsUpdateLayers()); |
{ |
LayerTreeHostImpl::FrameData frame; |
EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); |
@@ -3402,6 +3463,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) |
root->setContentBounds(rootSize); |
root->setDrawsContent(true); |
root->setMasksToBounds(true); |
+ root->setLayerTreeHostImpl(myHostImpl.get()); |
myHostImpl->setRootLayer(root.Pass()); |
addDrawingLayerTo(rootPtr, 2, gfx::Rect(0, 0, 800, 800), &layerS1Ptr); |
@@ -3514,6 +3576,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) |
root->setContentBounds(rootSize); |
root->setDrawsContent(true); |
root->setMasksToBounds(true); |
+ root->setLayerTreeHostImpl(myHostImpl.get()); |
myHostImpl->setRootLayer(root.Pass()); |
addDrawingLayerTo(rootPtr, 2, gfx::Rect(0, 0, 400, 400), &layerS1Ptr); |
@@ -3595,6 +3658,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) |
root->setContentBounds(rootSize); |
root->setDrawsContent(true); |
root->setMasksToBounds(true); |
+ root->setLayerTreeHostImpl(myHostImpl.get()); |
myHostImpl->setRootLayer(root.Pass()); |
addDrawingLayerTo(rootPtr, 2, gfx::Rect(0, 0, 400, 400), &layerS1Ptr); |
@@ -3679,6 +3743,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) |
root->setContentBounds(rootSize); |
root->setDrawsContent(true); |
root->setMasksToBounds(true); |
+ root->setLayerTreeHostImpl(myHostImpl.get()); |
myHostImpl->setRootLayer(root.Pass()); |
addDrawingLayerTo(rootPtr, 2, gfx::Rect(300, 300, 300, 300), &layerS1Ptr); |
@@ -3791,6 +3856,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithScissor) |
root->setContentBounds(root->bounds()); |
root->setDrawsContent(true); |
root->setMasksToBounds(true); |
+ root->setLayerTreeHostImpl(myHostImpl.get()); |
child->setAnchorPoint(gfx::PointF(0, 0)); |
child->setPosition(gfx::PointF(childRect.x(), childRect.y())); |
@@ -3799,6 +3865,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithScissor) |
child->setContentBounds(child->bounds()); |
child->setDrawsContent(true); |
child->setSkipsDraw(false); |
+ child->setLayerTreeHostImpl(myHostImpl.get()); |
// child layer has 10x10 tiles. |
scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(gfx::Size(10, 10), LayerTilingData::HasBorderTexels); |
@@ -3810,6 +3877,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithScissor) |
grandChild->setBounds(gfx::Size(grandChildRect.width(), grandChildRect.height())); |
grandChild->setContentBounds(grandChild->bounds()); |
grandChild->setDrawsContent(true); |
+ grandChild->setLayerTreeHostImpl(myHostImpl.get()); |
TiledLayerImpl* childPtr = child.get(); |
RenderPass::Id childPassId(childPtr->id(), 0); |