diff options
73 files changed, 466 insertions, 442 deletions
diff --git a/cc/damage_tracker_unittest.cc b/cc/damage_tracker_unittest.cc index aec754b..53fd43e 100644 --- a/cc/damage_tracker_unittest.cc +++ b/cc/damage_tracker_unittest.cc @@ -74,8 +74,8 @@ public: scoped_ptr<LayerImpl> createTestTreeWithOneSurface() { - scoped_ptr<LayerImpl> root = LayerImpl::create(&m_hostImpl, 1); - scoped_ptr<LayerImpl> child = LayerImpl::create(&m_hostImpl, 2); + scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.activeTree(), 1); + scoped_ptr<LayerImpl> child = LayerImpl::create(m_hostImpl.activeTree(), 2); root->setPosition(gfx::PointF()); root->setAnchorPoint(gfx::PointF()); @@ -101,11 +101,11 @@ public: // child1. Additionally, the root has a second child layer, and child1 has two // children of its own. - scoped_ptr<LayerImpl> root = LayerImpl::create(&m_hostImpl, 1); - scoped_ptr<LayerImpl> child1 = LayerImpl::create(&m_hostImpl, 2); - scoped_ptr<LayerImpl> child2 = LayerImpl::create(&m_hostImpl, 3); - scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(&m_hostImpl, 4); - scoped_ptr<LayerImpl> grandChild2 = LayerImpl::create(&m_hostImpl, 5); + scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.activeTree(), 1); + scoped_ptr<LayerImpl> child1 = LayerImpl::create(m_hostImpl.activeTree(), 2); + scoped_ptr<LayerImpl> child2 = LayerImpl::create(m_hostImpl.activeTree(), 3); + scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(m_hostImpl.activeTree(), 4); + scoped_ptr<LayerImpl> grandChild2 = LayerImpl::create(m_hostImpl.activeTree(), 5); root->setPosition(gfx::PointF()); root->setAnchorPoint(gfx::PointF()); @@ -536,7 +536,7 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingLayer) // clearDamageForAllSurfaces(root.get()); { - scoped_ptr<LayerImpl> child2 = LayerImpl::create(&m_hostImpl, 3); + scoped_ptr<LayerImpl> child2 = LayerImpl::create(m_hostImpl.activeTree(), 3); child2->setPosition(gfx::PointF(400, 380)); child2->setAnchorPoint(gfx::PointF()); child2->setBounds(gfx::Size(6, 8)); @@ -577,7 +577,7 @@ TEST_F(DamageTrackerTest, verifyDamageForNewUnchangedLayer) clearDamageForAllSurfaces(root.get()); { - scoped_ptr<LayerImpl> child2 = LayerImpl::create(&m_hostImpl, 3); + scoped_ptr<LayerImpl> child2 = LayerImpl::create(m_hostImpl.activeTree(), 3); child2->setPosition(gfx::PointF(400, 380)); child2->setAnchorPoint(gfx::PointF()); child2->setBounds(gfx::Size(6, 8)); @@ -607,7 +607,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers) // In this test we don't want the above tree manipulation to be considered part of the same frame. clearDamageForAllSurfaces(root.get()); { - scoped_ptr<LayerImpl> child2 = LayerImpl::create(&m_hostImpl, 3); + scoped_ptr<LayerImpl> child2 = LayerImpl::create(m_hostImpl.activeTree(), 3); child2->setPosition(gfx::PointF(400, 380)); child2->setAnchorPoint(gfx::PointF()); child2->setBounds(gfx::Size(6, 8)); @@ -828,7 +828,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica) // contentBounds of the surface. grandChild2->setPosition(gfx::PointF(180, 180)); { - scoped_ptr<LayerImpl> grandChild3 = LayerImpl::create(&m_hostImpl, 6); + scoped_ptr<LayerImpl> grandChild3 = LayerImpl::create(m_hostImpl.activeTree(), 6); grandChild3->setPosition(gfx::PointF(240, 240)); grandChild3->setAnchorPoint(gfx::PointF()); grandChild3->setBounds(gfx::Size(10, 10)); @@ -843,7 +843,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica) // clearDamageForAllSurfaces(root.get()); { - scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(&m_hostImpl, 7); + scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(m_hostImpl.activeTree(), 7); grandChild1Replica->setPosition(gfx::PointF()); grandChild1Replica->setAnchorPoint(gfx::PointF()); gfx::Transform reflection; @@ -911,7 +911,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask) // Set up the mask layer. { - scoped_ptr<LayerImpl> maskLayer = LayerImpl::create(&m_hostImpl, 3); + scoped_ptr<LayerImpl> maskLayer = LayerImpl::create(m_hostImpl.activeTree(), 3); maskLayer->setPosition(child->position()); maskLayer->setAnchorPoint(gfx::PointF()); maskLayer->setBounds(child->bounds()); @@ -923,7 +923,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask) // Add opacity and a grandChild so that the render surface persists even after we remove the mask. child->setOpacity(0.5); { - scoped_ptr<LayerImpl> grandChild = LayerImpl::create(&m_hostImpl, 4); + scoped_ptr<LayerImpl> grandChild = LayerImpl::create(m_hostImpl.activeTree(), 4); grandChild->setPosition(gfx::PointF(2, 2)); grandChild->setAnchorPoint(gfx::PointF()); grandChild->setBounds(gfx::Size(2, 2)); @@ -996,7 +996,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask) // Create a reflection about the left edge of grandChild1. { - scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(&m_hostImpl, 6); + scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(m_hostImpl.activeTree(), 6); grandChild1Replica->setPosition(gfx::PointF()); grandChild1Replica->setAnchorPoint(gfx::PointF()); gfx::Transform reflection; @@ -1008,7 +1008,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask) // Set up the mask layer on the replica layer { - scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(&m_hostImpl, 7); + scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(m_hostImpl.activeTree(), 7); replicaMaskLayer->setPosition(gfx::PointF()); replicaMaskLayer->setAnchorPoint(gfx::PointF()); replicaMaskLayer->setBounds(grandChild1->bounds()); @@ -1058,7 +1058,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) grandChild1->setAnchorPoint(gfx::PointF(1, 0)); // This is not exactly the anchor being tested, but by convention its expected to be the same as the replica's anchor point. { - scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(&m_hostImpl, 6); + scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(m_hostImpl.activeTree(), 6); grandChild1Replica->setPosition(gfx::PointF()); grandChild1Replica->setAnchorPoint(gfx::PointF(1, 0)); // This is the anchor being tested. gfx::Transform reflection; @@ -1070,7 +1070,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) // Set up the mask layer on the replica layer { - scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(&m_hostImpl, 7); + scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(m_hostImpl.activeTree(), 7); replicaMaskLayer->setPosition(gfx::PointF()); replicaMaskLayer->setAnchorPoint(gfx::PointF()); // note, this is not the anchor being tested. replicaMaskLayer->setBounds(grandChild1->bounds()); @@ -1124,7 +1124,7 @@ TEST_F(DamageTrackerTest, verifyDamageForEmptyLayerList) // Though it should never happen, its a good idea to verify that the damage tracker // does not crash when it receives an empty layerList. - scoped_ptr<LayerImpl> root = LayerImpl::create(&m_hostImpl, 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.activeTree(), 1); root->createRenderSurface(); ASSERT_TRUE(root == root->renderTarget()); diff --git a/cc/delegated_renderer_layer.cc b/cc/delegated_renderer_layer.cc index a1c7853..3426e53 100644 --- a/cc/delegated_renderer_layer.cc +++ b/cc/delegated_renderer_layer.cc @@ -24,9 +24,9 @@ DelegatedRendererLayer::~DelegatedRendererLayer() { } -scoped_ptr<LayerImpl> DelegatedRendererLayer::createLayerImpl(LayerTreeHostImpl* hostImpl) +scoped_ptr<LayerImpl> DelegatedRendererLayer::createLayerImpl(LayerTreeImpl* treeImpl) { - return DelegatedRendererLayerImpl::create(hostImpl, m_layerId).PassAs<LayerImpl>(); + return DelegatedRendererLayerImpl::create(treeImpl, m_layerId).PassAs<LayerImpl>(); } } // namespace cc diff --git a/cc/delegated_renderer_layer.h b/cc/delegated_renderer_layer.h index 11a53a9..aecf17b 100644 --- a/cc/delegated_renderer_layer.h +++ b/cc/delegated_renderer_layer.h @@ -14,7 +14,7 @@ class CC_EXPORT DelegatedRendererLayer : public Layer { public: static scoped_refptr<DelegatedRendererLayer> create(); - virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeHostImpl* hostImpl) OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERRIDE; protected: DelegatedRendererLayer(); diff --git a/cc/delegated_renderer_layer_impl.cc b/cc/delegated_renderer_layer_impl.cc index 5364c70..5902567 100644 --- a/cc/delegated_renderer_layer_impl.cc +++ b/cc/delegated_renderer_layer_impl.cc @@ -12,8 +12,8 @@ namespace cc { -DelegatedRendererLayerImpl::DelegatedRendererLayerImpl(LayerTreeHostImpl* hostImpl, int id) - : LayerImpl(hostImpl, id) +DelegatedRendererLayerImpl::DelegatedRendererLayerImpl(LayerTreeImpl* treeImpl, int id) + : LayerImpl(treeImpl, id) { } diff --git a/cc/delegated_renderer_layer_impl.h b/cc/delegated_renderer_layer_impl.h index 8ee0f9f..6fbb026 100644 --- a/cc/delegated_renderer_layer_impl.h +++ b/cc/delegated_renderer_layer_impl.h @@ -13,7 +13,7 @@ namespace cc { class CC_EXPORT DelegatedRendererLayerImpl : public LayerImpl { public: - static scoped_ptr<DelegatedRendererLayerImpl> create(LayerTreeHostImpl* hostImpl, int id) { return make_scoped_ptr(new DelegatedRendererLayerImpl(hostImpl, id)); } + static scoped_ptr<DelegatedRendererLayerImpl> create(LayerTreeImpl* treeImpl, int id) { return make_scoped_ptr(new DelegatedRendererLayerImpl(treeImpl, id)); } virtual ~DelegatedRendererLayerImpl(); virtual int descendantsDrawContent() OVERRIDE; @@ -32,7 +32,7 @@ public: virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; private: - DelegatedRendererLayerImpl(LayerTreeHostImpl* hostImpl, int id); + DelegatedRendererLayerImpl(LayerTreeImpl* treeImpl, int id); RenderPass::Id convertDelegatedRenderPassId(RenderPass::Id delegatedRenderPassId) const; diff --git a/cc/delegated_renderer_layer_impl_unittest.cc b/cc/delegated_renderer_layer_impl_unittest.cc index 70dd2f5..ad09308 100644 --- a/cc/delegated_renderer_layer_impl_unittest.cc +++ b/cc/delegated_renderer_layer_impl_unittest.cc @@ -100,10 +100,10 @@ public: DelegatedRendererLayerImplTestSimple() : DelegatedRendererLayerImplTest() { - scoped_ptr<LayerImpl> rootLayer = SolidColorLayerImpl::create(m_hostImpl.get(), 1).PassAs<LayerImpl>(); - scoped_ptr<LayerImpl> layerBefore = SolidColorLayerImpl::create(m_hostImpl.get(), 2).PassAs<LayerImpl>(); - scoped_ptr<LayerImpl> layerAfter = SolidColorLayerImpl::create(m_hostImpl.get(), 3).PassAs<LayerImpl>(); - scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer = DelegatedRendererLayerImpl::create(m_hostImpl.get(), 4); + scoped_ptr<LayerImpl> rootLayer = SolidColorLayerImpl::create(m_hostImpl->activeTree(), 1).PassAs<LayerImpl>(); + scoped_ptr<LayerImpl> layerBefore = SolidColorLayerImpl::create(m_hostImpl->activeTree(), 2).PassAs<LayerImpl>(); + scoped_ptr<LayerImpl> layerAfter = SolidColorLayerImpl::create(m_hostImpl->activeTree(), 3).PassAs<LayerImpl>(); + scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer = DelegatedRendererLayerImpl::create(m_hostImpl->activeTree(), 4); m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); rootLayer->setBounds(gfx::Size(100, 100)); @@ -420,8 +420,8 @@ public: DelegatedRendererLayerImplTestSharedData() : DelegatedRendererLayerImplTest() { - scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(m_hostImpl.get(), 1); - scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer = DelegatedRendererLayerImpl::create(m_hostImpl.get(), 2); + scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(m_hostImpl->activeTree(), 1); + scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer = DelegatedRendererLayerImpl::create(m_hostImpl->activeTree(), 2); m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); rootLayer->setBounds(gfx::Size(100, 100)); diff --git a/cc/gl_renderer_unittest.cc b/cc/gl_renderer_unittest.cc index 48922e3..8521627 100644 --- a/cc/gl_renderer_unittest.cc +++ b/cc/gl_renderer_unittest.cc @@ -62,7 +62,7 @@ public: : m_hostImpl(&m_proxy) , m_setFullRootLayerDamageCount(0) , m_lastCallWasSetVisibility(0) - , m_rootLayer(LayerImpl::create(&m_hostImpl, 1)) + , m_rootLayer(LayerImpl::create(m_hostImpl.activeTree(), 1)) , m_memoryAllocationLimitBytes(PrioritizedResourceManager::defaultMemoryAllocationLimit()) { m_rootLayer->createRenderSurface(); diff --git a/cc/heads_up_display_layer.cc b/cc/heads_up_display_layer.cc index 675c5cf3..71145b7 100644 --- a/cc/heads_up_display_layer.cc +++ b/cc/heads_up_display_layer.cc @@ -59,9 +59,9 @@ void HeadsUpDisplayLayer::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) m_hasFontAtlas = true; } -scoped_ptr<LayerImpl> HeadsUpDisplayLayer::createLayerImpl(LayerTreeHostImpl* hostImpl) +scoped_ptr<LayerImpl> HeadsUpDisplayLayer::createLayerImpl(LayerTreeImpl* treeImpl) { - return HeadsUpDisplayLayerImpl::create(hostImpl, m_layerId).PassAs<LayerImpl>(); + return HeadsUpDisplayLayerImpl::create(treeImpl, m_layerId).PassAs<LayerImpl>(); } void HeadsUpDisplayLayer::pushPropertiesTo(LayerImpl* layerImpl) diff --git a/cc/heads_up_display_layer.h b/cc/heads_up_display_layer.h index 1413243..15061c6 100644 --- a/cc/heads_up_display_layer.h +++ b/cc/heads_up_display_layer.h @@ -20,7 +20,7 @@ public: void setFontAtlas(scoped_ptr<FontAtlas>); - virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeHostImpl* hostImpl) OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERRIDE; virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; bool hasFontAtlas() const { return m_hasFontAtlas; } diff --git a/cc/heads_up_display_layer_impl.cc b/cc/heads_up_display_layer_impl.cc index 287d900..67191d0 100644 --- a/cc/heads_up_display_layer_impl.cc +++ b/cc/heads_up_display_layer_impl.cc @@ -46,8 +46,8 @@ static inline SkPaint createPaint() return paint; } -HeadsUpDisplayLayerImpl::HeadsUpDisplayLayerImpl(LayerTreeHostImpl* hostImpl, int id) - : LayerImpl(hostImpl, id) +HeadsUpDisplayLayerImpl::HeadsUpDisplayLayerImpl(LayerTreeImpl* treeImpl, int id) + : LayerImpl(treeImpl, id) , m_averageFPS(0) , m_minFPS(0) , m_maxFPS(0) diff --git a/cc/heads_up_display_layer_impl.h b/cc/heads_up_display_layer_impl.h index 2d5c03a..70bf03e 100644 --- a/cc/heads_up_display_layer_impl.h +++ b/cc/heads_up_display_layer_impl.h @@ -24,9 +24,9 @@ class FrameRateCounter; class CC_EXPORT HeadsUpDisplayLayerImpl : public LayerImpl { public: - static scoped_ptr<HeadsUpDisplayLayerImpl> create(LayerTreeHostImpl* hostImpl, int id) + static scoped_ptr<HeadsUpDisplayLayerImpl> create(LayerTreeImpl* treeImpl, int id) { - return make_scoped_ptr(new HeadsUpDisplayLayerImpl(hostImpl, id)); + return make_scoped_ptr(new HeadsUpDisplayLayerImpl(treeImpl, id)); } virtual ~HeadsUpDisplayLayerImpl(); @@ -42,7 +42,7 @@ public: virtual bool layerIsAlwaysDamaged() const OVERRIDE; private: - HeadsUpDisplayLayerImpl(LayerTreeHostImpl* hostImpl, int id); + HeadsUpDisplayLayerImpl(LayerTreeImpl* treeImpl, int id); virtual const char* layerTypeAsString() const OVERRIDE; diff --git a/cc/io_surface_layer.cc b/cc/io_surface_layer.cc index dd824bc..96cfc16 100644 --- a/cc/io_surface_layer.cc +++ b/cc/io_surface_layer.cc @@ -30,9 +30,9 @@ void IOSurfaceLayer::setIOSurfaceProperties(uint32_t ioSurfaceId, const gfx::Siz setNeedsCommit(); } -scoped_ptr<LayerImpl> IOSurfaceLayer::createLayerImpl(LayerTreeHostImpl* hostImpl) +scoped_ptr<LayerImpl> IOSurfaceLayer::createLayerImpl(LayerTreeImpl* treeImpl) { - return IOSurfaceLayerImpl::create(hostImpl, m_layerId).PassAs<LayerImpl>(); + return IOSurfaceLayerImpl::create(treeImpl, m_layerId).PassAs<LayerImpl>(); } bool IOSurfaceLayer::drawsContent() const diff --git a/cc/io_surface_layer.h b/cc/io_surface_layer.h index 088976b..ff3b5fd 100644 --- a/cc/io_surface_layer.h +++ b/cc/io_surface_layer.h @@ -16,7 +16,7 @@ public: void setIOSurfaceProperties(uint32_t ioSurfaceId, const gfx::Size&); - virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeHostImpl* hostImpl) OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERRIDE; virtual bool drawsContent() const OVERRIDE; virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; diff --git a/cc/io_surface_layer_impl.cc b/cc/io_surface_layer_impl.cc index 0ab1221..2aa1ce1 100644 --- a/cc/io_surface_layer_impl.cc +++ b/cc/io_surface_layer_impl.cc @@ -16,8 +16,8 @@ namespace cc { -IOSurfaceLayerImpl::IOSurfaceLayerImpl(LayerTreeHostImpl* hostImpl, int id) - : LayerImpl(hostImpl, id) +IOSurfaceLayerImpl::IOSurfaceLayerImpl(LayerTreeImpl* treeImpl, int id) + : LayerImpl(treeImpl, id) , m_ioSurfaceId(0) , m_ioSurfaceChanged(false) , m_ioSurfaceTextureId(0) diff --git a/cc/io_surface_layer_impl.h b/cc/io_surface_layer_impl.h index f7d4a58..1ca671d 100644 --- a/cc/io_surface_layer_impl.h +++ b/cc/io_surface_layer_impl.h @@ -13,9 +13,9 @@ namespace cc { class CC_EXPORT IOSurfaceLayerImpl : public LayerImpl { public: - static scoped_ptr<IOSurfaceLayerImpl> create(LayerTreeHostImpl* hostImpl, int id) + static scoped_ptr<IOSurfaceLayerImpl> create(LayerTreeImpl* treeImpl, int id) { - return make_scoped_ptr(new IOSurfaceLayerImpl(hostImpl, id)); + return make_scoped_ptr(new IOSurfaceLayerImpl(treeImpl, id)); } virtual ~IOSurfaceLayerImpl(); @@ -29,7 +29,7 @@ public: virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; private: - IOSurfaceLayerImpl(LayerTreeHostImpl* hostImpl, int id); + IOSurfaceLayerImpl(LayerTreeImpl* treeImpl, int id); virtual const char* layerTypeAsString() const OVERRIDE; diff --git a/cc/layer.cc b/cc/layer.cc index f3f9b4d..dea9e45 100644 --- a/cc/layer.cc +++ b/cc/layer.cc @@ -619,9 +619,9 @@ void Layer::pushPropertiesTo(LayerImpl* layer) m_updateRect = gfx::RectF(); } -scoped_ptr<LayerImpl> Layer::createLayerImpl(LayerTreeHostImpl* hostImpl) +scoped_ptr<LayerImpl> Layer::createLayerImpl(LayerTreeImpl* treeImpl) { - return LayerImpl::create(hostImpl, m_layerId); + return LayerImpl::create(treeImpl, m_layerId); } bool Layer::drawsContent() const @@ -35,7 +35,7 @@ struct AnimationEvent; class LayerAnimationDelegate; class LayerImpl; class LayerTreeHost; -class LayerTreeHostImpl; +class LayerTreeImpl; class PriorityCalculator; class ResourceUpdateQueue; class ScrollbarLayer; @@ -313,7 +313,7 @@ protected: scoped_refptr<Layer> m_maskLayer; // Constructs a LayerImpl of the correct runtime type for this Layer type. - virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeHostImpl* hostImpl); + virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl); int m_layerId; private: diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc index 268f0b4..521c5bc 100644 --- a/cc/layer_impl.cc +++ b/cc/layer_impl.cc @@ -10,6 +10,7 @@ #include "cc/debug_border_draw_quad.h" #include "cc/debug_colors.h" #include "cc/layer_tree_host_impl.h" +#include "cc/layer_tree_impl.h" #include "cc/math_util.h" #include "cc/proxy.h" #include "cc/quad_sink.h" @@ -19,12 +20,12 @@ namespace cc { -LayerImpl::LayerImpl(LayerTreeHostImpl* hostImpl, int id) +LayerImpl::LayerImpl(LayerTreeImpl* treeImpl, int id) : m_parent(0) , m_maskLayerId(-1) , m_replicaLayerId(-1) , m_layerId(id) - , m_layerTreeHostImpl(hostImpl) + , m_layerTreeImpl(treeImpl) , m_anchorPoint(0.5, 0.5) , m_anchorPointZ(0) , m_contentsScaleX(1.0) @@ -54,7 +55,7 @@ LayerImpl::LayerImpl(LayerTreeHostImpl* hostImpl, int id) , m_layerAnimationController(LayerAnimationController::create(this)) { DCHECK(m_layerId > 0); - DCHECK(m_layerTreeHostImpl); + DCHECK(m_layerTreeImpl); } LayerImpl::~LayerImpl() @@ -69,7 +70,7 @@ void LayerImpl::addChild(scoped_ptr<LayerImpl> child) child->setParent(this); DCHECK_EQ(layerTreeHostImpl(), child->layerTreeHostImpl()); m_children.append(child.Pass()); - m_layerTreeHostImpl->setNeedsUpdateDrawProperties(); + layerTreeHostImpl()->setNeedsUpdateDrawProperties(); } scoped_ptr<LayerImpl> LayerImpl::removeChild(LayerImpl* child) @@ -78,7 +79,7 @@ scoped_ptr<LayerImpl> LayerImpl::removeChild(LayerImpl* child) if (m_children[i] == child) { scoped_ptr<LayerImpl> ret = m_children.take(i); m_children.remove(i); - m_layerTreeHostImpl->setNeedsUpdateDrawProperties(); + layerTreeHostImpl()->setNeedsUpdateDrawProperties(); return ret.Pass(); } } @@ -88,7 +89,7 @@ scoped_ptr<LayerImpl> LayerImpl::removeChild(LayerImpl* child) void LayerImpl::removeAllChildren() { m_children.clear(); - m_layerTreeHostImpl->setNeedsUpdateDrawProperties(); + layerTreeHostImpl()->setNeedsUpdateDrawProperties(); } void LayerImpl::clearChildList() @@ -97,7 +98,7 @@ void LayerImpl::clearChildList() return; m_children.clear(); - m_layerTreeHostImpl->setNeedsUpdateDrawProperties(); + layerTreeHostImpl()->setNeedsUpdateDrawProperties(); } void LayerImpl::createRenderSurface() @@ -120,6 +121,10 @@ int LayerImpl::descendantsDrawContent() return result; } +LayerTreeHostImpl* LayerImpl::layerTreeHostImpl() const { + return m_layerTreeImpl->layer_tree_host_impl(); +} + scoped_ptr<SharedQuadState> LayerImpl::createSharedQuadState() const { scoped_ptr<SharedQuadState> state = SharedQuadState::Create(); @@ -151,25 +156,25 @@ void LayerImpl::didDraw(ResourceProvider*) bool LayerImpl::showDebugBorders() const { - return m_layerTreeHostImpl->debugState().showDebugBorders; + return layerTreeHostImpl()->debugState().showDebugBorders; } void LayerImpl::getDebugBorderProperties(SkColor* color, float* width) const { if (m_drawsContent) { *color = DebugColors::ContentLayerBorderColor(); - *width = DebugColors::ContentLayerBorderWidth(m_layerTreeHostImpl); + *width = DebugColors::ContentLayerBorderWidth(layerTreeHostImpl()); return; } if (m_masksToBounds) { *color = DebugColors::MaskingLayerBorderColor(); - *width = DebugColors::MaskingLayerBorderWidth(m_layerTreeHostImpl); + *width = DebugColors::MaskingLayerBorderWidth(layerTreeHostImpl()); return; } *color = DebugColors::ContainerLayerBorderColor(); - *width = DebugColors::ContainerLayerBorderWidth(m_layerTreeHostImpl); + *width = DebugColors::ContainerLayerBorderWidth(layerTreeHostImpl()); } void LayerImpl::appendDebugBorderQuad(QuadSink& quadList, const SharedQuadState* sharedQuadState, AppendQuadsData& appendQuadsData) const @@ -266,7 +271,7 @@ InputHandlerClient::ScrollStatus LayerImpl::tryScroll(const gfx::PointF& screenS bool LayerImpl::drawCheckerboardForMissingTiles() const { - return m_drawCheckerboardForMissingTiles && !m_layerTreeHostImpl->settings().backgroundColorInsteadOfCheckerboard; + return m_drawCheckerboardForMissingTiles && !layerTreeHostImpl()->settings().backgroundColorInsteadOfCheckerboard; } gfx::Rect LayerImpl::layerRectToContentRect(const gfx::RectF& layerRect) const @@ -409,13 +414,13 @@ bool LayerImpl::layerSurfacePropertyChanged() const void LayerImpl::noteLayerSurfacePropertyChanged() { m_layerSurfacePropertyChanged = true; - m_layerTreeHostImpl->setNeedsUpdateDrawProperties(); + layerTreeHostImpl()->setNeedsUpdateDrawProperties(); } void LayerImpl::noteLayerPropertyChanged() { m_layerPropertyChanged = true; - m_layerTreeHostImpl->setNeedsUpdateDrawProperties(); + layerTreeHostImpl()->setNeedsUpdateDrawProperties(); } void LayerImpl::noteLayerPropertyChangedForSubtree() @@ -426,7 +431,7 @@ void LayerImpl::noteLayerPropertyChangedForSubtree() void LayerImpl::noteLayerPropertyChangedForDescendants() { - m_layerTreeHostImpl->setNeedsUpdateDrawProperties(); + layerTreeHostImpl()->setNeedsUpdateDrawProperties(); for (size_t i = 0; i < m_children.size(); ++i) m_children[i]->noteLayerPropertyChangedForSubtree(); } @@ -738,7 +743,7 @@ void LayerImpl::setMaxScrollOffset(gfx::Vector2d maxScrollOffset) return; m_maxScrollOffset = maxScrollOffset; - m_layerTreeHostImpl->setNeedsUpdateDrawProperties(); + layerTreeHostImpl()->setNeedsUpdateDrawProperties(); if (!m_scrollbarAnimationController) return; diff --git a/cc/layer_impl.h b/cc/layer_impl.h index 1624a6c..89827af 100644 --- a/cc/layer_impl.h +++ b/cc/layer_impl.h @@ -34,6 +34,7 @@ class DictionaryValue; namespace cc { class LayerTreeHostImpl; +class LayerTreeImpl; class QuadSink; class Renderer; class ScrollbarAnimationController; @@ -46,9 +47,9 @@ class CC_EXPORT LayerImpl : public LayerAnimationControllerClient { public: typedef ScopedPtrVector<LayerImpl> LayerList; - static scoped_ptr<LayerImpl> create(LayerTreeHostImpl* hostImpl, int id) + static scoped_ptr<LayerImpl> create(LayerTreeImpl* treeImpl, int id) { - return make_scoped_ptr(new LayerImpl(hostImpl, id)); + return make_scoped_ptr(new LayerImpl(treeImpl, id)); } virtual ~LayerImpl(); @@ -80,7 +81,8 @@ public: bool hasReplica() const { return m_replicaLayer; } bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_replicaLayer->m_maskLayer); } - LayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; } + LayerTreeImpl* layerTreeImpl() const { return m_layerTreeImpl; } + LayerTreeHostImpl* layerTreeHostImpl() const; scoped_ptr<SharedQuadState> createSharedQuadState() const; // willDraw must be called before appendQuads. If willDraw is called, @@ -286,7 +288,7 @@ public: gfx::Rect layerRectToContentRect(const gfx::RectF& layerRect) const; protected: - LayerImpl(LayerTreeHostImpl* hostImpl, int); + LayerImpl(LayerTreeImpl* layerImpl, int); // Get the color and size of the layer's debug border. virtual void getDebugBorderProperties(SkColor*, float* width) const; @@ -321,7 +323,7 @@ private: int m_replicaLayerId; // ditto scoped_ptr<LayerImpl> m_replicaLayer; int m_layerId; - LayerTreeHostImpl* m_layerTreeHostImpl; + LayerTreeImpl* m_layerTreeImpl; // Properties synchronized from the associated Layer. gfx::PointF m_anchorPoint; diff --git a/cc/layer_impl_unittest.cc b/cc/layer_impl_unittest.cc index f355da6..cc284c7 100644 --- a/cc/layer_impl_unittest.cc +++ b/cc/layer_impl_unittest.cc @@ -73,10 +73,10 @@ TEST(LayerImplTest, verifyLayerChangesAreTrackedProperly) // Create a simple LayerImpl tree: FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 1); - root->addChild(LayerImpl::create(&hostImpl, 2)); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 1); + root->addChild(LayerImpl::create(hostImpl.activeTree(), 2)); LayerImpl* child = root->children()[0]; - child->addChild(LayerImpl::create(&hostImpl, 3)); + child->addChild(LayerImpl::create(hostImpl.activeTree(), 3)); LayerImpl* grandChild = child->children()[0]; // Adding children is an internal operation and should not mark layers as changed. @@ -109,10 +109,10 @@ TEST(LayerImplTest, verifyLayerChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setFilters(arbitraryFilters)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setFilters(WebFilterOperations())); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setFilter(arbitraryFilter)); - EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMaskLayer(LayerImpl::create(&hostImpl, 4))); + EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMaskLayer(LayerImpl::create(hostImpl.activeTree(), 4))); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMasksToBounds(true)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setContentsOpaque(true)); - EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setReplicaLayer(LayerImpl::create(&hostImpl, 5))); + EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setReplicaLayer(LayerImpl::create(hostImpl.activeTree(), 5))); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setPosition(arbitraryPointF)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setPreserves3D(true)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setDoubleSided(false)); // constructor initializes it to "true". @@ -170,7 +170,7 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 1); gfx::PointF arbitraryPointF = gfx::PointF(0.125f, 0.25f); float arbitraryNumber = 0.352f; @@ -208,10 +208,10 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) // Unrelated functions, always set to new values, always set needs update. VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->setAnchorPointZ(arbitraryNumber)); - VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->setMaskLayer(LayerImpl::create(&hostImpl, 4))); + VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->setMaskLayer(LayerImpl::create(hostImpl.activeTree(), 4))); VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->setMasksToBounds(true)); VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->setContentsOpaque(true)); - VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->setReplicaLayer(LayerImpl::create(&hostImpl, 5))); + VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->setReplicaLayer(LayerImpl::create(hostImpl.activeTree(), 5))); VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->setPosition(arbitraryPointF)); VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->setPreserves3D(true)); VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->setDoubleSided(false)); // constructor initializes it to "true". @@ -229,10 +229,10 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) // Unrelated functions, set to the same values, no needs update. VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->setAnchorPointZ(arbitraryNumber)); VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->setFilter(arbitraryFilter)); - VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->setMaskLayer(LayerImpl::create(&hostImpl, 4))); + VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->setMaskLayer(LayerImpl::create(hostImpl.activeTree(), 4))); VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->setMasksToBounds(true)); VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->setContentsOpaque(true)); - VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->setReplicaLayer(LayerImpl::create(&hostImpl, 5))); + VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->setReplicaLayer(LayerImpl::create(hostImpl.activeTree(), 5))); VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->setPosition(arbitraryPointF)); VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->setPreserves3D(true)); VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->setDoubleSided(false)); // constructor initializes it to "true". diff --git a/cc/layer_sorter_unittest.cc b/cc/layer_sorter_unittest.cc index da86383..969810b 100644 --- a/cc/layer_sorter_unittest.cc +++ b/cc/layer_sorter_unittest.cc @@ -202,11 +202,11 @@ TEST(LayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> layer1 = LayerImpl::create(&hostImpl, 1); - scoped_ptr<LayerImpl> layer2 = LayerImpl::create(&hostImpl, 2); - scoped_ptr<LayerImpl> layer3 = LayerImpl::create(&hostImpl, 3); - scoped_ptr<LayerImpl> layer4 = LayerImpl::create(&hostImpl, 4); - scoped_ptr<LayerImpl> layer5 = LayerImpl::create(&hostImpl, 5); + scoped_ptr<LayerImpl> layer1 = LayerImpl::create(hostImpl.activeTree(), 1); + scoped_ptr<LayerImpl> layer2 = LayerImpl::create(hostImpl.activeTree(), 2); + scoped_ptr<LayerImpl> layer3 = LayerImpl::create(hostImpl.activeTree(), 3); + scoped_ptr<LayerImpl> layer4 = LayerImpl::create(hostImpl.activeTree(), 4); + scoped_ptr<LayerImpl> layer5 = LayerImpl::create(hostImpl.activeTree(), 5); gfx::Transform BehindMatrix; BehindMatrix.Translate3d(0, 0, 2); diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc index e2cecda..9194e14 100644 --- a/cc/layer_tree_host.cc +++ b/cc/layer_tree_host.cc @@ -17,6 +17,7 @@ #include "cc/layer_tree_host_client.h" #include "cc/layer_tree_host_common.h" #include "cc/layer_tree_host_impl.h" +#include "cc/layer_tree_impl.h" #include "cc/math_util.h" #include "cc/occlusion_tracker.h" #include "cc/overdraw_metrics.h" @@ -375,7 +376,7 @@ void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl) m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); if (m_needsFullTreeSync) { - hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostImpl->detachLayerTree(), hostImpl)); + hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostImpl->detachLayerTree(), hostImpl->activeTree())); } else { TRACE_EVENT0("cc", "LayerTreeHost::pushPropertiesRecursive"); pushPropertiesRecursive(rootLayer(), hostImpl->rootLayer()); diff --git a/cc/layer_tree_host_common_unittest.cc b/cc/layer_tree_host_common_unittest.cc index a3dffad..39a71a8 100644 --- a/cc/layer_tree_host_common_unittest.cc +++ b/cc/layer_tree_host_common_unittest.cc @@ -77,10 +77,10 @@ void executeCalculateDrawProperties(LayerImpl* rootLayer, float deviceScaleFacto scoped_ptr<LayerImpl> createTreeForFixedPositionTests(LayerTreeHostImpl* hostImpl) { - scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl, 1); - scoped_ptr<LayerImpl> child = LayerImpl::create(hostImpl, 2); - scoped_ptr<LayerImpl> grandChild = LayerImpl::create(hostImpl, 3); - scoped_ptr<LayerImpl> greatGrandChild = LayerImpl::create(hostImpl, 4); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl->activeTree(), 1); + scoped_ptr<LayerImpl> child = LayerImpl::create(hostImpl->activeTree(), 2); + scoped_ptr<LayerImpl> grandChild = LayerImpl::create(hostImpl->activeTree(), 3); + scoped_ptr<LayerImpl> greatGrandChild = LayerImpl::create(hostImpl->activeTree(), 4); gfx::Transform IdentityMatrix; gfx::PointF anchor(0, 0); @@ -1112,7 +1112,7 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM // Add one more layer to the test tree for this scenario. { gfx::Transform identity; - scoped_ptr<LayerImpl> fixedPositionChild = LayerImpl::create(&hostImpl, 5); + scoped_ptr<LayerImpl> fixedPositionChild = LayerImpl::create(hostImpl.activeTree(), 5); setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identity, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); greatGrandChild->addChild(fixedPositionChild.Pass()); } @@ -2793,7 +2793,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayer) { FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 12345); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 12345); gfx::Transform identityMatrix; gfx::PointF anchor(0, 0); @@ -2835,7 +2835,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform) { FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 12345); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 12345); gfx::Transform uninvertibleTransform; uninvertibleTransform.matrix().setDouble(0, 0, 0); @@ -2896,7 +2896,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer) { FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 12345); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 12345); gfx::Transform identityMatrix; gfx::PointF anchor(0, 0); @@ -2939,7 +2939,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer) { FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 12345); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 12345); gfx::Transform identityMatrix; gfx::Transform rotation45DegreesAboutCenter; @@ -2990,7 +2990,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) { FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 12345); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 12345); gfx::Transform identityMatrix; @@ -3052,7 +3052,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents) // FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 1); gfx::Transform identityMatrix; gfx::PointF anchor(0, 0); @@ -3062,7 +3062,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents) { gfx::PointF position(25, 25); gfx::Size bounds(50, 50); - scoped_ptr<LayerImpl> testLayer = LayerImpl::create(&hostImpl, 12345); + scoped_ptr<LayerImpl> testLayer = LayerImpl::create(hostImpl.activeTree(), 12345); setLayerPropertiesForTesting(testLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); // override contentBounds and contentsScale @@ -3118,17 +3118,17 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer) FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 1); setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, gfx::PointF(0, 0), gfx::Size(100, 100), false); { - scoped_ptr<LayerImpl> clippingLayer = LayerImpl::create(&hostImpl, 123); + scoped_ptr<LayerImpl> clippingLayer = LayerImpl::create(hostImpl.activeTree(), 123); gfx::PointF position(25, 25); // this layer is positioned, and hit testing should correctly know where the layer is located. gfx::Size bounds(50, 50); setLayerPropertiesForTesting(clippingLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); clippingLayer->setMasksToBounds(true); - scoped_ptr<LayerImpl> child = LayerImpl::create(&hostImpl, 456); + scoped_ptr<LayerImpl> child = LayerImpl::create(hostImpl.activeTree(), 456); position = gfx::PointF(-50, -50); bounds = gfx::Size(300, 300); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); @@ -3183,7 +3183,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) // FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 123); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 123); gfx::Transform identityMatrix; gfx::PointF anchor(0, 0); @@ -3193,9 +3193,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) root->setMasksToBounds(true); { - scoped_ptr<LayerImpl> child = LayerImpl::create(&hostImpl, 456); - scoped_ptr<LayerImpl> grandChild = LayerImpl::create(&hostImpl, 789); - scoped_ptr<LayerImpl> rotatedLeaf = LayerImpl::create(&hostImpl, 2468); + scoped_ptr<LayerImpl> child = LayerImpl::create(hostImpl.activeTree(), 456); + scoped_ptr<LayerImpl> grandChild = LayerImpl::create(hostImpl.activeTree(), 789); + scoped_ptr<LayerImpl> rotatedLeaf = LayerImpl::create(hostImpl.activeTree(), 2468); position = gfx::PointF(10, 10); bounds = gfx::Size(80, 80); @@ -3286,11 +3286,11 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer) FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 1); setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, gfx::PointF(0, 0), gfx::Size(100, 100), false); { - scoped_ptr<LayerImpl> intermediateLayer = LayerImpl::create(&hostImpl, 123); + scoped_ptr<LayerImpl> intermediateLayer = LayerImpl::create(hostImpl.activeTree(), 123); gfx::PointF position(10, 10); // this layer is positioned, and hit testing should correctly know where the layer is located. gfx::Size bounds(50, 50); setLayerPropertiesForTesting(intermediateLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); @@ -3300,7 +3300,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer) // The child of the intermediateLayer is translated so that it does not overlap intermediateLayer at all. // If child is incorrectly clipped, we would not be able to hit it successfully. - scoped_ptr<LayerImpl> child = LayerImpl::create(&hostImpl, 456); + scoped_ptr<LayerImpl> child = LayerImpl::create(hostImpl.activeTree(), 456); position = gfx::PointF(60, 60); // 70, 70 in screen space bounds = gfx::Size(20, 20); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); @@ -3344,7 +3344,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) { FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 1); gfx::Transform identityMatrix; gfx::PointF anchor(0, 0); @@ -3359,9 +3359,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) // The expected stacking order is: // (front) child2, (second) grandChild, (third) child1, and (back) the root layer behind all other layers. - scoped_ptr<LayerImpl> child1 = LayerImpl::create(&hostImpl, 2); - scoped_ptr<LayerImpl> child2 = LayerImpl::create(&hostImpl, 3); - scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(&hostImpl, 4); + scoped_ptr<LayerImpl> child1 = LayerImpl::create(hostImpl.activeTree(), 2); + scoped_ptr<LayerImpl> child2 = LayerImpl::create(hostImpl.activeTree(), 3); + scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(hostImpl.activeTree(), 4); position = gfx::PointF(10, 10); bounds = gfx::Size(50, 50); @@ -3449,7 +3449,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) // FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 1); gfx::Transform identityMatrix; gfx::PointF anchor(0, 0); @@ -3464,9 +3464,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) // The expected stacking order is: // (front) child2, (second) grandChild, (third) child1, and (back) the root layer behind all other layers. - scoped_ptr<LayerImpl> child1 = LayerImpl::create(&hostImpl, 2); - scoped_ptr<LayerImpl> child2 = LayerImpl::create(&hostImpl, 3); - scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(&hostImpl, 4); + scoped_ptr<LayerImpl> child1 = LayerImpl::create(hostImpl.activeTree(), 2); + scoped_ptr<LayerImpl> child2 = LayerImpl::create(hostImpl.activeTree(), 3); + scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(hostImpl.activeTree(), 4); position = gfx::PointF(10, 10); bounds = gfx::Size(50, 50); @@ -3573,7 +3573,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSingleLayer { FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 12345); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 12345); gfx::Transform identityMatrix; Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); @@ -3631,7 +3631,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForUninvertibl { FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 12345); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 12345); gfx::Transform uninvertibleTransform; uninvertibleTransform.matrix().setDouble(0, 0, 0); @@ -3694,7 +3694,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSinglePosit { FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 12345); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 12345); gfx::Transform identityMatrix; Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); @@ -3754,7 +3754,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSingleLayer // FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 1); gfx::Transform identityMatrix; gfx::PointF anchor(0, 0); @@ -3765,7 +3765,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSingleLayer Region touchHandlerRegion(gfx::Rect(10, 10, 30, 30)); gfx::PointF position(25, 25); gfx::Size bounds(50, 50); - scoped_ptr<LayerImpl> testLayer = LayerImpl::create(&hostImpl, 12345); + scoped_ptr<LayerImpl> testLayer = LayerImpl::create(hostImpl.activeTree(), 12345); setLayerPropertiesForTesting(testLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); // override contentBounds and contentsScale @@ -3828,7 +3828,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSingleLayer // be able to hit the touch handler region by scaling the points accordingly. FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 1); gfx::Transform identityMatrix; gfx::PointF anchor(0, 0); @@ -3839,7 +3839,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSingleLayer Region touchHandlerRegion(gfx::Rect(10, 10, 30, 30)); gfx::PointF position(25, 25); gfx::Size bounds(50, 50); - scoped_ptr<LayerImpl> testLayer = LayerImpl::create(&hostImpl, 12345); + scoped_ptr<LayerImpl> testLayer = LayerImpl::create(hostImpl.activeTree(), 12345); setLayerPropertiesForTesting(testLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); testLayer->setDrawsContent(true); @@ -3916,17 +3916,17 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSimpleClipp FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> root = LayerImpl::create(&hostImpl, 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 1); setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, gfx::PointF(0, 0), gfx::Size(100, 100), false); { - scoped_ptr<LayerImpl> clippingLayer = LayerImpl::create(&hostImpl, 123); + scoped_ptr<LayerImpl> clippingLayer = LayerImpl::create(hostImpl.activeTree(), 123); gfx::PointF position(25, 25); // this layer is positioned, and hit testing should correctly know where the layer is located. gfx::Size bounds(50, 50); setLayerPropertiesForTesting(clippingLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); clippingLayer->setMasksToBounds(true); - scoped_ptr<LayerImpl> child = LayerImpl::create(&hostImpl, 456); + scoped_ptr<LayerImpl> child = LayerImpl::create(hostImpl.activeTree(), 456); Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); position = gfx::PointF(-50, -50); bounds = gfx::Size(300, 300); diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc index f6b7539..034ef08 100644 --- a/cc/layer_tree_host_impl.cc +++ b/cc/layer_tree_host_impl.cc @@ -20,6 +20,7 @@ #include "cc/layer_iterator.h" #include "cc/layer_tree_host.h" #include "cc/layer_tree_host_common.h" +#include "cc/layer_tree_impl.h" #include "cc/math_util.h" #include "cc/overdraw_metrics.h" #include "cc/page_scale_animation.h" @@ -955,6 +956,21 @@ void LayerTreeHostImpl::readback(void* pixels, const gfx::Rect& rect) m_renderer->getFramebufferPixels(pixels, rect); } +LayerImpl* LayerTreeHostImpl::rootLayer() const +{ + return m_activeTree->RootLayer(); +} + +LayerImpl* LayerTreeHostImpl::rootScrollLayer() const +{ + return m_activeTree->root_scroll_layer(); +} + +LayerImpl* LayerTreeHostImpl::currentlyScrollingLayer() const +{ + return m_activeTree->currently_scrolling_layer(); +} + // Content layers can be either directly scrollable or contained in an outer // scrolling layer which applies the scroll transform. Given a content layer, // this function returns the associated scroll layer if any. diff --git a/cc/layer_tree_host_impl.h b/cc/layer_tree_host_impl.h index efd368b..c7f38f6 100644 --- a/cc/layer_tree_host_impl.h +++ b/cc/layer_tree_host_impl.h @@ -11,7 +11,6 @@ #include "cc/animation_events.h" #include "cc/cc_export.h" #include "cc/input_handler.h" -#include "cc/layer_tree_impl.h" #include "cc/output_surface_client.h" #include "cc/render_pass.h" #include "cc/render_pass_sink.h" @@ -27,6 +26,7 @@ class DebugRectHistory; class FrameRateCounter; class LayerImpl; class LayerTreeHostImplTimeSourceAdapter; +class LayerTreeImpl; class PageScaleAnimation; class RenderPassDrawQuad; class ResourceProvider; @@ -112,7 +112,6 @@ private: class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, public RendererClient, public TileManagerClient, - public LayerTreeImplClient, public OutputSurfaceClient { typedef std::vector<LayerImpl*> LayerList; @@ -180,8 +179,8 @@ public: virtual void OnVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval) OVERRIDE; virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck&) OVERRIDE; - // LayerTreeImplClient implementation. - virtual void OnCanDrawStateChangedForTree(LayerTreeImpl*) OVERRIDE; + // Called from LayerTreeImpl. + void OnCanDrawStateChangedForTree(LayerTreeImpl*); // Implementation bool canDraw(); @@ -207,16 +206,16 @@ public: // TODO(nduca): Remove these in favor of LayerTreeImpl. void setRootLayer(scoped_ptr<LayerImpl>); - LayerImpl* rootLayer() const { return m_activeTree->RootLayer(); } + LayerImpl* rootLayer() const; // Release ownership of the current layer tree and replace it with an empty // tree. Returns the root layer of the detached tree. scoped_ptr<LayerImpl> detachLayerTree(); - LayerImpl* rootScrollLayer() const { return m_activeTree->root_scroll_layer(); } + LayerImpl* rootScrollLayer() const; // TOOD(nduca): This goes away when scrolling moves to LayerTreeImpl. - LayerImpl* currentlyScrollingLayer() const { return m_activeTree->currently_scrolling_layer(); } + LayerImpl* currentlyScrollingLayer() const; bool visible() const { return m_visible; } void setVisible(bool); diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc index 5ce07fc..622a623 100644 --- a/cc/layer_tree_host_impl_unittest.cc +++ b/cc/layer_tree_host_impl_unittest.cc @@ -15,6 +15,7 @@ #include "cc/io_surface_layer_impl.h" #include "cc/layer_impl.h" #include "cc/layer_tiling_data.h" +#include "cc/layer_tree_impl.h" #include "cc/math_util.h" #include "cc/quad_sink.h" #include "cc/render_pass_draw_quad.h" @@ -162,7 +163,7 @@ public: void setupScrollAndContentsLayers(const gfx::Size& contentSize) { - scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.get(), 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl->activeTree(), 1); root->setScrollable(true); root->setScrollOffset(gfx::Vector2d(0, 0)); root->setMaxScrollOffset(gfx::Vector2d(contentSize.width(), contentSize.height())); @@ -171,7 +172,7 @@ public: root->setPosition(gfx::PointF(0, 0)); root->setAnchorPoint(gfx::PointF(0, 0)); - scoped_ptr<LayerImpl> contents = LayerImpl::create(m_hostImpl.get(), 2); + scoped_ptr<LayerImpl> contents = LayerImpl::create(m_hostImpl->activeTree(), 2); contents->setDrawsContent(true); contents->setBounds(contentSize); contents->setContentBounds(contentSize); @@ -183,7 +184,7 @@ public: scoped_ptr<LayerImpl> createScrollableLayer(int id, const gfx::Size& size) { - scoped_ptr<LayerImpl> layer = LayerImpl::create(m_hostImpl.get(), id); + scoped_ptr<LayerImpl> layer = LayerImpl::create(m_hostImpl->activeTree(), id); layer->setScrollable(true); layer->setDrawsContent(true); layer->setBounds(size); @@ -294,12 +295,12 @@ TEST_P(LayerTreeHostImplTest, scrollDeltaNoLayers) TEST_P(LayerTreeHostImplTest, scrollDeltaTreeButNoChanges) { { - 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)); + scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl->activeTree(), 1); + root->addChild(LayerImpl::create(m_hostImpl->activeTree(), 2)); + root->addChild(LayerImpl::create(m_hostImpl->activeTree(), 3)); + root->children()[1]->addChild(LayerImpl::create(m_hostImpl->activeTree(), 4)); + root->children()[1]->addChild(LayerImpl::create(m_hostImpl->activeTree(), 5)); + root->children()[1]->children()[0]->addChild(LayerImpl::create(m_hostImpl->activeTree(), 6)); m_hostImpl->setRootLayer(root.Pass()); } LayerImpl* root = m_hostImpl->rootLayer(); @@ -322,7 +323,7 @@ TEST_P(LayerTreeHostImplTest, scrollDeltaRepeatedScrolls) gfx::Vector2d scrollOffset(20, 30); gfx::Vector2d scrollDelta(11, -15); { - scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.get(), 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl->activeTree(), 1); root->setScrollOffset(scrollOffset); root->setScrollable(true); root->setMaxScrollOffset(gfx::Vector2d(100, 100)); @@ -879,7 +880,7 @@ TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPage class DidDrawCheckLayer : public TiledLayerImpl { public: - static scoped_ptr<LayerImpl> create(LayerTreeHostImpl* hostImpl, int id) { return scoped_ptr<LayerImpl>(new DidDrawCheckLayer(hostImpl, id)); } + static scoped_ptr<LayerImpl> create(LayerTreeImpl* treeImpl, int id) { return scoped_ptr<LayerImpl>(new DidDrawCheckLayer(treeImpl, id)); } virtual void didDraw(ResourceProvider*) OVERRIDE { @@ -901,8 +902,8 @@ public: } protected: - DidDrawCheckLayer(LayerTreeHostImpl* hostImpl, int id) - : TiledLayerImpl(hostImpl, id) + DidDrawCheckLayer(LayerTreeImpl* treeImpl, int id) + : TiledLayerImpl(treeImpl, id) , m_didDrawCalled(false) , m_willDrawCalled(false) { @@ -927,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(m_hostImpl.get(), 1)); + m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl->activeTree(), 1)); DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); root->setMasksToBounds(true); - root->addChild(DidDrawCheckLayer::create(m_hostImpl.get(), 2)); + root->addChild(DidDrawCheckLayer::create(m_hostImpl->activeTree(), 2)); DidDrawCheckLayer* layer = static_cast<DidDrawCheckLayer*>(root->children()[0]); // Ensure visibleContentRect for layer is empty layer->setPosition(gfx::PointF(100, 100)); @@ -973,13 +974,13 @@ TEST_P(LayerTreeHostImplTest, willDrawNotCalledOnOccludedLayer) gfx::Size bigSize(1000, 1000); m_hostImpl->setViewportSize(bigSize, bigSize); - m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl.get(), 1)); + m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl->activeTree(), 1)); DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); - root->addChild(DidDrawCheckLayer::create(m_hostImpl.get(), 2)); + root->addChild(DidDrawCheckLayer::create(m_hostImpl->activeTree(), 2)); DidDrawCheckLayer* occludedLayer = static_cast<DidDrawCheckLayer*>(root->children()[0]); - root->addChild(DidDrawCheckLayer::create(m_hostImpl.get(), 3)); + root->addChild(DidDrawCheckLayer::create(m_hostImpl->activeTree(), 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); @@ -1005,13 +1006,13 @@ TEST_P(LayerTreeHostImplTest, willDrawNotCalledOnOccludedLayer) TEST_P(LayerTreeHostImplTest, didDrawCalledOnAllLayers) { - m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl.get(), 1)); + m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl->activeTree(), 1)); DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); - root->addChild(DidDrawCheckLayer::create(m_hostImpl.get(), 2)); + root->addChild(DidDrawCheckLayer::create(m_hostImpl->activeTree(), 2)); DidDrawCheckLayer* layer1 = static_cast<DidDrawCheckLayer*>(root->children()[0]); - layer1->addChild(DidDrawCheckLayer::create(m_hostImpl.get(), 3)); + layer1->addChild(DidDrawCheckLayer::create(m_hostImpl->activeTree(), 3)); DidDrawCheckLayer* layer2 = static_cast<DidDrawCheckLayer*>(layer1->children()[0]); layer1->setOpacity(0.3f); @@ -1036,14 +1037,14 @@ TEST_P(LayerTreeHostImplTest, didDrawCalledOnAllLayers) class MissingTextureAnimatingLayer : public DidDrawCheckLayer { public: - static scoped_ptr<LayerImpl> create(LayerTreeHostImpl* hostImpl, int id, bool tileMissing, bool skipsDraw, bool animating, ResourceProvider* resourceProvider) + static scoped_ptr<LayerImpl> create(LayerTreeImpl* treeImpl, int id, bool tileMissing, bool skipsDraw, bool animating, ResourceProvider* resourceProvider) { - return scoped_ptr<LayerImpl>(new MissingTextureAnimatingLayer(hostImpl, id, tileMissing, skipsDraw, animating, resourceProvider)); + return scoped_ptr<LayerImpl>(new MissingTextureAnimatingLayer(treeImpl, id, tileMissing, skipsDraw, animating, resourceProvider)); } private: - MissingTextureAnimatingLayer(LayerTreeHostImpl* hostImpl, int id, bool tileMissing, bool skipsDraw, bool animating, ResourceProvider* resourceProvider) - : DidDrawCheckLayer(hostImpl, id) + MissingTextureAnimatingLayer(LayerTreeImpl* treeImpl, int id, bool tileMissing, bool skipsDraw, bool animating, ResourceProvider* resourceProvider) + : DidDrawCheckLayer(treeImpl, id) { scoped_ptr<LayerTilingData> tilingData = LayerTilingData::create(gfx::Size(10, 10), LayerTilingData::NoBorderTexels); tilingData->setBounds(bounds()); @@ -1061,9 +1062,9 @@ private: TEST_P(LayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) { // When the texture is not missing, we draw as usual. - m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl.get(), 1)); + m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl->activeTree(), 1)); DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); - root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl.get(), 2, false, false, true, m_hostImpl->resourceProvider())); + root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl->activeTree(), 2, false, false, true, m_hostImpl->resourceProvider())); LayerTreeHostImpl::FrameData frame; @@ -1072,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(m_hostImpl.get(), 1)); + m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl->activeTree(), 1)); root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); - root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl.get(), 2, true, false, false, m_hostImpl->resourceProvider())); + root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl->activeTree(), 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(m_hostImpl.get(), 1)); + m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl->activeTree(), 1)); root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); - root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl.get(), 2, true, false, true, m_hostImpl->resourceProvider())); + root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl->activeTree(), 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(m_hostImpl.get(), 1)); + m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl->activeTree(), 1)); root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); - root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl.get(), 2, false, true, true, m_hostImpl->resourceProvider())); + root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl->activeTree(), 2, false, true, true, m_hostImpl->resourceProvider())); EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); @@ -1101,7 +1102,7 @@ TEST_P(LayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) TEST_P(LayerTreeHostImplTest, scrollRootIgnored) { - scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.get(), 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl->activeTree(), 1); root->setScrollable(false); m_hostImpl->setRootLayer(root.Pass()); initializeRendererAndDrawFrame(); @@ -1118,7 +1119,7 @@ TEST_P(LayerTreeHostImplTest, scrollNonCompositedRoot) // scrollable outer layer. gfx::Size surfaceSize(10, 10); - scoped_ptr<LayerImpl> contentLayer = LayerImpl::create(m_hostImpl.get(), 1); + scoped_ptr<LayerImpl> contentLayer = LayerImpl::create(m_hostImpl->activeTree(), 1); contentLayer->setUseLCDText(true); contentLayer->setDrawsContent(true); contentLayer->setPosition(gfx::PointF(0, 0)); @@ -1127,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(m_hostImpl.get(), 2); + scoped_ptr<LayerImpl> scrollLayer = LayerImpl::create(m_hostImpl->activeTree(), 2); scrollLayer->setScrollable(true); scrollLayer->setMaxScrollOffset(gfx::Vector2d(surfaceSize.width(), surfaceSize.height())); scrollLayer->setBounds(surfaceSize); @@ -1150,7 +1151,7 @@ TEST_P(LayerTreeHostImplTest, scrollNonCompositedRoot) TEST_P(LayerTreeHostImplTest, scrollChildCallsCommitAndRedraw) { gfx::Size surfaceSize(10, 10); - scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.get(), 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl->activeTree(), 1); root->setBounds(surfaceSize); root->setContentBounds(surfaceSize); root->addChild(createScrollableLayer(2, surfaceSize)); @@ -1168,7 +1169,7 @@ TEST_P(LayerTreeHostImplTest, scrollChildCallsCommitAndRedraw) TEST_P(LayerTreeHostImplTest, scrollMissesChild) { gfx::Size surfaceSize(10, 10); - scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.get(), 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl->activeTree(), 1); root->addChild(createScrollableLayer(2, surfaceSize)); m_hostImpl->setRootLayer(root.Pass()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); @@ -1183,7 +1184,7 @@ TEST_P(LayerTreeHostImplTest, scrollMissesChild) TEST_P(LayerTreeHostImplTest, scrollMissesBackfacingChild) { gfx::Size surfaceSize(10, 10); - scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.get(), 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl->activeTree(), 1); scoped_ptr<LayerImpl> child = createScrollableLayer(2, surfaceSize); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); @@ -1357,7 +1358,7 @@ TEST_P(LayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly) TEST_P(LayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread) { gfx::Size surfaceSize(10, 10); - scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.get(), 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl->activeTree(), 1); root->setBounds(surfaceSize); root->setContentBounds(surfaceSize); // Also mark the root scrollable so it becomes the root scroll layer. @@ -1633,7 +1634,7 @@ private: class BlendStateCheckLayer : public LayerImpl { public: - static scoped_ptr<LayerImpl> create(LayerTreeHostImpl* hostImpl, int id, ResourceProvider* resourceProvider) { return scoped_ptr<LayerImpl>(new BlendStateCheckLayer(hostImpl, id, resourceProvider)); } + static scoped_ptr<LayerImpl> create(LayerTreeImpl* treeImpl, int id, ResourceProvider* resourceProvider) { return scoped_ptr<LayerImpl>(new BlendStateCheckLayer(treeImpl, id, resourceProvider)); } virtual void appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData) OVERRIDE { @@ -1668,8 +1669,8 @@ public: void setOpaqueContentRect(const gfx::Rect& rect) { m_opaqueContentRect = rect; } private: - BlendStateCheckLayer(LayerTreeHostImpl* hostImpl, int id, ResourceProvider* resourceProvider) - : LayerImpl(hostImpl, id) + BlendStateCheckLayer(LayerTreeImpl* treeImpl, int id, ResourceProvider* resourceProvider) + : LayerImpl(treeImpl, id) , m_blend(false) , m_hasRenderSurface(false) , m_quadsAppended(false) @@ -1695,7 +1696,7 @@ private: TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) { { - scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.get(), 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl->activeTree(), 1); root->setAnchorPoint(gfx::PointF(0, 0)); root->setBounds(gfx::Size(10, 10)); root->setContentBounds(root->bounds()); @@ -1704,7 +1705,7 @@ TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) } LayerImpl* root = m_hostImpl->rootLayer(); - root->addChild(BlendStateCheckLayer::create(m_hostImpl.get(), 2, m_hostImpl->resourceProvider())); + root->addChild(BlendStateCheckLayer::create(m_hostImpl->activeTree(), 2, m_hostImpl->resourceProvider())); BlendStateCheckLayer* layer1 = static_cast<BlendStateCheckLayer*>(root->children()[0]); layer1->setPosition(gfx::PointF(2, 2)); @@ -1744,7 +1745,7 @@ TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) EXPECT_TRUE(layer1->quadsAppended()); m_hostImpl->didDrawAllLayers(frame); - layer1->addChild(BlendStateCheckLayer::create(m_hostImpl.get(), 3, m_hostImpl->resourceProvider())); + layer1->addChild(BlendStateCheckLayer::create(m_hostImpl->activeTree(), 3, m_hostImpl->resourceProvider())); BlendStateCheckLayer* layer2 = static_cast<BlendStateCheckLayer*>(layer1->children()[0]); layer2->setPosition(gfx::PointF(4, 4)); @@ -1892,8 +1893,8 @@ TEST_P(LayerTreeHostImplTest, viewportCovered) gfx::Size viewportSize(1000, 1000); m_hostImpl->setViewportSize(viewportSize, viewportSize); - m_hostImpl->setRootLayer(LayerImpl::create(m_hostImpl.get(), 1)); - m_hostImpl->rootLayer()->addChild(BlendStateCheckLayer::create(m_hostImpl.get(), 2, m_hostImpl->resourceProvider())); + m_hostImpl->setRootLayer(LayerImpl::create(m_hostImpl->activeTree(), 1)); + m_hostImpl->rootLayer()->addChild(BlendStateCheckLayer::create(m_hostImpl->activeTree(), 2, m_hostImpl->resourceProvider())); BlendStateCheckLayer* child = static_cast<BlendStateCheckLayer*>(m_hostImpl->rootLayer()->children()[0]); child->setExpectation(false, false); child->setContentsOpaque(true); @@ -1987,9 +1988,9 @@ private: class FakeDrawableLayerImpl: public LayerImpl { public: - static scoped_ptr<LayerImpl> create(LayerTreeHostImpl* hostImpl, int id) { return scoped_ptr<LayerImpl>(new FakeDrawableLayerImpl(hostImpl, id)); } + static scoped_ptr<LayerImpl> create(LayerTreeImpl* treeImpl, int id) { return scoped_ptr<LayerImpl>(new FakeDrawableLayerImpl(treeImpl, id)); } protected: - FakeDrawableLayerImpl(LayerTreeHostImpl* hostImpl, int id) : LayerImpl(hostImpl, id) { } + FakeDrawableLayerImpl(LayerTreeImpl* treeImpl, int id) : LayerImpl(treeImpl, id) { } }; // Only reshape when we know we are going to draw. Otherwise, the reshape @@ -2001,7 +2002,7 @@ TEST_P(LayerTreeHostImplTest, reshapeNotCalledUntilDraw) ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(outputSurface->Context3D()); m_hostImpl->initializeRenderer(outputSurface.Pass()); - scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(m_hostImpl.get(), 1); + scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(m_hostImpl->activeTree(), 1); root->setAnchorPoint(gfx::PointF(0, 0)); root->setBounds(gfx::Size(10, 10)); root->setDrawsContent(true); @@ -2051,8 +2052,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(layerTreeHostImpl.get(), 1); - scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(layerTreeHostImpl.get(), 2); + scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(layerTreeHostImpl->activeTree(), 1); + scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(layerTreeHostImpl->activeTree(), 2); child->setPosition(gfx::PointF(12, 13)); child->setAnchorPoint(gfx::PointF(0, 0)); child->setBounds(gfx::Size(14, 15)); @@ -2114,8 +2115,8 @@ TEST_P(LayerTreeHostImplTest, partialSwapReceivesDamageRect) TEST_P(LayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) { - scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(m_hostImpl.get(), 1); - scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(m_hostImpl.get(), 2); + scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(m_hostImpl->activeTree(), 1); + scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(m_hostImpl->activeTree(), 2); child->setAnchorPoint(gfx::PointF(0, 0)); child->setBounds(gfx::Size(10, 10)); child->setContentBounds(gfx::Size(10, 10)); @@ -2141,7 +2142,7 @@ TEST_P(LayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) class FakeLayerWithQuads : public LayerImpl { public: - static scoped_ptr<LayerImpl> create(LayerTreeHostImpl* hostImpl, int id) { return scoped_ptr<LayerImpl>(new FakeLayerWithQuads(hostImpl, id)); } + static scoped_ptr<LayerImpl> create(LayerTreeImpl* treeImpl, int id) { return scoped_ptr<LayerImpl>(new FakeLayerWithQuads(treeImpl, id)); } virtual void appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData) OVERRIDE { @@ -2155,8 +2156,8 @@ public: } private: - FakeLayerWithQuads(LayerTreeHostImpl* hostImpl, int id) - : LayerImpl(hostImpl, id) + FakeLayerWithQuads(LayerTreeImpl* treeImpl, int id) + : LayerImpl(treeImpl, id) { } }; @@ -2261,7 +2262,7 @@ TEST_P(LayerTreeHostImplTest, noPartialSwap) // Run test case createLayerTreeHost(false, outputSurface.Pass()); - setupRootLayerImpl(FakeLayerWithQuads::create(m_hostImpl.get(), 1)); + setupRootLayerImpl(FakeLayerWithQuads::create(m_hostImpl->activeTree(), 1)); // without partial swap, and no clipping, no scissor is set. harness.mustDrawSolidQuad(); @@ -2294,7 +2295,7 @@ TEST_P(LayerTreeHostImplTest, partialSwap) MockContextHarness harness(mockContext); createLayerTreeHost(true, outputSurface.Pass()); - setupRootLayerImpl(FakeLayerWithQuads::create(m_hostImpl.get(), 1)); + setupRootLayerImpl(FakeLayerWithQuads::create(m_hostImpl->activeTree(), 1)); // The first frame is not a partially-swapped one. harness.mustSetScissor(0, 0, 10, 10); @@ -2372,9 +2373,9 @@ static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay Layers 1, 2 have render surfaces */ - 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); + scoped_ptr<LayerImpl> root = LayerImpl::create(myHostImpl->activeTree(), 1); + scoped_ptr<LayerImpl> child = LayerImpl::create(myHostImpl->activeTree(), 2); + scoped_ptr<LayerImpl> grandChild = FakeLayerWithQuads::create(myHostImpl->activeTree(), 3); gfx::Rect rootRect(0, 0, 100, 100); gfx::Rect childRect(10, 10, 50, 50); @@ -2455,7 +2456,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(LayerTreeHostImpl* hostImpl, int id) { return scoped_ptr<LayerImpl>(new OutputSurfaceLostNotificationCheckLayer(hostImpl, id)); } + static scoped_ptr<LayerImpl> create(LayerTreeImpl* treeImpl, int id) { return scoped_ptr<LayerImpl>(new OutputSurfaceLostNotificationCheckLayer(treeImpl, id)); } virtual void didLoseOutputSurface() OVERRIDE { @@ -2465,8 +2466,8 @@ public: bool didLoseOutputSurfaceCalled() const { return m_didLoseOutputSurfaceCalled; } private: - OutputSurfaceLostNotificationCheckLayer(LayerTreeHostImpl* hostImpl, int id) - : LayerImpl(hostImpl, id) + OutputSurfaceLostNotificationCheckLayer(LayerTreeImpl* treeImpl, int id) + : LayerImpl(treeImpl, id) , m_didLoseOutputSurfaceCalled(false) { } @@ -2476,13 +2477,13 @@ private: TEST_P(LayerTreeHostImplTest, outputSurfaceLostAndRestoredNotificationSentToAllLayers) { - m_hostImpl->setRootLayer(OutputSurfaceLostNotificationCheckLayer::create(m_hostImpl.get(), 1)); + m_hostImpl->setRootLayer(OutputSurfaceLostNotificationCheckLayer::create(m_hostImpl->activeTree(), 1)); OutputSurfaceLostNotificationCheckLayer* root = static_cast<OutputSurfaceLostNotificationCheckLayer*>(m_hostImpl->rootLayer()); - root->addChild(OutputSurfaceLostNotificationCheckLayer::create(m_hostImpl.get(), 1)); + root->addChild(OutputSurfaceLostNotificationCheckLayer::create(m_hostImpl->activeTree(), 1)); OutputSurfaceLostNotificationCheckLayer* layer1 = static_cast<OutputSurfaceLostNotificationCheckLayer*>(root->children()[0]); - layer1->addChild(OutputSurfaceLostNotificationCheckLayer::create(m_hostImpl.get(), 2)); + layer1->addChild(OutputSurfaceLostNotificationCheckLayer::create(m_hostImpl->activeTree(), 2)); OutputSurfaceLostNotificationCheckLayer* layer2 = static_cast<OutputSurfaceLostNotificationCheckLayer*>(layer1->children()[0]); EXPECT_FALSE(root->didLoseOutputSurfaceCalled()); @@ -2742,9 +2743,9 @@ class FakeWebScrollbarThemeGeometryNonEmpty : public FakeWebScrollbarThemeGeomet class FakeScrollbarLayerImpl : public ScrollbarLayerImpl { public: - static scoped_ptr<FakeScrollbarLayerImpl> create(LayerTreeHostImpl* hostImpl, int id) + static scoped_ptr<FakeScrollbarLayerImpl> create(LayerTreeImpl* treeImpl, int id) { - return make_scoped_ptr(new FakeScrollbarLayerImpl(hostImpl, id)); + return make_scoped_ptr(new FakeScrollbarLayerImpl(treeImpl, id)); } void createResources(ResourceProvider* provider) @@ -2762,8 +2763,8 @@ public: } protected: - FakeScrollbarLayerImpl(LayerTreeHostImpl* hostImpl, int id) - : ScrollbarLayerImpl(hostImpl, id) + FakeScrollbarLayerImpl(LayerTreeImpl* treeImpl, int id) + : ScrollbarLayerImpl(treeImpl, id) { } }; @@ -2789,11 +2790,11 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostOutputSurface) { int layerId = 1; - scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(m_hostImpl.get(), layerId++)); + scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(m_hostImpl->activeTree(), layerId++)); rootLayer->setBounds(gfx::Size(10, 10)); rootLayer->setAnchorPoint(gfx::PointF(0, 0)); - scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(m_hostImpl.get(), layerId++); + scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(m_hostImpl->activeTree(), layerId++); tileLayer->setBounds(gfx::Size(10, 10)); tileLayer->setAnchorPoint(gfx::PointF(0, 0)); tileLayer->setContentBounds(gfx::Size(10, 10)); @@ -2805,7 +2806,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(m_hostImpl.get(), layerId++); + scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(m_hostImpl->activeTree(), layerId++); textureLayer->setBounds(gfx::Size(10, 10)); textureLayer->setAnchorPoint(gfx::PointF(0, 0)); textureLayer->setContentBounds(gfx::Size(10, 10)); @@ -2813,7 +2814,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostOutputSurface) textureLayer->setTextureId(StrictWebGraphicsContext3D::kExternalTextureId); rootLayer->addChild(textureLayer.PassAs<LayerImpl>()); - scoped_ptr<TiledLayerImpl> maskLayer = TiledLayerImpl::create(m_hostImpl.get(), layerId++); + scoped_ptr<TiledLayerImpl> maskLayer = TiledLayerImpl::create(m_hostImpl->activeTree(), layerId++); maskLayer->setBounds(gfx::Size(10, 10)); maskLayer->setAnchorPoint(gfx::PointF(0, 0)); maskLayer->setContentBounds(gfx::Size(10, 10)); @@ -2822,7 +2823,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(m_hostImpl.get(), layerId++); + scoped_ptr<TextureLayerImpl> textureLayerWithMask = TextureLayerImpl::create(m_hostImpl->activeTree(), layerId++); textureLayerWithMask->setBounds(gfx::Size(10, 10)); textureLayerWithMask->setAnchorPoint(gfx::PointF(0, 0)); textureLayerWithMask->setContentBounds(gfx::Size(10, 10)); @@ -2838,7 +2839,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostOutputSurface) base::Bind(FakeVideoFrame::toVideoFrame); FakeVideoFrameProvider provider; provider.setFrame(&videoFrame); - scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(m_hostImpl.get(), layerId++, &provider, unwrapper); + scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(m_hostImpl->activeTree(), layerId++, &provider, unwrapper); videoLayer->setBounds(gfx::Size(10, 10)); videoLayer->setAnchorPoint(gfx::PointF(0, 0)); videoLayer->setContentBounds(gfx::Size(10, 10)); @@ -2846,7 +2847,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostOutputSurface) rootLayer->addChild(videoLayer.PassAs<LayerImpl>()); FakeVideoFrameProvider providerScaled; - scoped_ptr<VideoLayerImpl> videoLayerScaled = VideoLayerImpl::create(m_hostImpl.get(), layerId++, &providerScaled, unwrapper); + scoped_ptr<VideoLayerImpl> videoLayerScaled = VideoLayerImpl::create(m_hostImpl->activeTree(), layerId++, &providerScaled, unwrapper); videoLayerScaled->setBounds(gfx::Size(10, 10)); videoLayerScaled->setAnchorPoint(gfx::PointF(0, 0)); videoLayerScaled->setContentBounds(gfx::Size(10, 10)); @@ -2854,14 +2855,14 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostOutputSurface) rootLayer->addChild(videoLayerScaled.PassAs<LayerImpl>()); FakeVideoFrameProvider hwProvider; - scoped_ptr<VideoLayerImpl> hwVideoLayer = VideoLayerImpl::create(m_hostImpl.get(), layerId++, &hwProvider, unwrapper); + scoped_ptr<VideoLayerImpl> hwVideoLayer = VideoLayerImpl::create(m_hostImpl->activeTree(), layerId++, &hwProvider, unwrapper); hwVideoLayer->setBounds(gfx::Size(10, 10)); hwVideoLayer->setAnchorPoint(gfx::PointF(0, 0)); hwVideoLayer->setContentBounds(gfx::Size(10, 10)); hwVideoLayer->setDrawsContent(true); rootLayer->addChild(hwVideoLayer.PassAs<LayerImpl>()); - scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(m_hostImpl.get(), layerId++); + scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(m_hostImpl->activeTree(), layerId++); ioSurfaceLayer->setBounds(gfx::Size(10, 10)); ioSurfaceLayer->setAnchorPoint(gfx::PointF(0, 0)); ioSurfaceLayer->setContentBounds(gfx::Size(10, 10)); @@ -2869,21 +2870,21 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostOutputSurface) ioSurfaceLayer->setIOSurfaceProperties(1, gfx::Size(10, 10)); rootLayer->addChild(ioSurfaceLayer.PassAs<LayerImpl>()); - scoped_ptr<HeadsUpDisplayLayerImpl> hudLayer = HeadsUpDisplayLayerImpl::create(m_hostImpl.get(), layerId++); + scoped_ptr<HeadsUpDisplayLayerImpl> hudLayer = HeadsUpDisplayLayerImpl::create(m_hostImpl->activeTree(), layerId++); hudLayer->setBounds(gfx::Size(10, 10)); hudLayer->setAnchorPoint(gfx::PointF(0, 0)); hudLayer->setContentBounds(gfx::Size(10, 10)); hudLayer->setDrawsContent(true); rootLayer->addChild(hudLayer.PassAs<LayerImpl>()); - scoped_ptr<FakeScrollbarLayerImpl> scrollbarLayer(FakeScrollbarLayerImpl::create(m_hostImpl.get(), layerId++)); + scoped_ptr<FakeScrollbarLayerImpl> scrollbarLayer(FakeScrollbarLayerImpl::create(m_hostImpl->activeTree(), layerId++)); scrollbarLayer->setBounds(gfx::Size(10, 10)); scrollbarLayer->setContentBounds(gfx::Size(10, 10)); scrollbarLayer->setDrawsContent(true); scrollbarLayer->createResources(m_hostImpl->resourceProvider()); rootLayer->addChild(scrollbarLayer.PassAs<LayerImpl>()); - scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer(DelegatedRendererLayerImpl::create(m_hostImpl.get(), layerId++)); + scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer(DelegatedRendererLayerImpl::create(m_hostImpl->activeTree(), layerId++)); delegatedRendererLayer->setBounds(gfx::Size(10, 10)); delegatedRendererLayer->setContentBounds(gfx::Size(10, 10)); delegatedRendererLayer->setDrawsContent(true); @@ -2998,11 +2999,11 @@ private: TEST_P(LayerTreeHostImplTest, layersFreeTextures) { - scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(m_hostImpl.get(), 1)); + scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(m_hostImpl->activeTree(), 1)); rootLayer->setBounds(gfx::Size(10, 10)); rootLayer->setAnchorPoint(gfx::PointF(0, 0)); - scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(m_hostImpl.get(), 2); + scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(m_hostImpl->activeTree(), 2); tileLayer->setBounds(gfx::Size(10, 10)); tileLayer->setAnchorPoint(gfx::PointF(0, 0)); tileLayer->setContentBounds(gfx::Size(10, 10)); @@ -3014,7 +3015,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(m_hostImpl.get(), 3); + scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(m_hostImpl->activeTree(), 3); textureLayer->setBounds(gfx::Size(10, 10)); textureLayer->setAnchorPoint(gfx::PointF(0, 0)); textureLayer->setContentBounds(gfx::Size(10, 10)); @@ -3025,14 +3026,14 @@ TEST_P(LayerTreeHostImplTest, layersFreeTextures) VideoLayerImpl::FrameUnwrapper unwrapper = base::Bind(FakeVideoFrame::toVideoFrame); FakeVideoFrameProvider provider; - scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(m_hostImpl.get(), 4, &provider, unwrapper); + scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(m_hostImpl->activeTree(), 4, &provider, unwrapper); videoLayer->setBounds(gfx::Size(10, 10)); videoLayer->setAnchorPoint(gfx::PointF(0, 0)); videoLayer->setContentBounds(gfx::Size(10, 10)); videoLayer->setDrawsContent(true); rootLayer->addChild(videoLayer.PassAs<LayerImpl>()); - scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(m_hostImpl.get(), 5); + scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(m_hostImpl->activeTree(), 5); ioSurfaceLayer->setBounds(gfx::Size(10, 10)); ioSurfaceLayer->setAnchorPoint(gfx::PointF(0, 0)); ioSurfaceLayer->setContentBounds(gfx::Size(10, 10)); @@ -3056,7 +3057,7 @@ TEST_P(LayerTreeHostImplTest, layersFreeTextures) EXPECT_GT(trackingWebGraphicsContext3D->numTextures(), 0u); // Kill the layer tree. - m_hostImpl->setRootLayer(LayerImpl::create(m_hostImpl.get(), 100)); + m_hostImpl->setRootLayer(LayerImpl::create(m_hostImpl->activeTree(), 100)); // There should be no textures left in use after. EXPECT_EQ(0u, trackingWebGraphicsContext3D->numTextures()); } @@ -3074,7 +3075,7 @@ TEST_P(LayerTreeHostImplTest, hasTransparentBackground) // Run test case createLayerTreeHost(false, outputSurface.Pass()); - setupRootLayerImpl(LayerImpl::create(m_hostImpl.get(), 1)); + setupRootLayerImpl(LayerImpl::create(m_hostImpl->activeTree(), 1)); m_hostImpl->setBackgroundColor(SK_ColorWHITE); // Verify one quad is drawn when transparent background set is not set. @@ -3099,7 +3100,7 @@ TEST_P(LayerTreeHostImplTest, hasTransparentBackground) static void addDrawingLayerTo(LayerImpl* parent, int id, const gfx::Rect& layerRect, LayerImpl** result) { - scoped_ptr<LayerImpl> layer = FakeLayerWithQuads::create(parent->layerTreeHostImpl(), id); + scoped_ptr<LayerImpl> layer = FakeLayerWithQuads::create(parent->layerTreeImpl(), id); LayerImpl* layerPtr = layer.get(); layerPtr->setAnchorPoint(gfx::PointF(0, 0)); layerPtr->setPosition(gfx::PointF(layerRect.origin())); @@ -3119,7 +3120,7 @@ static void setupLayersForTextureCaching(LayerTreeHostImpl* layerTreeHostImpl, L layerTreeHostImpl->initializeRenderer(outputSurface.Pass()); layerTreeHostImpl->setViewportSize(rootSize, rootSize); - scoped_ptr<LayerImpl> root = LayerImpl::create(layerTreeHostImpl, 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(layerTreeHostImpl->activeTree(), 1); rootPtr = root.get(); root->setAnchorPoint(gfx::PointF(0, 0)); @@ -3127,7 +3128,7 @@ static void setupLayersForTextureCaching(LayerTreeHostImpl* layerTreeHostImpl, L root->setBounds(rootSize); root->setContentBounds(rootSize); root->setDrawsContent(true); - layerTreeHostImpl->setRootLayer(root.Pass()); + layerTreeHostImpl->activeTree()->SetRootLayer(root.Pass()); addDrawingLayerTo(rootPtr, 2, gfx::Rect(10, 10, rootSize.width(), rootSize.height()), &intermediateLayerPtr); intermediateLayerPtr->setDrawsContent(false); // only children draw content @@ -3165,7 +3166,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(myHostImpl.get(), 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(myHostImpl->activeTree(), 1); rootPtr = root.get(); root->setAnchorPoint(gfx::PointF(0, 0)); @@ -3276,7 +3277,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(myHostImpl.get(), 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(myHostImpl->activeTree(), 1); rootPtr = root.get(); root->setAnchorPoint(gfx::PointF(0, 0)); @@ -3387,7 +3388,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(myHostImpl.get(), 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(myHostImpl->activeTree(), 1); rootPtr = root.get(); root->setAnchorPoint(gfx::PointF(0, 0)); @@ -3499,7 +3500,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(myHostImpl.get(), 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(myHostImpl->activeTree(), 1); rootPtr = root.get(); root->setAnchorPoint(gfx::PointF(0, 0)); @@ -3580,7 +3581,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(myHostImpl.get(), 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(myHostImpl->activeTree(), 1); rootPtr = root.get(); root->setAnchorPoint(gfx::PointF(0, 0)); @@ -3664,7 +3665,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(myHostImpl.get(), 1); + scoped_ptr<LayerImpl> root = LayerImpl::create(myHostImpl->activeTree(), 1); rootPtr = root.get(); root->setAnchorPoint(gfx::PointF(0, 0)); @@ -3768,9 +3769,9 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithScissor) Layers 1, 2 have render surfaces */ - 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); + scoped_ptr<LayerImpl> root = LayerImpl::create(myHostImpl->activeTree(), 1); + scoped_ptr<TiledLayerImpl> child = TiledLayerImpl::create(myHostImpl->activeTree(), 2); + scoped_ptr<LayerImpl> grandChild = LayerImpl::create(myHostImpl->activeTree(), 3); gfx::Rect rootRect(0, 0, 100, 100); gfx::Rect childRect(10, 10, 50, 50); diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc index 87d47e0..24d5642 100644 --- a/cc/layer_tree_host_unittest.cc +++ b/cc/layer_tree_host_unittest.cc @@ -9,6 +9,7 @@ #include "cc/content_layer_client.h" #include "cc/layer_impl.h" #include "cc/layer_tree_host_impl.h" +#include "cc/layer_tree_impl.h" #include "cc/output_surface.h" #include "cc/single_thread_proxy.h" #include "cc/test/fake_content_layer_client.h" @@ -2618,7 +2619,7 @@ public: virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&) OVERRIDE; virtual bool drawsContent() const OVERRIDE { return true; } - virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeHostImpl* hostImpl) OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERRIDE; virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE; @@ -2643,9 +2644,9 @@ private: class EvictionTestLayerImpl : public LayerImpl { public: - static scoped_ptr<EvictionTestLayerImpl> create(LayerTreeHostImpl* hostImpl, int id) + static scoped_ptr<EvictionTestLayerImpl> create(LayerTreeImpl* treeImpl, int id) { - return make_scoped_ptr(new EvictionTestLayerImpl(hostImpl, id)); + return make_scoped_ptr(new EvictionTestLayerImpl(treeImpl, id)); } virtual ~EvictionTestLayerImpl() { } @@ -2658,8 +2659,8 @@ public: void setHasTexture(bool hasTexture) { m_hasTexture = hasTexture; } private: - EvictionTestLayerImpl(LayerTreeHostImpl* hostImpl, int id) - : LayerImpl(hostImpl, id) + EvictionTestLayerImpl(LayerTreeImpl* treeImpl, int id) + : LayerImpl(treeImpl, id) , m_hasTexture(false) { } bool m_hasTexture; @@ -2685,9 +2686,9 @@ void EvictionTestLayer::update(ResourceUpdateQueue& queue, const OcclusionTracke queue.appendFullUpload(upload); } -scoped_ptr<LayerImpl> EvictionTestLayer::createLayerImpl(LayerTreeHostImpl* hostImpl) +scoped_ptr<LayerImpl> EvictionTestLayer::createLayerImpl(LayerTreeImpl* treeImpl) { - return EvictionTestLayerImpl::create(hostImpl, m_layerId).PassAs<LayerImpl>(); + return EvictionTestLayerImpl::create(treeImpl, m_layerId).PassAs<LayerImpl>(); } void EvictionTestLayer::pushPropertiesTo(LayerImpl* layerImpl) diff --git a/cc/layer_tree_impl.cc b/cc/layer_tree_impl.cc index ba4874c..f815d6a 100644 --- a/cc/layer_tree_impl.cc +++ b/cc/layer_tree_impl.cc @@ -9,8 +9,8 @@ namespace cc { -LayerTreeImpl::LayerTreeImpl(LayerTreeImplClient* client) - : client_(client) +LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) + : layer_tree_host_impl_(layer_tree_host_impl) , source_frame_number_(-1) , hud_layer_(0) , root_scroll_layer_(0) @@ -51,7 +51,7 @@ void LayerTreeImpl::SetRootLayer(scoped_ptr<LayerImpl> layer) { scrolling_layer_id_from_previous_tree_ = 0; - client_->OnCanDrawStateChangedForTree(this); + layer_tree_host_impl_->OnCanDrawStateChangedForTree(this); } scoped_ptr<LayerImpl> LayerTreeImpl::DetachLayerTree() { diff --git a/cc/layer_tree_impl.h b/cc/layer_tree_impl.h index 95d53f8..775b5ec 100644 --- a/cc/layer_tree_impl.h +++ b/cc/layer_tree_impl.h @@ -13,22 +13,21 @@ class LayerTreeHostImpl; class LayerTreeImpl; class HeadsUpDisplayLayerImpl; -class CC_EXPORT LayerTreeImplClient { - public: - virtual void OnCanDrawStateChangedForTree(LayerTreeImpl*) = 0; - - protected: - virtual ~LayerTreeImplClient() {} -}; - class CC_EXPORT LayerTreeImpl { public: - static scoped_ptr<LayerTreeImpl> create(LayerTreeImplClient* client) + static scoped_ptr<LayerTreeImpl> create(LayerTreeHostImpl* layer_tree_host_impl) { - return make_scoped_ptr(new LayerTreeImpl(client)); + return make_scoped_ptr(new LayerTreeImpl(layer_tree_host_impl)); } virtual ~LayerTreeImpl(); + // Methods called by the layer tree. + // --------------------------------------------------------------------------- + // TODO(nduca): Remove this and have layers call through this class. + LayerTreeHostImpl* layer_tree_host_impl() const { return layer_tree_host_impl_; } + + // Other public methods + // --------------------------------------------------------------------------- LayerImpl* RootLayer() const { return root_layer_.get(); } void SetRootLayer(scoped_ptr<LayerImpl>); scoped_ptr<LayerImpl> DetachLayerTree(); @@ -48,9 +47,9 @@ class CC_EXPORT LayerTreeImpl { void ClearCurrentlyScrollingLayer(); protected: - LayerTreeImpl(LayerTreeImplClient* client); + LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl); - LayerTreeImplClient* client_; + LayerTreeHostImpl* layer_tree_host_impl_; int source_frame_number_; scoped_ptr<LayerImpl> root_layer_; HeadsUpDisplayLayerImpl* hud_layer_; diff --git a/cc/layer_unittest.cc b/cc/layer_unittest.cc index 60358a4..e5a98e8 100644 --- a/cc/layer_unittest.cc +++ b/cc/layer_unittest.cc @@ -559,7 +559,7 @@ TEST_F(LayerTest, checkPropertyChangeCausesCorrectBehavior) TEST_F(LayerTest, verifyPushPropertiesAccumulatesUpdateRect) { scoped_refptr<Layer> testLayer = Layer::create(); - scoped_ptr<LayerImpl> implLayer = LayerImpl::create(&m_hostImpl, 1); + scoped_ptr<LayerImpl> implLayer = LayerImpl::create(m_hostImpl.activeTree(), 1); testLayer->setNeedsDisplayRect(gfx::RectF(gfx::PointF(), gfx::SizeF(5, 5))); testLayer->pushPropertiesTo(implLayer.get()); diff --git a/cc/nine_patch_layer.cc b/cc/nine_patch_layer.cc index f121fc9..657a37d 100644 --- a/cc/nine_patch_layer.cc +++ b/cc/nine_patch_layer.cc @@ -25,9 +25,9 @@ NinePatchLayer::~NinePatchLayer() { } -scoped_ptr<LayerImpl> NinePatchLayer::createLayerImpl(LayerTreeHostImpl* hostImpl) +scoped_ptr<LayerImpl> NinePatchLayer::createLayerImpl(LayerTreeImpl* treeImpl) { - return NinePatchLayerImpl::create(hostImpl, id()).PassAs<LayerImpl>(); + return NinePatchLayerImpl::create(treeImpl, id()).PassAs<LayerImpl>(); } void NinePatchLayer::setTexturePriorities(const PriorityCalculator& priorityCalc) diff --git a/cc/nine_patch_layer.h b/cc/nine_patch_layer.h index 6a8c613..d852d8e 100644 --- a/cc/nine_patch_layer.h +++ b/cc/nine_patch_layer.h @@ -36,7 +36,7 @@ public: private: NinePatchLayer(); virtual ~NinePatchLayer(); - virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeHostImpl* hostImpl) OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERRIDE; void createUpdaterIfNeeded(); void createResource(); diff --git a/cc/nine_patch_layer_impl.cc b/cc/nine_patch_layer_impl.cc index 3185abd..bde6235 100644 --- a/cc/nine_patch_layer_impl.cc +++ b/cc/nine_patch_layer_impl.cc @@ -12,8 +12,8 @@ namespace cc { -NinePatchLayerImpl::NinePatchLayerImpl(LayerTreeHostImpl* hostImpl, int id) - : LayerImpl(hostImpl, id) +NinePatchLayerImpl::NinePatchLayerImpl(LayerTreeImpl* treeImpl, int id) + : LayerImpl(treeImpl, id) , m_resourceId(0) { } diff --git a/cc/nine_patch_layer_impl.h b/cc/nine_patch_layer_impl.h index de757a2..6a10389 100644 --- a/cc/nine_patch_layer_impl.h +++ b/cc/nine_patch_layer_impl.h @@ -19,9 +19,9 @@ namespace cc { class CC_EXPORT NinePatchLayerImpl : public LayerImpl { public: - static scoped_ptr<NinePatchLayerImpl> create(LayerTreeHostImpl* hostImpl, int id) + static scoped_ptr<NinePatchLayerImpl> create(LayerTreeImpl* treeImpl, int id) { - return make_scoped_ptr(new NinePatchLayerImpl(hostImpl, id)); + return make_scoped_ptr(new NinePatchLayerImpl(treeImpl, id)); } virtual ~NinePatchLayerImpl(); @@ -38,7 +38,7 @@ public: virtual base::DictionaryValue* layerTreeAsJson() const OVERRIDE; protected: - NinePatchLayerImpl(LayerTreeHostImpl* hostImpl, int id); + NinePatchLayerImpl(LayerTreeImpl* treeImpl, int id); private: virtual const char* layerTypeAsString() const OVERRIDE; diff --git a/cc/nine_patch_layer_impl_unittest.cc b/cc/nine_patch_layer_impl_unittest.cc index 058e94b..aa9bc01 100644 --- a/cc/nine_patch_layer_impl_unittest.cc +++ b/cc/nine_patch_layer_impl_unittest.cc @@ -41,7 +41,7 @@ TEST(NinePatchLayerImplTest, verifyDrawQuads) FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<NinePatchLayerImpl> layer = NinePatchLayerImpl::create(&hostImpl, 1); + scoped_ptr<NinePatchLayerImpl> layer = NinePatchLayerImpl::create(hostImpl.activeTree(), 1); layer->drawProperties().visible_content_rect = visibleContentRect; layer->setBounds(layerSize); layer->setContentBounds(layerSize); @@ -102,7 +102,7 @@ TEST(NinePatchLayerImplTest, verifyDrawQuadsForSqueezedLayer) FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<NinePatchLayerImpl> layer = NinePatchLayerImpl::create(&hostImpl, 1); + scoped_ptr<NinePatchLayerImpl> layer = NinePatchLayerImpl::create(hostImpl.activeTree(), 1); layer->drawProperties().visible_content_rect = visibleContentRect; layer->setBounds(layerSize); layer->setContentBounds(layerSize); diff --git a/cc/occlusion_tracker_unittest.cc b/cc/occlusion_tracker_unittest.cc index 5f366fb..9d5bb9d 100644 --- a/cc/occlusion_tracker_unittest.cc +++ b/cc/occlusion_tracker_unittest.cc @@ -61,8 +61,8 @@ private: class TestContentLayerImpl : public LayerImpl { public: - TestContentLayerImpl(LayerTreeHostImpl* hostImpl, int id) - : LayerImpl(hostImpl, id) + TestContentLayerImpl(LayerTreeImpl* treeImpl, int id) + : LayerImpl(treeImpl, id) , m_overrideOpaqueContentsRect(false) { setDrawsContent(true); @@ -157,7 +157,7 @@ struct OcclusionTrackerTestMainThreadTypes { struct OcclusionTrackerTestImplThreadTypes { typedef LayerImpl LayerType; - typedef LayerTreeHostImpl HostType; + typedef LayerTreeImpl HostType; typedef RenderSurfaceImpl RenderSurfaceType; typedef TestContentLayerImpl ContentLayerType; typedef scoped_ptr<LayerImpl> LayerPtrType; @@ -428,9 +428,9 @@ LayerTreeHost* OcclusionTrackerTest<OcclusionTrackerTestMainThreadTypes>::getHos } template<> -LayerTreeHostImpl* OcclusionTrackerTest<OcclusionTrackerTestImplThreadTypes>::getHost() +LayerTreeImpl* OcclusionTrackerTest<OcclusionTrackerTestImplThreadTypes>::getHost() { - return &m_hostImpl; + return m_hostImpl.activeTree(); } #define RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ diff --git a/cc/picture_layer.cc b/cc/picture_layer.cc index db442d9..ca2bf4a 100644 --- a/cc/picture_layer.cc +++ b/cc/picture_layer.cc @@ -23,8 +23,8 @@ bool PictureLayer::drawsContent() const { return Layer::drawsContent() && client_; } -scoped_ptr<LayerImpl> PictureLayer::createLayerImpl(LayerTreeHostImpl* host) { - return PictureLayerImpl::create(host, id()).PassAs<LayerImpl>(); +scoped_ptr<LayerImpl> PictureLayer::createLayerImpl(LayerTreeImpl* treeImpl) { + return PictureLayerImpl::create(treeImpl, id()).PassAs<LayerImpl>(); } void PictureLayer::pushPropertiesTo(LayerImpl* base_layer) { diff --git a/cc/picture_layer.h b/cc/picture_layer.h index cf9cf05..fd330fb 100644 --- a/cc/picture_layer.h +++ b/cc/picture_layer.h @@ -25,7 +25,7 @@ public: // Implement Layer interface virtual bool drawsContent() const OVERRIDE; virtual scoped_ptr<LayerImpl> createLayerImpl( - LayerTreeHostImpl* host) OVERRIDE; + LayerTreeImpl* treeImpl) OVERRIDE; virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; virtual void setNeedsDisplayRect(const gfx::RectF& layerRect) OVERRIDE; virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, diff --git a/cc/picture_layer_impl.cc b/cc/picture_layer_impl.cc index 9f814a5..a6a0245 100644 --- a/cc/picture_layer_impl.cc +++ b/cc/picture_layer_impl.cc @@ -18,8 +18,8 @@ namespace cc { -PictureLayerImpl::PictureLayerImpl(LayerTreeHostImpl* host, int id) - : LayerImpl(host, id), +PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* treeImpl, int id) + : LayerImpl(treeImpl, id), tilings_(this), pile_(PicturePileImpl::Create()), last_update_time_(0) { diff --git a/cc/picture_layer_impl.h b/cc/picture_layer_impl.h index 12b6179..2d592d3 100644 --- a/cc/picture_layer_impl.h +++ b/cc/picture_layer_impl.h @@ -19,9 +19,9 @@ class QuadSink; class CC_EXPORT PictureLayerImpl : public LayerImpl, public PictureLayerTilingClient { public: - static scoped_ptr<PictureLayerImpl> create(LayerTreeHostImpl* host, int id) + static scoped_ptr<PictureLayerImpl> create(LayerTreeImpl* treeImpl, int id) { - return make_scoped_ptr(new PictureLayerImpl(host, id)); + return make_scoped_ptr(new PictureLayerImpl(treeImpl, id)); } virtual ~PictureLayerImpl(); @@ -41,7 +41,7 @@ public: void SyncFromActiveLayer(const PictureLayerImpl* other); protected: - PictureLayerImpl(LayerTreeHostImpl* host, int id); + PictureLayerImpl(LayerTreeImpl* treeImpl, int id); PictureLayerTilingSet tilings_; scoped_refptr<PicturePileImpl> pile_; diff --git a/cc/quad_culler_unittest.cc b/cc/quad_culler_unittest.cc index d17c331..1dd64d8 100644 --- a/cc/quad_culler_unittest.cc +++ b/cc/quad_culler_unittest.cc @@ -48,7 +48,7 @@ public: scoped_ptr<TiledLayerImpl> makeLayer(TiledLayerImpl* parent, const gfx::Transform& drawTransform, const gfx::Rect& layerRect, float opacity, bool opaque, const gfx::Rect& layerOpaqueRect, std::vector<LayerImpl*>& surfaceLayerList) { - scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::create(&m_hostImpl, 1); + scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::create(m_hostImpl.activeTree(), 1); scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(gfx::Size(100, 100), LayerTilingData::NoBorderTexels); tiler->setBounds(layerRect.size()); layer->setTilingData(*tiler); diff --git a/cc/render_surface_unittest.cc b/cc/render_surface_unittest.cc index 0fd5247..c65532a 100644 --- a/cc/render_surface_unittest.cc +++ b/cc/render_surface_unittest.cc @@ -39,7 +39,7 @@ TEST(RenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(&hostImpl, 1); + scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(hostImpl.activeTree(), 1); owningLayer->createRenderSurface(); ASSERT_TRUE(owningLayer->renderSurface()); RenderSurfaceImpl* renderSurface = owningLayer->renderSurface(); @@ -59,7 +59,7 @@ TEST(RenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setClipRect(testRect)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setContentRect(testRect)); - scoped_ptr<LayerImpl> dummyMask = LayerImpl::create(&hostImpl, 1); + scoped_ptr<LayerImpl> dummyMask = LayerImpl::create(hostImpl.activeTree(), 1); gfx::Transform dummyMatrix; dummyMatrix.Translate(1.0, 2.0); @@ -75,9 +75,9 @@ TEST(RenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) { FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(&hostImpl, 1); + scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(hostImpl.activeTree(), 1); - scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(&hostImpl, 2); + scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(hostImpl.activeTree(), 2); owningLayer->createRenderSurface(); ASSERT_TRUE(owningLayer->renderSurface()); owningLayer->drawProperties().render_target = owningLayer.get(); @@ -127,9 +127,9 @@ TEST(RenderSurfaceTest, sanityCheckSurfaceCreatesCorrectRenderPass) { FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(&hostImpl, 1); + scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(hostImpl.activeTree(), 1); - scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(&hostImpl, 2); + scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(hostImpl.activeTree(), 2); owningLayer->createRenderSurface(); ASSERT_TRUE(owningLayer->renderSurface()); owningLayer->drawProperties().render_target = owningLayer.get(); diff --git a/cc/scrollbar_animation_controller_linear_fade_unittest.cc b/cc/scrollbar_animation_controller_linear_fade_unittest.cc index dd941c1..0312bc9 100644 --- a/cc/scrollbar_animation_controller_linear_fade_unittest.cc +++ b/cc/scrollbar_animation_controller_linear_fade_unittest.cc @@ -23,10 +23,10 @@ public: protected: virtual void SetUp() { - m_scrollLayer = LayerImpl::create(&m_hostImpl, 1); - m_scrollLayer->addChild(LayerImpl::create(&m_hostImpl, 2)); + m_scrollLayer = LayerImpl::create(m_hostImpl.activeTree(), 1); + m_scrollLayer->addChild(LayerImpl::create(m_hostImpl.activeTree(), 2)); m_contentLayer = m_scrollLayer->children()[0]; - m_scrollbarLayer = ScrollbarLayerImpl::create(&m_hostImpl, 3); + m_scrollbarLayer = ScrollbarLayerImpl::create(m_hostImpl.activeTree(), 3); m_scrollLayer->setMaxScrollOffset(gfx::Vector2d(50, 50)); m_contentLayer->setBounds(gfx::Size(50, 50)); diff --git a/cc/scrollbar_layer.cc b/cc/scrollbar_layer.cc index 83152bb..8ebfc89 100644 --- a/cc/scrollbar_layer.cc +++ b/cc/scrollbar_layer.cc @@ -17,9 +17,9 @@ using WebKit::WebRect; namespace cc { -scoped_ptr<LayerImpl> ScrollbarLayer::createLayerImpl(LayerTreeHostImpl* hostImpl) +scoped_ptr<LayerImpl> ScrollbarLayer::createLayerImpl(LayerTreeImpl* treeImpl) { - return ScrollbarLayerImpl::create(hostImpl, id()).PassAs<LayerImpl>(); + return ScrollbarLayerImpl::create(treeImpl, id()).PassAs<LayerImpl>(); } scoped_refptr<ScrollbarLayer> ScrollbarLayer::create(scoped_ptr<WebKit::WebScrollbar> scrollbar, WebKit::WebScrollbarThemePainter painter, scoped_ptr<WebKit::WebScrollbarThemeGeometry> geometry, int scrollLayerId) diff --git a/cc/scrollbar_layer.h b/cc/scrollbar_layer.h index dd8abdd..13341a3 100644 --- a/cc/scrollbar_layer.h +++ b/cc/scrollbar_layer.h @@ -21,7 +21,7 @@ class ScrollbarThemeComposite; class CC_EXPORT ScrollbarLayer : public ContentsScalingLayer { public: - virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeHostImpl* hostImpl) OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERRIDE; static scoped_refptr<ScrollbarLayer> create(scoped_ptr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePainter, scoped_ptr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId); diff --git a/cc/scrollbar_layer_impl.cc b/cc/scrollbar_layer_impl.cc index db9fb4f..abe7d32 100644 --- a/cc/scrollbar_layer_impl.cc +++ b/cc/scrollbar_layer_impl.cc @@ -14,13 +14,13 @@ using WebKit::WebScrollbar; namespace cc { -scoped_ptr<ScrollbarLayerImpl> ScrollbarLayerImpl::create(LayerTreeHostImpl* hostImpl, int id) +scoped_ptr<ScrollbarLayerImpl> ScrollbarLayerImpl::create(LayerTreeImpl* treeImpl, int id) { - return make_scoped_ptr(new ScrollbarLayerImpl(hostImpl, id)); + return make_scoped_ptr(new ScrollbarLayerImpl(treeImpl, id)); } -ScrollbarLayerImpl::ScrollbarLayerImpl(LayerTreeHostImpl* hostImpl, int id) - : LayerImpl(hostImpl, id) +ScrollbarLayerImpl::ScrollbarLayerImpl(LayerTreeImpl* treeImpl, int id) + : LayerImpl(treeImpl, id) , m_scrollbar(this) , m_backTrackResourceId(0) , m_foreTrackResourceId(0) diff --git a/cc/scrollbar_layer_impl.h b/cc/scrollbar_layer_impl.h index a35ae3b..57e07a7 100644 --- a/cc/scrollbar_layer_impl.h +++ b/cc/scrollbar_layer_impl.h @@ -18,7 +18,7 @@ class ScrollView; class CC_EXPORT ScrollbarLayerImpl : public LayerImpl { public: - static scoped_ptr<ScrollbarLayerImpl> create(LayerTreeHostImpl* hostImpl, int id); + static scoped_ptr<ScrollbarLayerImpl> create(LayerTreeImpl* treeImpl, int id); virtual ~ScrollbarLayerImpl(); ScrollbarGeometryFixedThumb* scrollbarGeometry() const { return m_geometry.get(); } @@ -45,7 +45,7 @@ public: virtual void didLoseOutputSurface() OVERRIDE; protected: - ScrollbarLayerImpl(LayerTreeHostImpl* hostImpl, int id); + ScrollbarLayerImpl(LayerTreeImpl* treeImpl, int id); private: // nested class only to avoid namespace problem diff --git a/cc/scrollbar_layer_unittest.cc b/cc/scrollbar_layer_unittest.cc index 35bb5eb..5b5ab8b 100644 --- a/cc/scrollbar_layer_unittest.cc +++ b/cc/scrollbar_layer_unittest.cc @@ -57,7 +57,7 @@ TEST(ScrollbarLayerTest, resolveScrollLayerPointer) layerTreeRoot->addChild(child1); layerTreeRoot->addChild(child2); - scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), &hostImpl); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.activeTree()); LayerImpl* ccChild1 = layerImplTreeRoot->children()[0]; ScrollbarLayerImpl* ccChild2 = static_cast<ScrollbarLayerImpl*>(layerImplTreeRoot->children()[1]); @@ -74,7 +74,7 @@ TEST(ScrollbarLayerTest, resolveScrollLayerPointer) layerTreeRoot->addChild(child1); layerTreeRoot->addChild(child2); - scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), &hostImpl); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.activeTree()); ScrollbarLayerImpl* ccChild1 = static_cast<ScrollbarLayerImpl*>(layerImplTreeRoot->children()[0]); LayerImpl* ccChild2 = layerImplTreeRoot->children()[1]; @@ -101,7 +101,7 @@ TEST(ScrollbarLayerTest, scrollOffsetSynchronization) layerTreeRoot->setMaxScrollOffset(gfx::Vector2d(30, 50)); contentLayer->setBounds(gfx::Size(100, 200)); - scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), &hostImpl); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.activeTree()); ScrollbarLayerImpl* ccScrollbarLayer = static_cast<ScrollbarLayerImpl*>(layerImplTreeRoot->children()[1]); @@ -114,7 +114,7 @@ TEST(ScrollbarLayerTest, scrollOffsetSynchronization) contentLayer->setBounds(gfx::Size(1000, 2000)); ScrollbarAnimationController* scrollbarController = layerImplTreeRoot->scrollbarAnimationController(); - layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), &hostImpl); + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.activeTree()); EXPECT_EQ(scrollbarController, layerImplTreeRoot->scrollbarAnimationController()); EXPECT_EQ(100, ccScrollbarLayer->currentPos()); diff --git a/cc/solid_color_layer.cc b/cc/solid_color_layer.cc index 4510e00..1dae749 100644 --- a/cc/solid_color_layer.cc +++ b/cc/solid_color_layer.cc @@ -8,9 +8,9 @@ namespace cc { -scoped_ptr<LayerImpl> SolidColorLayer::createLayerImpl(LayerTreeHostImpl* hostImpl) +scoped_ptr<LayerImpl> SolidColorLayer::createLayerImpl(LayerTreeImpl* treeImpl) { - return SolidColorLayerImpl::create(hostImpl, id()).PassAs<LayerImpl>(); + return SolidColorLayerImpl::create(treeImpl, id()).PassAs<LayerImpl>(); } scoped_refptr<SolidColorLayer> SolidColorLayer::create() diff --git a/cc/solid_color_layer.h b/cc/solid_color_layer.h index cf1c456..521c1d0 100644 --- a/cc/solid_color_layer.h +++ b/cc/solid_color_layer.h @@ -17,7 +17,7 @@ class CC_EXPORT SolidColorLayer : public Layer { public: static scoped_refptr<SolidColorLayer> create(); - virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeHostImpl* hostImpl) OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERRIDE; virtual void setBackgroundColor(SkColor) OVERRIDE; diff --git a/cc/solid_color_layer_impl.cc b/cc/solid_color_layer_impl.cc index aa2c278..1d5ed51 100644 --- a/cc/solid_color_layer_impl.cc +++ b/cc/solid_color_layer_impl.cc @@ -9,8 +9,8 @@ namespace cc { -SolidColorLayerImpl::SolidColorLayerImpl(LayerTreeHostImpl* hostImpl, int id) - : LayerImpl(hostImpl, id) +SolidColorLayerImpl::SolidColorLayerImpl(LayerTreeImpl* treeImpl, int id) + : LayerImpl(treeImpl, id) , m_tileSize(256) { } diff --git a/cc/solid_color_layer_impl.h b/cc/solid_color_layer_impl.h index c2da466..ae1dcdc 100644 --- a/cc/solid_color_layer_impl.h +++ b/cc/solid_color_layer_impl.h @@ -12,16 +12,16 @@ namespace cc { class CC_EXPORT SolidColorLayerImpl : public LayerImpl { public: - static scoped_ptr<SolidColorLayerImpl> create(LayerTreeHostImpl* hostImpl, int id) + static scoped_ptr<SolidColorLayerImpl> create(LayerTreeImpl* treeImpl, int id) { - return make_scoped_ptr(new SolidColorLayerImpl(hostImpl, id)); + return make_scoped_ptr(new SolidColorLayerImpl(treeImpl, id)); } virtual ~SolidColorLayerImpl(); virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; protected: - SolidColorLayerImpl(LayerTreeHostImpl* hostImpl, int id); + SolidColorLayerImpl(LayerTreeImpl* treeImpl, int id); private: virtual const char* layerTypeAsString() const OVERRIDE; diff --git a/cc/solid_color_layer_impl_unittest.cc b/cc/solid_color_layer_impl_unittest.cc index fdad5c2..6bf996d 100644 --- a/cc/solid_color_layer_impl_unittest.cc +++ b/cc/solid_color_layer_impl_unittest.cc @@ -28,7 +28,7 @@ TEST(SolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap) FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(&hostImpl, 1); + scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(hostImpl.activeTree(), 1); layer->drawProperties().visible_content_rect = visibleContentRect; layer->setBounds(layerSize); layer->setContentBounds(layerSize); @@ -51,7 +51,7 @@ TEST(SolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(&hostImpl, 1); + scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(hostImpl.activeTree(), 1); layer->drawProperties().visible_content_rect = visibleContentRect; layer->setBounds(layerSize); layer->setContentBounds(layerSize); @@ -76,7 +76,7 @@ TEST(SolidColorLayerImplTest, verifyCorrectOpacityInQuad) FakeImplProxy proxy; FakeLayerTreeHostImpl hostImpl(&proxy); - scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(&hostImpl, 1); + scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(hostImpl.activeTree(), 1); layer->drawProperties().visible_content_rect = visibleContentRect; layer->setBounds(layerSize); layer->setContentBounds(layerSize); @@ -110,7 +110,7 @@ TEST(SolidColorLayerImplTest, verifyOpaqueRect) EXPECT_TRUE(layer->contentsOpaque()); { - scoped_ptr<SolidColorLayerImpl> layerImpl = SolidColorLayerImpl::create(&hostImpl, layer->id()); + scoped_ptr<SolidColorLayerImpl> layerImpl = SolidColorLayerImpl::create(hostImpl.activeTree(), layer->id()); layer->pushPropertiesTo(layerImpl.get()); // The impl layer should call itself opaque as well. @@ -132,7 +132,7 @@ TEST(SolidColorLayerImplTest, verifyOpaqueRect) EXPECT_FALSE(layer->contentsOpaque()); { - scoped_ptr<SolidColorLayerImpl> layerImpl = SolidColorLayerImpl::create(&hostImpl, layer->id()); + scoped_ptr<SolidColorLayerImpl> layerImpl = SolidColorLayerImpl::create(hostImpl.activeTree(), layer->id()); layer->pushPropertiesTo(layerImpl.get()); // The impl layer should callnot itself opaque anymore. diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc index 0d52ad0..8010638 100644 --- a/cc/test/tiled_layer_test_common.cc +++ b/cc/test/tiled_layer_test_common.cc @@ -73,8 +73,8 @@ scoped_ptr<LayerUpdater::Resource> FakeLayerUpdater::createResource(PrioritizedR return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedResource::create(manager))); } -FakeTiledLayerImpl::FakeTiledLayerImpl(LayerTreeHostImpl* hostImpl, int id) - : TiledLayerImpl(hostImpl, id) +FakeTiledLayerImpl::FakeTiledLayerImpl(LayerTreeImpl* treeImpl, int id) + : TiledLayerImpl(treeImpl, id) { } diff --git a/cc/test/tiled_layer_test_common.h b/cc/test/tiled_layer_test_common.h index 83934c4..1992824 100644 --- a/cc/test/tiled_layer_test_common.h +++ b/cc/test/tiled_layer_test_common.h @@ -71,7 +71,7 @@ private: class FakeTiledLayerImpl : public cc::TiledLayerImpl { public: - FakeTiledLayerImpl(LayerTreeHostImpl* hostImpl, int id); + FakeTiledLayerImpl(LayerTreeImpl* treeImpl, int id); virtual ~FakeTiledLayerImpl(); using cc::TiledLayerImpl::hasTileAt; diff --git a/cc/texture_layer.cc b/cc/texture_layer.cc index a00feeb..127062c 100644 --- a/cc/texture_layer.cc +++ b/cc/texture_layer.cc @@ -40,9 +40,9 @@ TextureLayer::~TextureLayer() } } -scoped_ptr<LayerImpl> TextureLayer::createLayerImpl(LayerTreeHostImpl* hostImpl) +scoped_ptr<LayerImpl> TextureLayer::createLayerImpl(LayerTreeImpl* treeImpl) { - return TextureLayerImpl::create(hostImpl, m_layerId).PassAs<LayerImpl>(); + return TextureLayerImpl::create(treeImpl, m_layerId).PassAs<LayerImpl>(); } void TextureLayer::setFlipped(bool flipped) diff --git a/cc/texture_layer.h b/cc/texture_layer.h index 54dd577..0f17756 100644 --- a/cc/texture_layer.h +++ b/cc/texture_layer.h @@ -26,7 +26,7 @@ public: void clearClient() { m_client = 0; } - virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeHostImpl* hostImpl) OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERRIDE; // Sets whether this texture should be Y-flipped at draw time. Defaults to true. void setFlipped(bool); diff --git a/cc/texture_layer_impl.cc b/cc/texture_layer_impl.cc index 57e06a5..7fcfe43 100644 --- a/cc/texture_layer_impl.cc +++ b/cc/texture_layer_impl.cc @@ -11,8 +11,8 @@ namespace cc { -TextureLayerImpl::TextureLayerImpl(LayerTreeHostImpl* hostImpl, int id) - : LayerImpl(hostImpl, id) +TextureLayerImpl::TextureLayerImpl(LayerTreeImpl* treeImpl, int id) + : LayerImpl(treeImpl, id) , m_textureId(0) , m_externalTextureResource(0) , m_premultipliedAlpha(true) diff --git a/cc/texture_layer_impl.h b/cc/texture_layer_impl.h index 97c2dc9..30262da 100644 --- a/cc/texture_layer_impl.h +++ b/cc/texture_layer_impl.h @@ -12,9 +12,9 @@ namespace cc { class CC_EXPORT TextureLayerImpl : public LayerImpl { public: - static scoped_ptr<TextureLayerImpl> create(LayerTreeHostImpl* hostImpl, int id) + static scoped_ptr<TextureLayerImpl> create(LayerTreeImpl* treeImpl, int id) { - return make_scoped_ptr(new TextureLayerImpl(hostImpl, id)); + return make_scoped_ptr(new TextureLayerImpl(treeImpl, id)); } virtual ~TextureLayerImpl(); @@ -33,7 +33,7 @@ public: void setUVRect(const gfx::RectF& rect) { m_uvRect = rect; } private: - TextureLayerImpl(LayerTreeHostImpl* hostImpl, int id); + TextureLayerImpl(LayerTreeImpl* treeImpl, int id); virtual const char* layerTypeAsString() const OVERRIDE; diff --git a/cc/texture_layer_unittest.cc b/cc/texture_layer_unittest.cc index 887f1b4..c58ae90 100644 --- a/cc/texture_layer_unittest.cc +++ b/cc/texture_layer_unittest.cc @@ -100,7 +100,7 @@ TEST_F(TextureLayerTest, syncImplWhenDrawing) scoped_refptr<TextureLayer> testLayer = TextureLayer::create(0); ASSERT_TRUE(testLayer); scoped_ptr<TextureLayerImpl> implLayer; - implLayer = TextureLayerImpl::create(&m_hostImpl, 1); + implLayer = TextureLayerImpl::create(m_hostImpl.activeTree(), 1); ASSERT_TRUE(implLayer); EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber()); diff --git a/cc/tiled_layer.cc b/cc/tiled_layer.cc index b956a2f..67e6d8c 100644 --- a/cc/tiled_layer.cc +++ b/cc/tiled_layer.cc @@ -95,9 +95,9 @@ TiledLayer::~TiledLayer() { } -scoped_ptr<LayerImpl> TiledLayer::createLayerImpl(LayerTreeHostImpl* hostImpl) +scoped_ptr<LayerImpl> TiledLayer::createLayerImpl(LayerTreeImpl* treeImpl) { - return TiledLayerImpl::create(hostImpl, id()).PassAs<LayerImpl>(); + return TiledLayerImpl::create(treeImpl, id()).PassAs<LayerImpl>(); } void TiledLayer::updateTileSizeAndTilingOption() diff --git a/cc/tiled_layer.h b/cc/tiled_layer.h index aa6703a..9d47784 100644 --- a/cc/tiled_layer.h +++ b/cc/tiled_layer.h @@ -67,7 +67,7 @@ protected: virtual PrioritizedResourceManager* resourceManager() const; private: - virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeHostImpl* hostImpl) OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERRIDE; void createTilerIfNeeded(); void setTilingOption(TilingOption); diff --git a/cc/tiled_layer_impl.cc b/cc/tiled_layer_impl.cc index 5998915a..ede77cb 100644 --- a/cc/tiled_layer_impl.cc +++ b/cc/tiled_layer_impl.cc @@ -48,8 +48,8 @@ private: DISALLOW_COPY_AND_ASSIGN(DrawableTile); }; -TiledLayerImpl::TiledLayerImpl(LayerTreeHostImpl* hostImpl, int id) - : LayerImpl(hostImpl, id) +TiledLayerImpl::TiledLayerImpl(LayerTreeImpl* treeImpl, int id) + : LayerImpl(treeImpl, id) , m_skipsDraw(true) { } diff --git a/cc/tiled_layer_impl.h b/cc/tiled_layer_impl.h index 8638310..81726b8 100644 --- a/cc/tiled_layer_impl.h +++ b/cc/tiled_layer_impl.h @@ -15,9 +15,9 @@ class DrawableTile; class CC_EXPORT TiledLayerImpl : public LayerImpl { public: - static scoped_ptr<TiledLayerImpl> create(LayerTreeHostImpl* hostImpl, int id) + static scoped_ptr<TiledLayerImpl> create(LayerTreeImpl* treeImpl, int id) { - return make_scoped_ptr(new TiledLayerImpl(hostImpl, id)); + return make_scoped_ptr(new TiledLayerImpl(treeImpl, id)); } virtual ~TiledLayerImpl(); @@ -36,7 +36,7 @@ public: virtual void didLoseOutputSurface() OVERRIDE; protected: - TiledLayerImpl(LayerTreeHostImpl* hostImpl, int id); + TiledLayerImpl(LayerTreeImpl* treeImpl, int id); // Exposed for testing. bool hasTileAt(int, int) const; bool hasResourceIdForTileAt(int, int) const; diff --git a/cc/tiled_layer_impl_unittest.cc b/cc/tiled_layer_impl_unittest.cc index 7219605..e784fc7 100644 --- a/cc/tiled_layer_impl_unittest.cc +++ b/cc/tiled_layer_impl_unittest.cc @@ -33,7 +33,7 @@ public: // visibility of the entire layer size. scoped_ptr<TiledLayerImpl> createLayer(const gfx::Size& tileSize, const gfx::Size& layerSize, LayerTilingData::BorderTexelOption borderTexels) { - scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::create(&m_hostImpl, 1); + scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::create(m_hostImpl.activeTree(), 1); scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(tileSize, borderTexels); tiler->setBounds(layerSize); layer->setTilingData(*tiler); diff --git a/cc/tiled_layer_unittest.cc b/cc/tiled_layer_unittest.cc index d23df5f..10f05ea 100644 --- a/cc/tiled_layer_unittest.cc +++ b/cc/tiled_layer_unittest.cc @@ -76,9 +76,9 @@ public: class ScopedFakeTiledLayerImpl { public: - ScopedFakeTiledLayerImpl(LayerTreeHostImpl* hostImpl, int id) + ScopedFakeTiledLayerImpl(LayerTreeImpl* treeImpl, int id) { - m_layerImpl = new FakeTiledLayerImpl(hostImpl, id); + m_layerImpl = new FakeTiledLayerImpl(treeImpl, id); } ~ScopedFakeTiledLayerImpl() { @@ -182,7 +182,7 @@ public: TEST_F(TiledLayerTest, pushDirtyTiles) { scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(gfx::Size(100, 200)); @@ -208,7 +208,7 @@ TEST_F(TiledLayerTest, pushDirtyTiles) TEST_F(TiledLayerTest, pushOccludedDirtyTiles) { scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); TestOcclusionTracker occluded; m_occlusion = &occluded; @@ -245,7 +245,7 @@ TEST_F(TiledLayerTest, pushOccludedDirtyTiles) TEST_F(TiledLayerTest, pushDeletedTiles) { scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(gfx::Size(100, 200)); @@ -280,7 +280,7 @@ TEST_F(TiledLayerTest, pushDeletedTiles) TEST_F(TiledLayerTest, pushIdlePaintTiles) { scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); // The tile size is 100x100. Setup 5x5 tiles with one visible tile in the center. // This paints 1 visible of the 25 invalid tiles. @@ -316,7 +316,7 @@ TEST_F(TiledLayerTest, pushIdlePaintTiles) TEST_F(TiledLayerTest, predictivePainting) { scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); // Prepainting should occur in the scroll direction first, and the // visible rect should be extruded only along the dominant axis. @@ -390,9 +390,9 @@ TEST_F(TiledLayerTest, pushTilesAfterIdlePaintFailed) // Start with 2mb of memory, but the test is going to try to use just more than 1mb, so we reduce to 1mb later. m_resourceManager->setMaxMemoryLimitBytes(2 * 1024 * 1024); scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); - ScopedFakeTiledLayerImpl layerImpl1(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl1(m_hostImpl->activeTree(), 1); scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); - ScopedFakeTiledLayerImpl layerImpl2(m_hostImpl.get(), 2); + ScopedFakeTiledLayerImpl layerImpl2(m_hostImpl->activeTree(), 2); // For this test we have two layers. layer1 exhausts most texture memory, leaving room for 2 more tiles from // layer2, but not all three tiles. First we paint layer1, and one tile from layer2. Then when we idle paint @@ -442,7 +442,7 @@ TEST_F(TiledLayerTest, pushTilesAfterIdlePaintFailed) TEST_F(TiledLayerTest, pushIdlePaintedOccludedTiles) { scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); TestOcclusionTracker occluded; m_occlusion = &occluded; @@ -461,7 +461,7 @@ TEST_F(TiledLayerTest, pushIdlePaintedOccludedTiles) TEST_F(TiledLayerTest, pushTilesMarkedDirtyDuringPaint) { scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); // The tile size is 100x100, so this invalidates and then paints two tiles. // However, during the paint, we invalidate one of the tiles. This should @@ -480,8 +480,8 @@ TEST_F(TiledLayerTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) { scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); - ScopedFakeTiledLayerImpl layer1Impl(m_hostImpl.get(), 1); - ScopedFakeTiledLayerImpl layer2Impl(m_hostImpl.get(), 2); + ScopedFakeTiledLayerImpl layer1Impl(m_hostImpl->activeTree(), 1); + ScopedFakeTiledLayerImpl layer2Impl(m_hostImpl->activeTree(), 2); // Invalidate a tile on layer1, during update of layer 2. layer2->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(0, 50, 100, 50), layer1.get()); @@ -503,8 +503,8 @@ TEST_F(TiledLayerTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer) { scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); - ScopedFakeTiledLayerImpl layer1Impl(m_hostImpl.get(), 1); - ScopedFakeTiledLayerImpl layer2Impl(m_hostImpl.get(), 2); + ScopedFakeTiledLayerImpl layer1Impl(m_hostImpl->activeTree(), 1); + ScopedFakeTiledLayerImpl layer2Impl(m_hostImpl->activeTree(), 2); layer1->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(0, 50, 100, 50), layer2.get()); layer1->setBounds(gfx::Size(100, 200)); @@ -545,7 +545,7 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately) m_resourceManager->setMaxMemoryLimitBytes(memoryForLayer); scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); // Full size layer with half being visible. gfx::Size contentBounds(layerWidth, layerHeight); @@ -587,7 +587,7 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately) TEST_F(TiledLayerTest, idlePaintOutOfMemory) { scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); // We have enough memory for only the visible rect, so we will run out of memory in first idle paint. int memoryLimit = 4 * 100 * 100; // 1 tiles, 4 bytes per pixel. @@ -610,7 +610,7 @@ TEST_F(TiledLayerTest, idlePaintOutOfMemory) TEST_F(TiledLayerTest, idlePaintZeroSizedLayer) { scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); bool animating[2] = {false, true}; for (int i = 0; i < 2; i++) { @@ -637,7 +637,7 @@ TEST_F(TiledLayerTest, idlePaintZeroSizedLayer) TEST_F(TiledLayerTest, idlePaintNonVisibleLayers) { scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); // Alternate between not visible and visible. gfx::Rect v(0, 0, 100, 100); @@ -667,7 +667,7 @@ TEST_F(TiledLayerTest, idlePaintNonVisibleLayers) TEST_F(TiledLayerTest, invalidateFromPrepare) { scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(gfx::Size(100, 200)); @@ -740,7 +740,7 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled) TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges) { scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); // Create a layer with one tile. layer->setBounds(gfx::Size(100, 100)); @@ -892,7 +892,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) m_layerTreeHost->updateLayers( *m_queue.get(), std::numeric_limits<size_t>::max()); { - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); EXPECT_EQ(6, m_queue->fullUploadSize()); EXPECT_EQ(0, m_queue->partialUploadSize()); updateTextures(); @@ -907,7 +907,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) layer->invalidateContentRect(gfx::Rect(0, 0, 300, 150)); m_layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max()); { - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); EXPECT_EQ(3, m_queue->fullUploadSize()); EXPECT_EQ(3, m_queue->partialUploadSize()); updateTextures(); @@ -921,7 +921,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) // Partial update of 6 tiles. layer->invalidateContentRect(gfx::Rect(50, 50, 200, 100)); { - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); m_layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max()); EXPECT_EQ(2, m_queue->fullUploadSize()); EXPECT_EQ(4, m_queue->partialUploadSize()); @@ -936,7 +936,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) // Checkerboard all tiles. layer->invalidateContentRect(gfx::Rect(0, 0, 300, 200)); { - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); layerPushPropertiesTo(layer.get(), layerImpl.get()); } m_layerTreeHost->commitComplete(); @@ -944,7 +944,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) // Partial update of 6 checkerboard tiles. layer->invalidateContentRect(gfx::Rect(50, 50, 200, 100)); { - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); m_layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max()); EXPECT_EQ(6, m_queue->fullUploadSize()); EXPECT_EQ(0, m_queue->partialUploadSize()); @@ -959,7 +959,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) // Partial update of 4 tiles. layer->invalidateContentRect(gfx::Rect(50, 50, 100, 100)); { - ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1); + ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1); m_layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max()); EXPECT_EQ(0, m_queue->fullUploadSize()); EXPECT_EQ(4, m_queue->partialUploadSize()); @@ -1439,9 +1439,9 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) child->fakeLayerUpdater()->clearUpdateCount(); child2->fakeLayerUpdater()->clearUpdateCount(); - ScopedFakeTiledLayerImpl rootImpl(m_hostImpl.get(), root->id()); - ScopedFakeTiledLayerImpl childImpl(m_hostImpl.get(), child->id()); - ScopedFakeTiledLayerImpl child2Impl(m_hostImpl.get(), child2->id()); + ScopedFakeTiledLayerImpl rootImpl(m_hostImpl->activeTree(), root->id()); + ScopedFakeTiledLayerImpl childImpl(m_hostImpl->activeTree(), child->id()); + ScopedFakeTiledLayerImpl child2Impl(m_hostImpl->activeTree(), child2->id()); layerPushPropertiesTo(root.get(), rootImpl.get()); layerPushPropertiesTo(child.get(), childImpl.get()); layerPushPropertiesTo(child2.get(), child2Impl.get()); @@ -1474,9 +1474,9 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) child->fakeLayerUpdater()->clearUpdateCount(); child2->fakeLayerUpdater()->clearUpdateCount(); - ScopedFakeTiledLayerImpl rootImpl(m_hostImpl.get(), root->id()); - ScopedFakeTiledLayerImpl childImpl(m_hostImpl.get(), child->id()); - ScopedFakeTiledLayerImpl child2Impl(m_hostImpl.get(), child2->id()); + ScopedFakeTiledLayerImpl rootImpl(m_hostImpl->activeTree(), root->id()); + ScopedFakeTiledLayerImpl childImpl(m_hostImpl->activeTree(), child->id()); + ScopedFakeTiledLayerImpl child2Impl(m_hostImpl->activeTree(), child2->id()); layerPushPropertiesTo(root.get(), rootImpl.get()); layerPushPropertiesTo(child.get(), childImpl.get()); layerPushPropertiesTo(child2.get(), child2Impl.get()); @@ -1510,9 +1510,9 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) child->fakeLayerUpdater()->clearUpdateCount(); child2->fakeLayerUpdater()->clearUpdateCount(); - ScopedFakeTiledLayerImpl rootImpl(m_hostImpl.get(), root->id()); - ScopedFakeTiledLayerImpl childImpl(m_hostImpl.get(), child->id()); - ScopedFakeTiledLayerImpl child2Impl(m_hostImpl.get(), child2->id()); + ScopedFakeTiledLayerImpl rootImpl(m_hostImpl->activeTree(), root->id()); + ScopedFakeTiledLayerImpl childImpl(m_hostImpl->activeTree(), child->id()); + ScopedFakeTiledLayerImpl child2Impl(m_hostImpl->activeTree(), child2->id()); layerPushPropertiesTo(root.get(), rootImpl.get()); layerPushPropertiesTo(child.get(), childImpl.get()); layerPushPropertiesTo(child2.get(), child2Impl.get()); diff --git a/cc/tree_synchronizer.cc b/cc/tree_synchronizer.cc index 863edef..8f62f9b 100644 --- a/cc/tree_synchronizer.cc +++ b/cc/tree_synchronizer.cc @@ -13,7 +13,7 @@ namespace cc { -scoped_ptr<LayerImpl> TreeSynchronizer::synchronizeTrees(Layer* layerRoot, scoped_ptr<LayerImpl> oldLayerImplRoot, LayerTreeHostImpl* hostImpl) +scoped_ptr<LayerImpl> TreeSynchronizer::synchronizeTrees(Layer* layerRoot, scoped_ptr<LayerImpl> oldLayerImplRoot, LayerTreeImpl* treeImpl) { TRACE_EVENT0("cc", "TreeSynchronizer::synchronizeTrees"); ScopedPtrLayerImplMap oldLayers; @@ -21,7 +21,7 @@ scoped_ptr<LayerImpl> TreeSynchronizer::synchronizeTrees(Layer* layerRoot, scope collectExistingLayerImplRecursive(oldLayers, oldLayerImplRoot.Pass()); - scoped_ptr<LayerImpl> newTree = synchronizeTreeRecursive(newLayers, oldLayers, layerRoot, hostImpl); + scoped_ptr<LayerImpl> newTree = synchronizeTreeRecursive(newLayers, oldLayers, layerRoot, treeImpl); updateScrollbarLayerPointersRecursive(newLayers, layerRoot); @@ -44,31 +44,31 @@ void TreeSynchronizer::collectExistingLayerImplRecursive(ScopedPtrLayerImplMap& oldLayers.set(id, layerImpl.Pass()); } -scoped_ptr<LayerImpl> TreeSynchronizer::reuseOrCreateLayerImpl(RawPtrLayerImplMap& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer* layer, LayerTreeHostImpl* hostImpl) +scoped_ptr<LayerImpl> TreeSynchronizer::reuseOrCreateLayerImpl(RawPtrLayerImplMap& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer* layer, LayerTreeImpl* treeImpl) { scoped_ptr<LayerImpl> layerImpl = oldLayers.take(layer->id()); if (!layerImpl) - layerImpl = layer->createLayerImpl(hostImpl); + layerImpl = layer->createLayerImpl(treeImpl); newLayers[layer->id()] = layerImpl.get(); return layerImpl.Pass(); } -scoped_ptr<LayerImpl> TreeSynchronizer::synchronizeTreeRecursive(RawPtrLayerImplMap& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer* layer, LayerTreeHostImpl* hostImpl) +scoped_ptr<LayerImpl> TreeSynchronizer::synchronizeTreeRecursive(RawPtrLayerImplMap& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer* layer, LayerTreeImpl* treeImpl) { if (!layer) return scoped_ptr<LayerImpl>(); - scoped_ptr<LayerImpl> layerImpl = reuseOrCreateLayerImpl(newLayers, oldLayers, layer, hostImpl); + scoped_ptr<LayerImpl> layerImpl = reuseOrCreateLayerImpl(newLayers, oldLayers, layer, treeImpl); layerImpl->clearChildList(); const std::vector<scoped_refptr<Layer> >& children = layer->children(); for (size_t i = 0; i < children.size(); ++i) - layerImpl->addChild(synchronizeTreeRecursive(newLayers, oldLayers, children[i].get(), hostImpl)); + layerImpl->addChild(synchronizeTreeRecursive(newLayers, oldLayers, children[i].get(), treeImpl)); - layerImpl->setMaskLayer(synchronizeTreeRecursive(newLayers, oldLayers, layer->maskLayer(), hostImpl)); - layerImpl->setReplicaLayer(synchronizeTreeRecursive(newLayers, oldLayers, layer->replicaLayer(), hostImpl)); + layerImpl->setMaskLayer(synchronizeTreeRecursive(newLayers, oldLayers, layer->maskLayer(), treeImpl)); + layerImpl->setReplicaLayer(synchronizeTreeRecursive(newLayers, oldLayers, layer->replicaLayer(), treeImpl)); layer->pushPropertiesTo(layerImpl.get()); diff --git a/cc/tree_synchronizer.h b/cc/tree_synchronizer.h index 65ff3ba..d7922c3 100644 --- a/cc/tree_synchronizer.h +++ b/cc/tree_synchronizer.h @@ -13,14 +13,14 @@ namespace cc { class LayerImpl; -class LayerTreeHostImpl; +class LayerTreeImpl; class Layer; class CC_EXPORT TreeSynchronizer { public: // Accepts a Layer tree and returns a reference to a LayerImpl tree that duplicates the structure // of the Layer tree, reusing the LayerImpls in the tree provided by oldLayerImplRoot if possible. - static scoped_ptr<LayerImpl> synchronizeTrees(Layer* layerRoot, scoped_ptr<LayerImpl> oldLayerImplRoot, LayerTreeHostImpl*); + static scoped_ptr<LayerImpl> synchronizeTrees(Layer* layerRoot, scoped_ptr<LayerImpl> oldLayerImplRoot, LayerTreeImpl*); private: TreeSynchronizer(); // Not instantiable. @@ -29,9 +29,9 @@ private: typedef base::hash_map<int, LayerImpl*> RawPtrLayerImplMap; // Declared as static member functions so they can access functions on Layer as a friend class. - static scoped_ptr<LayerImpl> reuseOrCreateLayerImpl(RawPtrLayerImplMap& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer*, LayerTreeHostImpl*); + static scoped_ptr<LayerImpl> reuseOrCreateLayerImpl(RawPtrLayerImplMap& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer*, LayerTreeImpl*); static void collectExistingLayerImplRecursive(ScopedPtrLayerImplMap& oldLayers, scoped_ptr<LayerImpl>); - static scoped_ptr<LayerImpl> synchronizeTreeRecursive(RawPtrLayerImplMap& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer*, LayerTreeHostImpl*); + static scoped_ptr<LayerImpl> synchronizeTreeRecursive(RawPtrLayerImplMap& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer*, LayerTreeImpl*); static void updateScrollbarLayerPointersRecursive(const RawPtrLayerImplMap& newLayers, Layer*); DISALLOW_COPY_AND_ASSIGN(TreeSynchronizer); diff --git a/cc/tree_synchronizer_unittest.cc b/cc/tree_synchronizer_unittest.cc index fb15c10..94aadf3 100644 --- a/cc/tree_synchronizer_unittest.cc +++ b/cc/tree_synchronizer_unittest.cc @@ -20,9 +20,9 @@ namespace { class MockLayerImpl : public LayerImpl { public: - static scoped_ptr<MockLayerImpl> create(LayerTreeHostImpl* hostImpl, int layerId) + static scoped_ptr<MockLayerImpl> create(LayerTreeImpl* treeImpl, int layerId) { - return make_scoped_ptr(new MockLayerImpl(hostImpl, layerId)); + return make_scoped_ptr(new MockLayerImpl(treeImpl, layerId)); } virtual ~MockLayerImpl() { @@ -33,8 +33,8 @@ public: void setLayerImplDestructionList(std::vector<int>* list) { m_layerImplDestructionList = list; } private: - MockLayerImpl(LayerTreeHostImpl* hostImpl, int layerId) - : LayerImpl(hostImpl, layerId) + MockLayerImpl(LayerTreeImpl* treeImpl, int layerId) + : LayerImpl(treeImpl, layerId) , m_layerImplDestructionList(0) { } @@ -49,9 +49,9 @@ public: return make_scoped_refptr(new MockLayer(layerImplDestructionList)); } - virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeHostImpl* hostImpl) OVERRIDE + virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERRIDE { - return MockLayerImpl::create(hostImpl, m_layerId).PassAs<LayerImpl>(); + return MockLayerImpl::create(treeImpl, m_layerId).PassAs<LayerImpl>(); } virtual void pushPropertiesTo(LayerImpl* layerImpl) OVERRIDE @@ -98,23 +98,23 @@ private: bool m_synchronizedAnimations; }; -void expectTreesAreIdentical(Layer* layer, LayerImpl* layerImpl, LayerTreeHostImpl* hostImpl) +void expectTreesAreIdentical(Layer* layer, LayerImpl* layerImpl, LayerTreeImpl* treeImpl) { ASSERT_TRUE(layer); ASSERT_TRUE(layerImpl); EXPECT_EQ(layer->id(), layerImpl->id()); - EXPECT_EQ(layerImpl->layerTreeHostImpl(), hostImpl); + EXPECT_EQ(layerImpl->layerTreeImpl(), treeImpl); EXPECT_EQ(layer->nonFastScrollableRegion(), layerImpl->nonFastScrollableRegion()); ASSERT_EQ(!!layer->maskLayer(), !!layerImpl->maskLayer()); if (layer->maskLayer()) - expectTreesAreIdentical(layer->maskLayer(), layerImpl->maskLayer(), hostImpl); + expectTreesAreIdentical(layer->maskLayer(), layerImpl->maskLayer(), treeImpl); ASSERT_EQ(!!layer->replicaLayer(), !!layerImpl->replicaLayer()); if (layer->replicaLayer()) - expectTreesAreIdentical(layer->replicaLayer(), layerImpl->replicaLayer(), hostImpl); + expectTreesAreIdentical(layer->replicaLayer(), layerImpl->replicaLayer(), treeImpl); const std::vector<scoped_refptr<Layer> >& layerChildren = layer->children(); const ScopedPtrVector<LayerImpl>& layerImplChildren = layerImpl->children(); @@ -122,7 +122,7 @@ void expectTreesAreIdentical(Layer* layer, LayerImpl* layerImpl, LayerTreeHostIm ASSERT_EQ(layerChildren.size(), layerImplChildren.size()); for (size_t i = 0; i < layerChildren.size(); ++i) - expectTreesAreIdentical(layerChildren[i].get(), layerImplChildren[i], hostImpl); + expectTreesAreIdentical(layerChildren[i].get(), layerImplChildren[i], treeImpl); } // Attempts to synchronizes a null tree. This should not crash, and should @@ -146,9 +146,9 @@ TEST(TreeSynchronizerTest, syncSimpleTreeFromEmpty) layerTreeRoot->addChild(Layer::create()); layerTreeRoot->addChild(Layer::create()); - scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl->activeTree()); - expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl->activeTree()); } // Constructs a very simple tree and synchronizes it attempting to reuse some layers @@ -165,8 +165,8 @@ TEST(TreeSynchronizerTest, syncSimpleTreeReusingLayers) layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); - scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl->activeTree()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl->activeTree()); // Add a new layer to the Layer side layerTreeRoot->children()[0]->addChild(MockLayer::create(&layerImplDestructionList)); @@ -175,8 +175,8 @@ TEST(TreeSynchronizerTest, syncSimpleTreeReusingLayers) int secondLayerImplId = layerImplTreeRoot->children()[1]->id(); // Synchronize again. After the sync the trees should be equivalent and we should have created and destroyed one LayerImpl. - layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl->activeTree()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl->activeTree()); ASSERT_EQ(1u, layerImplDestructionList.size()); EXPECT_EQ(secondLayerImplId, layerImplDestructionList[0]); @@ -198,15 +198,15 @@ TEST(TreeSynchronizerTest, syncSimpleTreeAndTrackStackingOrderChange) scoped_refptr<Layer> child2 = MockLayer::create(&layerImplDestructionList); layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); layerTreeRoot->addChild(child2); - scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl->activeTree()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl->activeTree()); layerImplTreeRoot->resetAllChangeTrackingForSubtree(); // re-insert the layer and sync again. child2->removeFromParent(); layerTreeRoot->addChild(child2); - layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl->activeTree()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl->activeTree()); // Check that the impl thread properly tracked the change. EXPECT_FALSE(layerImplTreeRoot->layerPropertyChanged()); @@ -235,8 +235,8 @@ TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties) gfx::Size secondChildBounds = gfx::Size(25, 53); layerTreeRoot->children()[1]->setBounds(secondChildBounds); - scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl->activeTree()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl->activeTree()); // Check that the property values we set on the Layer tree are reflected in the LayerImpl tree. gfx::PointF rootLayerImplPosition = layerImplTreeRoot->position(); @@ -276,8 +276,8 @@ TEST(TreeSynchronizerTest, reuseLayerImplsAfterStructuralChange) layerB->addChild(MockLayer::create(&layerImplDestructionList)); scoped_refptr<Layer> layerD = layerB->children()[1].get(); - scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl->activeTree()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl->activeTree()); // Now restructure the tree to look like this: // root --- D ---+--- A @@ -294,8 +294,8 @@ TEST(TreeSynchronizerTest, reuseLayerImplsAfterStructuralChange) layerC->addChild(layerB); // After another synchronize our trees should match and we should not have destroyed any LayerImpls - layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl->activeTree()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl->activeTree()); EXPECT_EQ(0u, layerImplDestructionList.size()); } @@ -318,16 +318,16 @@ TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy) int oldTreeFirstChildLayerId = oldLayerTreeRoot->children()[0]->id(); int oldTreeSecondChildLayerId = oldLayerTreeRoot->children()[1]->id(); - scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(oldLayerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); - expectTreesAreIdentical(oldLayerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(oldLayerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl->activeTree()); + expectTreesAreIdentical(oldLayerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl->activeTree()); // Remove all children on the Layer side. oldLayerTreeRoot->removeAllChildren(); // Synchronize again. After the sync all LayerImpls from the old tree should be deleted. scoped_refptr<Layer> newLayerTreeRoot = Layer::create(); - layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(newLayerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); - expectTreesAreIdentical(newLayerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(newLayerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl->activeTree()); + expectTreesAreIdentical(newLayerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl->activeTree()); ASSERT_EQ(3u, layerImplDestructionList.size()); @@ -363,24 +363,24 @@ TEST(TreeSynchronizerTest, syncMaskReplicaAndReplicaMaskLayers) replicaLayerWithMask->setMaskLayer(replicaMaskLayer.get()); layerTreeRoot->children()[2]->setReplicaLayer(replicaLayerWithMask.get()); - scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl->activeTree()); - expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl->activeTree()); // Remove the mask layer. layerTreeRoot->children()[0]->setMaskLayer(0); - layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl->activeTree()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl->activeTree()); // Remove the replica layer. layerTreeRoot->children()[1]->setReplicaLayer(0); - layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl->activeTree()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl->activeTree()); // Remove the replica mask. replicaLayerWithMask->setMaskLayer(0); - layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); - expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl->activeTree()); + expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl->activeTree()); } TEST(TreeSynchronizerTest, synchronizeAnimations) @@ -397,8 +397,8 @@ TEST(TreeSynchronizerTest, synchronizeAnimations) EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations()); - scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); - layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); + scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl->activeTree()); + layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl->activeTree()); EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations()); } diff --git a/cc/video_layer.cc b/cc/video_layer.cc index 05f2c16..9ba8a28 100644 --- a/cc/video_layer.cc +++ b/cc/video_layer.cc @@ -27,9 +27,9 @@ VideoLayer::~VideoLayer() { } -scoped_ptr<LayerImpl> VideoLayer::createLayerImpl(LayerTreeHostImpl* hostImpl) +scoped_ptr<LayerImpl> VideoLayer::createLayerImpl(LayerTreeImpl* treeImpl) { - return VideoLayerImpl::create(hostImpl, m_layerId, m_provider, m_unwrapper).PassAs<LayerImpl>(); + return VideoLayerImpl::create(treeImpl, m_layerId, m_provider, m_unwrapper).PassAs<LayerImpl>(); } } // namespace cc diff --git a/cc/video_layer.h b/cc/video_layer.h index ba90500..2525079 100644 --- a/cc/video_layer.h +++ b/cc/video_layer.h @@ -30,7 +30,7 @@ public: static scoped_refptr<VideoLayer> create(WebKit::WebVideoFrameProvider*, const FrameUnwrapper&); - virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeHostImpl* hostImpl) OVERRIDE; + virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERRIDE; private: VideoLayer(WebKit::WebVideoFrameProvider*, const FrameUnwrapper&); diff --git a/cc/video_layer_impl.cc b/cc/video_layer_impl.cc index d729156..5f91b37 100644 --- a/cc/video_layer_impl.cc +++ b/cc/video_layer_impl.cc @@ -19,9 +19,9 @@ namespace cc { -VideoLayerImpl::VideoLayerImpl(LayerTreeHostImpl* hostImpl, int id, WebKit::WebVideoFrameProvider* provider, +VideoLayerImpl::VideoLayerImpl(LayerTreeImpl* treeImpl, int id, WebKit::WebVideoFrameProvider* provider, const FrameUnwrapper& unwrapper) - : LayerImpl(hostImpl, id) + : LayerImpl(treeImpl, id) , m_provider(provider) , m_unwrapper(unwrapper) , m_webFrame(0) diff --git a/cc/video_layer_impl.h b/cc/video_layer_impl.h index 00ab57f..9c9605e 100644 --- a/cc/video_layer_impl.h +++ b/cc/video_layer_impl.h @@ -34,10 +34,10 @@ class CC_EXPORT VideoLayerImpl : public LayerImpl public: typedef base::Callback<media::VideoFrame* (WebKit::WebVideoFrame*)> FrameUnwrapper; - static scoped_ptr<VideoLayerImpl> create(LayerTreeHostImpl* hostImpl, int id, WebKit::WebVideoFrameProvider* provider, + static scoped_ptr<VideoLayerImpl> create(LayerTreeImpl* treeImpl, int id, WebKit::WebVideoFrameProvider* provider, const FrameUnwrapper& unwrapper) { - return make_scoped_ptr(new VideoLayerImpl(hostImpl, id, provider, unwrapper)); + return make_scoped_ptr(new VideoLayerImpl(treeImpl, id, provider, unwrapper)); } virtual ~VideoLayerImpl(); @@ -66,7 +66,7 @@ public: }; private: - VideoLayerImpl(LayerTreeHostImpl*, int, WebKit::WebVideoFrameProvider*, const FrameUnwrapper&); + VideoLayerImpl(LayerTreeImpl*, int, WebKit::WebVideoFrameProvider*, const FrameUnwrapper&); virtual const char* layerTypeAsString() const OVERRIDE; |