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

Unified Diff: cc/layer_impl.cc

Issue 11472021: cc: Pass LayerTreeHostImpl to LayerImpl constructor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/layer_impl.cc
diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc
index 2b78195fbc6bf305b71266bd4dc040ca8c25fe9b..21500a5380476634bf3174b1be9d6732a35e6c8f 100644
--- a/cc/layer_impl.cc
+++ b/cc/layer_impl.cc
@@ -18,12 +18,12 @@
namespace cc {
-LayerImpl::LayerImpl(int id)
+LayerImpl::LayerImpl(LayerTreeHostImpl* hostImpl, int id)
: m_parent(0)
, m_maskLayerId(-1)
, m_replicaLayerId(-1)
, m_layerId(id)
- , m_layerTreeHostImpl(0)
+ , m_layerTreeHostImpl(hostImpl)
, m_anchorPoint(0.5, 0.5)
, m_anchorPointZ(0)
, m_contentsScaleX(1.0)
@@ -53,6 +53,7 @@ LayerImpl::LayerImpl(int id)
, m_layerAnimationController(LayerAnimationController::create(this))
{
DCHECK(m_layerId > 0);
+ DCHECK(m_layerTreeHostImpl);
}
LayerImpl::~LayerImpl()
@@ -65,6 +66,7 @@ LayerImpl::~LayerImpl()
void LayerImpl::addChild(scoped_ptr<LayerImpl> child)
{
child->setParent(this);
+ DCHECK_EQ(layerTreeHostImpl(), child->layerTreeHostImpl());
m_children.append(child.Pass());
}
@@ -146,8 +148,6 @@ void LayerImpl::didDraw(ResourceProvider*)
bool LayerImpl::showDebugBorders() const
{
- if (!m_layerTreeHostImpl)
- return false;
return m_layerTreeHostImpl->debugState().showDebugBorders;
}
@@ -450,6 +450,8 @@ void LayerImpl::setBounds(const gfx::Size& bounds)
void LayerImpl::setMaskLayer(scoped_ptr<LayerImpl> maskLayer)
{
+ if (maskLayer)
+ DCHECK_EQ(layerTreeHostImpl(), maskLayer->layerTreeHostImpl());
m_maskLayer = maskLayer.Pass();
int newLayerId = m_maskLayer ? m_maskLayer->id() : -1;
@@ -462,6 +464,8 @@ void LayerImpl::setMaskLayer(scoped_ptr<LayerImpl> maskLayer)
void LayerImpl::setReplicaLayer(scoped_ptr<LayerImpl> replicaLayer)
{
+ if (replicaLayer)
+ DCHECK_EQ(layerTreeHostImpl(), replicaLayer->layerTreeHostImpl());
m_replicaLayer = replicaLayer.Pass();
int newLayerId = m_replicaLayer ? m_replicaLayer->id() : -1;
« no previous file with comments | « cc/layer_impl.h ('k') | cc/layer_impl_unittest.cc » ('j') | cc/test/fake_impl_proxy.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698