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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 465853004: Moving RenderSurface creation outside of CalcDrawProps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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_common_unittest.cc
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index feed1ed02008e049efb5f85f9d0c3f10ba7914b7..b8132a4990b935947cb5182d9d075ffebeef2181 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -309,6 +309,7 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
gfx::PointF(),
gfx::Size(500, 500),
true,
+ false,
false);
scoped_ptr<LayerImpl> scroll_layer_scoped_ptr(
@@ -320,6 +321,7 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
gfx::PointF(),
gfx::Size(10, 20),
true,
+ false,
false);
scoped_ptr<LayerImpl> clip_layer_scoped_ptr(
LayerImpl::Create(host_impl.active_tree(), 4));
@@ -344,8 +346,10 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
gfx::PointF(),
gfx::Size(3, 4),
true,
+ false,
false);
root->AddChild(clip_layer_scoped_ptr.Pass());
+ root->SetHasRenderSurface(true);
ExecuteCalculateDrawProperties(
root.get(), kDeviceScale, kPageScale, scroll_layer->parent());
@@ -369,6 +373,7 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
gfx::PointF(),
gfx::Size(10, 20),
true,
+ false,
false);
ExecuteCalculateDrawProperties(
root.get(), kDeviceScale, kPageScale, scroll_layer->parent());
@@ -3713,7 +3718,7 @@ TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithPreserves3d) {
EXPECT_FALSE(front_facing_child->render_surface());
EXPECT_FALSE(back_facing_child->render_surface());
EXPECT_TRUE(front_facing_surface->render_surface());
- EXPECT_FALSE(back_facing_surface->render_surface());
+ EXPECT_FALSE(back_facing_surface->render_target() == back_facing_surface);
danakj 2014/09/03 19:30:34 should we check that the surface was created also,
danakj 2014/09/03 19:30:35 EXPECT_NE
awoloszyn 2014/09/09 15:31:37 Done.
awoloszyn 2014/09/09 15:31:37 Correct, we should probably make sure that it was
EXPECT_FALSE(front_facing_child_of_front_facing_surface->render_surface());
EXPECT_FALSE(back_facing_child_of_front_facing_surface->render_surface());
EXPECT_FALSE(front_facing_child_of_back_facing_surface->render_surface());
@@ -3979,8 +3984,8 @@ TEST_F(LayerTreeHostCommonTest,
// Verify which render surfaces were created.
danakj 2014/09/03 19:30:35 and used?
awoloszyn 2014/09/09 15:31:37 Done.
EXPECT_TRUE(front_facing_surface->render_surface());
- EXPECT_FALSE(
- back_facing_surface->render_surface()); // because it should be culled
+ EXPECT_FALSE(back_facing_surface->render_target() ==
danakj 2014/09/03 19:30:34 should we check that the surface was created also,
danakj 2014/09/03 19:30:35 EXPECT_NE
awoloszyn 2014/09/09 15:31:37 Done.
awoloszyn 2014/09/09 15:31:37 Done.
+ back_facing_surface); // because it should be culled
EXPECT_FALSE(child1->render_surface());
EXPECT_FALSE(child2->render_surface());
@@ -5636,6 +5641,7 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
gfx::PointF(),
gfx::Size(100, 100),
true,
+ false,
false);
root->SetDrawsContent(true);
@@ -5646,6 +5652,7 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
gfx::PointF(),
gfx::Size(50, 50),
true,
+ false,
false);
child->SetDrawsContent(true);
child->SetOpacity(0.0f);
@@ -5655,6 +5662,7 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
child->layer_animation_controller(), 10.0, 0.0f, 1.0f, false);
root->AddChild(child.Pass());
+ root->SetHasRenderSurface(true);
LayerImplList render_surface_layer_list;
LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
@@ -5894,6 +5902,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
gfx::PointF(),
gfx::Size(50, 50),
true,
+ false,
false);
root->SetDrawsContent(true);
@@ -5904,6 +5913,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
gfx::PointF(),
gfx::Size(40, 40),
true,
+ false,
false);
child->SetDrawsContent(true);
@@ -5915,12 +5925,14 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
gfx::PointF(),
gfx::Size(30, 30),
true,
+ false,
false);
grand_child->SetDrawsContent(true);
grand_child->SetHideLayerAndSubtree(true);
child->AddChild(grand_child.Pass());
root->AddChild(child.Pass());
+ root->SetHasRenderSurface(true);
LayerImplList render_surface_layer_list;
LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
@@ -6007,6 +6019,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
gfx::PointF(),
gfx::Size(50, 50),
true,
+ false,
false);
danakj 2014/09/03 19:30:35 true?
awoloszyn 2014/09/09 15:31:37 Done.
root->SetDrawsContent(true);
@@ -6017,6 +6030,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
gfx::PointF(),
gfx::Size(40, 40),
true,
+ false,
false);
child->SetDrawsContent(true);
child->SetHideLayerAndSubtree(true);
@@ -6029,11 +6043,13 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
gfx::PointF(),
gfx::Size(30, 30),
true,
+ false,
false);
grand_child->SetDrawsContent(true);
child->AddChild(grand_child.Pass());
root->AddChild(child.Pass());
+ root->SetHasRenderSurface(true);
danakj 2014/09/03 19:30:34 not needed if true above?
awoloszyn 2014/09/09 15:31:37 Done.
LayerImplList render_surface_layer_list;
LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
@@ -6886,15 +6902,13 @@ TEST_F(LayerTreeHostCommonTest,
TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
- scoped_ptr<LayerImpl> root =
- LayerImpl::Create(host_impl.active_tree(), 12345);
- scoped_ptr<LayerImpl> child1 =
- LayerImpl::Create(host_impl.active_tree(), 123456);
- scoped_ptr<LayerImpl> child2 =
- LayerImpl::Create(host_impl.active_tree(), 1234567);
- scoped_ptr<LayerImpl> child3 =
- LayerImpl::Create(host_impl.active_tree(), 12345678);
+ scoped_ptr<LayerTreeHost> host =
+ FakeLayerTreeHost::Create().PassAs<LayerTreeHost>();
+ scoped_refptr<Layer> root = Layer::Create();
+ root->SetLayerTreeHost(host.get());
+ scoped_refptr<Layer> child1 = Layer::Create();
+ scoped_refptr<Layer> child2 = Layer::Create();
+ scoped_refptr<Layer> child3 = Layer::Create();
gfx::Transform identity_matrix;
gfx::Point3F transform_origin;
@@ -6907,7 +6921,7 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
bounds,
true,
false);
- root->SetDrawsContent(true);
+ root->SetIsDrawable(true);
// This layer structure normally forces render surface due to preserves3d
// behavior.
@@ -6918,7 +6932,7 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
bounds,
false,
true);
- child1->SetDrawsContent(true);
+ child1->SetIsDrawable(true);
SetLayerPropertiesForTesting(child2.get(),
identity_matrix,
transform_origin,
@@ -6926,7 +6940,7 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
bounds,
true,
false);
- child2->SetDrawsContent(true);
+ child2->SetIsDrawable(true);
SetLayerPropertiesForTesting(child3.get(),
identity_matrix,
transform_origin,
@@ -6934,19 +6948,18 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
bounds,
true,
false);
- child3->SetDrawsContent(true);
+ child3->SetIsDrawable(true);
child2->Set3dSortingContextId(1);
child3->Set3dSortingContextId(1);
- child2->AddChild(child3.Pass());
- child1->AddChild(child2.Pass());
- root->AddChild(child1.Pass());
+ child2->AddChild(child3.get());
+ child1->AddChild(child2.get());
+ root->AddChild(child1.get());
{
- LayerImplList render_surface_layer_list;
- FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root.get());
- LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
+ RenderSurfaceLayerList render_surface_layer_list;
+ LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
root.get(), root->bounds(), &render_surface_layer_list);
inputs.can_render_to_separate_surface = true;
LayerTreeHostCommon::CalculateDrawProperties(&inputs);
@@ -6955,14 +6968,15 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
}
{
- LayerImplList render_surface_layer_list;
- LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
+ RenderSurfaceLayerList render_surface_layer_list;
+ LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
root.get(), root->bounds(), &render_surface_layer_list);
inputs.can_render_to_separate_surface = false;
LayerTreeHostCommon::CalculateDrawProperties(&inputs);
EXPECT_EQ(1u, render_surface_layer_list.size());
}
+ root->SetLayerTreeHost(NULL);
}
TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) {
@@ -7581,13 +7595,15 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
gfx::PointF(),
gfx::Size(50, 50),
true,
- false);
+ false,
+ true);
SetLayerPropertiesForTesting(scroll_parent_border.get(),
identity_transform,
gfx::Point3F(),
gfx::PointF(),
gfx::Size(40, 40),
true,
+ false,
false);
SetLayerPropertiesForTesting(scroll_parent_clip.get(),
identity_transform,
@@ -7595,6 +7611,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
gfx::PointF(),
gfx::Size(30, 30),
true,
+ false,
false);
SetLayerPropertiesForTesting(scroll_parent.get(),
identity_transform,
@@ -7602,6 +7619,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
gfx::PointF(),
gfx::Size(50, 50),
true,
+ true,
danakj 2014/09/03 19:30:35 this is now 3d sorted?
awoloszyn 2014/09/09 15:31:37 That was incorrect, has been fixed.
false);
SetLayerPropertiesForTesting(scroll_child.get(),
identity_transform,
@@ -7609,6 +7627,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
gfx::PointF(),
gfx::Size(50, 50),
true,
+ false,
false);
SetLayerPropertiesForTesting(top_content.get(),
top_transform,
@@ -7616,6 +7635,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
gfx::PointF(),
gfx::Size(50, 50),
false,
+ true,
true);
danakj 2014/09/03 19:30:35 why does top/bottom content need a surface for thi
awoloszyn 2014/09/09 15:31:37 This test checks the sorted order of the created r
danakj 2014/09/25 16:02:11 From what I see it's testing the order of layers i
SetLayerPropertiesForTesting(bottom_content.get(),
bottom_transform,
@@ -7623,6 +7643,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
gfx::PointF(),
gfx::Size(50, 50),
false,
+ true,
true);
scroll_child->SetShouldFlattenTransform(false);
@@ -7699,13 +7720,15 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) {
gfx::PointF(),
gfx::Size(50, 50),
true,
- false);
+ false,
+ true);
SetLayerPropertiesForTesting(container.get(),
container_transform,
gfx::Point3F(),
gfx::PointF(),
gfx::Size(40, 40),
true,
+ false,
false);
SetLayerPropertiesForTesting(scroller.get(),
identity_transform,
@@ -7713,6 +7736,7 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) {
gfx::PointF(),
gfx::Size(30, 30),
true,
+ false,
false);
SetLayerPropertiesForTesting(fixed.get(),
identity_transform,
@@ -7720,6 +7744,7 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) {
gfx::PointF(),
gfx::Size(50, 50),
true,
+ false,
false);
scroller->AddChild(fixed.Pass());
@@ -7863,13 +7888,15 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) {
gfx::PointF(),
gfx::Size(1, 2),
true,
- false);
+ false,
+ true);
SetLayerPropertiesForTesting(parent_raw,
identity_matrix,
gfx::Point3F(),
gfx::PointF(),
gfx::Size(1, 2),
true,
+ false,
false);
SetLayerPropertiesForTesting(child_raw,
identity_matrix,
@@ -7877,13 +7904,16 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) {
gfx::PointF(),
gfx::Size(1, 2),
true,
+ false,
false);
+
SetLayerPropertiesForTesting(grand_child_raw,
identity_matrix,
gfx::Point3F(),
gfx::PointF(),
gfx::Size(1, 2),
true,
+ false,
false);
ExecuteCalculateDrawProperties(grand_parent.get());
@@ -8099,34 +8129,42 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
gfx::PointF(),
gfx::Size(1, 2),
true,
- false);
+ false,
+ true);
SetLayerPropertiesForTesting(parent_raw,
identity_matrix,
gfx::Point3F(),
gfx::PointF(),
gfx::Size(1, 2),
true,
+ false,
false);
+
SetLayerPropertiesForTesting(child_raw,
identity_matrix,
gfx::Point3F(),
gfx::PointF(),
gfx::Size(1, 2),
true,
+ false,
false);
+
SetLayerPropertiesForTesting(grand_child1_raw,
identity_matrix,
gfx::Point3F(),
gfx::PointF(),
gfx::Size(1, 2),
true,
+ false,
false);
+
SetLayerPropertiesForTesting(grand_child2_raw,
identity_matrix,
gfx::Point3F(),
gfx::PointF(),
gfx::Size(1, 2),
true,
+ false,
false);
// Start with nothing being drawn.
@@ -8146,7 +8184,7 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
// If we force render surface, but none of the layers are in the layer list,
// then this layer should not appear in RSLL.
- grand_child1_raw->SetForceRenderSurface(true);
+ grand_child1_raw->SetHasRenderSurface(true);
ExecuteCalculateDrawProperties(grand_parent_raw);
member_id = render_surface_layer_list_count();
@@ -8185,8 +8223,8 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
// Now child is forced to have a render surface, and one if its children draws
// content.
grand_child1_raw->SetDrawsContent(false);
- grand_child1_raw->SetForceRenderSurface(false);
- child_raw->SetForceRenderSurface(true);
+ grand_child1_raw->SetHasRenderSurface(false);
+ child_raw->SetHasRenderSurface(true);
grand_child2_raw->SetDrawsContent(true);
ExecuteCalculateDrawProperties(grand_parent_raw);
@@ -8353,13 +8391,15 @@ TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) {
gfx::PointF(),
gfx::Size(1, 1),
true,
- false);
+ false,
+ true);
SetLayerPropertiesForTesting(child1_layer,
scale_transform_child1,
gfx::Point3F(),
gfx::PointF(),
gfx::Size(),
true,
+ false,
false);
child1_layer->SetMaskLayer(
@@ -8382,6 +8422,7 @@ TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) {
gfx::PointF(),
gfx::Size(),
true,
+ false,
false);
ExecuteCalculateDrawProperties(root_layer);

Powered by Google App Engine
This is Rietveld 408576698