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

Unified Diff: cc/trees/layer_tree_host_unittest_occlusion.cc

Issue 1905713002: cc: Remove LayerImpl::children() calls from descendants of LayerTreeTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_unittest_damage.cc ('k') | cc/trees/layer_tree_host_unittest_picture.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest_occlusion.cc
diff --git a/cc/trees/layer_tree_host_unittest_occlusion.cc b/cc/trees/layer_tree_host_unittest_occlusion.cc
index 41d91da8152130e619b269ff2f8b57fdb2181f76..2550e2abe6504085f13daec0f6f7a19868cb7bc7 100644
--- a/cc/trees/layer_tree_host_unittest_occlusion.cc
+++ b/cc/trees/layer_tree_host_unittest_occlusion.cc
@@ -34,12 +34,12 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnLayer
root->SetBounds(gfx::Size(100, 100));
root->SetIsDrawable(true);
- scoped_refptr<Layer> child = Layer::Create();
- child->SetBounds(gfx::Size(50, 60));
- child->SetPosition(gfx::PointF(10.f, 5.5f));
- child->SetContentsOpaque(true);
- child->SetIsDrawable(true);
- root->AddChild(child);
+ child_ = Layer::Create();
+ child_->SetBounds(gfx::Size(50, 60));
+ child_->SetPosition(gfx::PointF(10.f, 5.5f));
+ child_->SetContentsOpaque(true);
+ child_->SetIsDrawable(true);
+ root->AddChild(child_);
layer_tree_host()->SetRootLayer(root);
LayerTreeTest::SetupTree();
@@ -49,7 +49,7 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnLayer
void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
LayerImpl* root = impl->active_tree()->root_layer();
- LayerImpl* child = root->children()[0];
+ LayerImpl* child = impl->active_tree()->LayerById(child_->id());
// Verify the draw properties are valid.
EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember());
@@ -67,6 +67,9 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnLayer
}
void AfterTest() override {}
+
+ private:
+ scoped_refptr<Layer> child_;
};
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestDrawPropertiesOnLayer);
@@ -80,12 +83,12 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnSurface
root->SetBounds(gfx::Size(100, 100));
root->SetIsDrawable(true);
- scoped_refptr<Layer> child = Layer::Create();
- child->SetBounds(gfx::Size(1, 1));
- child->SetPosition(gfx::PointF(10.f, 5.5f));
- child->SetIsDrawable(true);
- child->SetForceRenderSurface(true);
- root->AddChild(child);
+ child_ = Layer::Create();
+ child_->SetBounds(gfx::Size(1, 1));
+ child_->SetPosition(gfx::PointF(10.f, 5.5f));
+ child_->SetIsDrawable(true);
+ child_->SetForceRenderSurface(true);
+ root->AddChild(child_);
scoped_refptr<Layer> child2 = Layer::Create();
child2->SetBounds(gfx::Size(10, 12));
@@ -102,7 +105,7 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnSurface
void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
LayerImpl* root = impl->active_tree()->root_layer();
- LayerImpl* child = root->children()[0];
+ LayerImpl* child = impl->active_tree()->LayerById(child_->id());
RenderSurfaceImpl* surface = child->render_surface();
// Verify the draw properties are valid.
@@ -119,6 +122,9 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnSurface
}
void AfterTest() override {}
+
+ private:
+ scoped_refptr<Layer> child_;
};
SINGLE_AND_MULTI_THREAD_TEST_F(
@@ -133,22 +139,22 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnMask
root->SetBounds(gfx::Size(100, 100));
root->SetIsDrawable(true);
- scoped_refptr<Layer> child = Layer::Create();
- child->SetBounds(gfx::Size(30, 40));
- child->SetPosition(gfx::PointF(10.f, 5.5f));
- child->SetIsDrawable(true);
- root->AddChild(child);
+ child_ = Layer::Create();
+ child_->SetBounds(gfx::Size(30, 40));
+ child_->SetPosition(gfx::PointF(10.f, 5.5f));
+ child_->SetIsDrawable(true);
+ root->AddChild(child_);
scoped_refptr<Layer> make_surface_bigger = Layer::Create();
make_surface_bigger->SetBounds(gfx::Size(100, 100));
make_surface_bigger->SetPosition(gfx::PointF(-10.f, -15.f));
make_surface_bigger->SetIsDrawable(true);
- child->AddChild(make_surface_bigger);
+ child_->AddChild(make_surface_bigger);
scoped_refptr<Layer> mask = PictureLayer::Create(&client_);
mask->SetBounds(gfx::Size(30, 40));
mask->SetIsDrawable(true);
- child->SetMaskLayer(mask.get());
+ child_->SetMaskLayer(mask.get());
scoped_refptr<Layer> child2 = Layer::Create();
child2->SetBounds(gfx::Size(10, 12));
@@ -166,7 +172,7 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnMask
void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
LayerImpl* root = impl->active_tree()->root_layer();
- LayerImpl* child = root->children()[0];
+ LayerImpl* child = impl->active_tree()->LayerById(child_->id());
RenderSurfaceImpl* surface = child->render_surface();
LayerImpl* mask = child->mask_layer();
@@ -188,7 +194,9 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnMask
void AfterTest() override {}
+ private:
FakeContentLayerClient client_;
+ scoped_refptr<Layer> child_;
};
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestDrawPropertiesOnMask);
@@ -205,21 +213,21 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnScaledMask
gfx::Transform scale;
scale.Scale(2, 2);
- scoped_refptr<Layer> child = Layer::Create();
- child->SetBounds(gfx::Size(30, 40));
- child->SetTransform(scale);
- root->AddChild(child);
+ child_ = Layer::Create();
+ child_->SetBounds(gfx::Size(30, 40));
+ child_->SetTransform(scale);
+ root->AddChild(child_);
scoped_refptr<Layer> grand_child = Layer::Create();
grand_child->SetBounds(gfx::Size(100, 100));
grand_child->SetPosition(gfx::PointF(-10.f, -15.f));
grand_child->SetIsDrawable(true);
- child->AddChild(grand_child);
+ child_->AddChild(grand_child);
scoped_refptr<Layer> mask = PictureLayer::Create(&client_);
mask->SetBounds(gfx::Size(30, 40));
mask->SetIsDrawable(true);
- child->SetMaskLayer(mask.get());
+ child_->SetMaskLayer(mask.get());
scoped_refptr<Layer> child2 = Layer::Create();
child2->SetBounds(gfx::Size(10, 11));
@@ -236,8 +244,7 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnScaledMask
void BeginTest() override { PostSetNeedsCommitToMainThread(); }
void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
- LayerImpl* root = impl->active_tree()->root_layer();
- LayerImpl* child = root->children()[0];
+ LayerImpl* child = impl->active_tree()->LayerById(child_->id());
LayerImpl* mask = child->mask_layer();
gfx::Transform scale;
@@ -252,7 +259,9 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnScaledMask
void AfterTest() override {}
+ private:
FakeContentLayerClient client_;
+ scoped_refptr<Layer> child_;
};
SINGLE_AND_MULTI_THREAD_TEST_F(
@@ -270,23 +279,23 @@ class LayerTreeHostOcclusionTestDrawPropertiesInsideReplica
root->SetBounds(gfx::Size(100, 100));
root->SetIsDrawable(true);
- scoped_refptr<Layer> child = Layer::Create();
- child->SetBounds(gfx::Size(1, 1));
- child->SetPosition(gfx::PointF(10.f, 5.5f));
- child->SetIsDrawable(true);
- child->SetForceRenderSurface(true);
- root->AddChild(child);
+ child_ = Layer::Create();
+ child_->SetBounds(gfx::Size(1, 1));
+ child_->SetPosition(gfx::PointF(10.f, 5.5f));
+ child_->SetIsDrawable(true);
+ child_->SetForceRenderSurface(true);
+ root->AddChild(child_);
scoped_refptr<Layer> replica = Layer::Create();
gfx::Transform translate;
translate.Translate(20.f, 4.f);
replica->SetTransform(translate);
- child->SetReplicaLayer(replica.get());
+ child_->SetReplicaLayer(replica.get());
scoped_refptr<Layer> mask = PictureLayer::Create(&client_);
mask->SetBounds(gfx::Size(30, 40));
mask->SetIsDrawable(true);
- child->SetMaskLayer(mask.get());
+ child_->SetMaskLayer(mask.get());
scoped_refptr<Layer> child2 = Layer::Create();
child2->SetBounds(gfx::Size(10, 12));
@@ -304,7 +313,7 @@ class LayerTreeHostOcclusionTestDrawPropertiesInsideReplica
void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
LayerImpl* root = impl->active_tree()->root_layer();
- LayerImpl* child = root->children()[0];
+ LayerImpl* child = impl->active_tree()->LayerById(child_->id());
RenderSurfaceImpl* surface = child->render_surface();
LayerImpl* mask = child->mask_layer();
@@ -330,7 +339,9 @@ class LayerTreeHostOcclusionTestDrawPropertiesInsideReplica
void AfterTest() override {}
+ private:
FakeContentLayerClient client_;
+ scoped_refptr<Layer> child_;
};
SINGLE_AND_MULTI_THREAD_TEST_F(
« no previous file with comments | « cc/trees/layer_tree_host_unittest_damage.cc ('k') | cc/trees/layer_tree_host_unittest_picture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698