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

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: 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
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..02a447f68f1bdbee0dca5b269ba4bcf39ca8b44e 100644
--- a/cc/trees/layer_tree_host_unittest_occlusion.cc
+++ b/cc/trees/layer_tree_host_unittest_occlusion.cc
@@ -35,6 +35,7 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnLayer
root->SetIsDrawable(true);
scoped_refptr<Layer> child = Layer::Create();
+ child_ = child.get();
child->SetBounds(gfx::Size(50, 60));
child->SetPosition(gfx::PointF(10.f, 5.5f));
child->SetContentsOpaque(true);
@@ -49,7 +50,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 +68,9 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnLayer
}
void AfterTest() override {}
+
+ private:
+ Layer* child_;
ajuma 2016/04/20 21:40:52 scoped_refptr
sunxd 2016/04/21 17:31:15 Done.
};
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestDrawPropertiesOnLayer);
@@ -81,6 +85,7 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnSurface
root->SetIsDrawable(true);
scoped_refptr<Layer> child = Layer::Create();
+ child_ = child.get();
child->SetBounds(gfx::Size(1, 1));
child->SetPosition(gfx::PointF(10.f, 5.5f));
child->SetIsDrawable(true);
@@ -102,7 +107,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 +124,9 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnSurface
}
void AfterTest() override {}
+
+ private:
+ Layer* child_;
ajuma 2016/04/20 21:40:52 scoped_refptr
sunxd 2016/04/21 17:31:15 Done.
};
SINGLE_AND_MULTI_THREAD_TEST_F(
@@ -134,6 +142,7 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnMask
root->SetIsDrawable(true);
scoped_refptr<Layer> child = Layer::Create();
+ child_ = child.get();
child->SetBounds(gfx::Size(30, 40));
child->SetPosition(gfx::PointF(10.f, 5.5f));
child->SetIsDrawable(true);
@@ -166,7 +175,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 +197,9 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnMask
void AfterTest() override {}
+ private:
FakeContentLayerClient client_;
+ Layer* child_;
ajuma 2016/04/20 21:40:52 scoped_refptr
sunxd 2016/04/21 17:31:15 Done.
};
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestDrawPropertiesOnMask);
@@ -206,6 +217,7 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnScaledMask
scale.Scale(2, 2);
scoped_refptr<Layer> child = Layer::Create();
+ child_ = child.get();
child->SetBounds(gfx::Size(30, 40));
child->SetTransform(scale);
root->AddChild(child);
@@ -236,8 +248,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 +263,9 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnScaledMask
void AfterTest() override {}
+ private:
FakeContentLayerClient client_;
+ Layer* child_;
ajuma 2016/04/20 21:40:52 scoped_refptr
sunxd 2016/04/21 17:31:16 Done.
};
SINGLE_AND_MULTI_THREAD_TEST_F(
@@ -271,6 +284,7 @@ class LayerTreeHostOcclusionTestDrawPropertiesInsideReplica
root->SetIsDrawable(true);
scoped_refptr<Layer> child = Layer::Create();
+ child_ = child.get();
child->SetBounds(gfx::Size(1, 1));
child->SetPosition(gfx::PointF(10.f, 5.5f));
child->SetIsDrawable(true);
@@ -304,7 +318,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 +344,9 @@ class LayerTreeHostOcclusionTestDrawPropertiesInsideReplica
void AfterTest() override {}
+ private:
FakeContentLayerClient client_;
+ Layer* child_;
ajuma 2016/04/20 21:40:52 scoped_refptr
sunxd 2016/04/21 17:31:16 Done.
};
SINGLE_AND_MULTI_THREAD_TEST_F(

Powered by Google App Engine
This is Rietveld 408576698