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

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: Updated unit tests 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 66b63a560d2df974979e640861b4ed9e85e1f82c..f1df8582610d4bbe343a59d28355c03334563a24 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -346,6 +346,7 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
true,
false);
root->AddChild(clip_layer_scoped_ptr.Pass());
+ root->CreateRenderSurface();
ExecuteCalculateDrawProperties(
root.get(), kDeviceScale, kPageScale, scroll_layer->parent());
@@ -5655,6 +5656,7 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
child->layer_animation_controller(), 10.0, 0.0f, 1.0f, false);
root->AddChild(child.Pass());
+ root->CreateRenderSurface();
LayerImplList render_surface_layer_list;
LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
@@ -5921,6 +5923,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
child->AddChild(grand_child.Pass());
root->AddChild(child.Pass());
+ root->CreateRenderSurface();
LayerImplList render_surface_layer_list;
LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
@@ -6034,6 +6037,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
child->AddChild(grand_child.Pass());
root->AddChild(child.Pass());
+ root->CreateRenderSurface();
LayerImplList render_surface_layer_list;
LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
@@ -6886,15 +6890,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 +6909,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 +6920,7 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
bounds,
false,
true);
- child1->SetDrawsContent(true);
+ child1->SetIsDrawable(true);
SetLayerPropertiesForTesting(child2.get(),
identity_matrix,
transform_origin,
@@ -6926,7 +6928,7 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
bounds,
true,
false);
- child2->SetDrawsContent(true);
+ child2->SetIsDrawable(true);
SetLayerPropertiesForTesting(child3.get(),
identity_matrix,
transform_origin,
@@ -6934,19 +6936,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 +6956,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 +7583,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,
@@ -7602,7 +7606,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
gfx::PointF(),
gfx::Size(50, 50),
true,
- false);
+ true);
SetLayerPropertiesForTesting(scroll_child.get(),
identity_transform,
gfx::Point3F(),
@@ -7616,6 +7620,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
gfx::PointF(),
gfx::Size(50, 50),
false,
+ true,
true);
SetLayerPropertiesForTesting(bottom_content.get(),
bottom_transform,
@@ -7623,6 +7628,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
gfx::PointF(),
gfx::Size(50, 50),
false,
+ true,
true);
scroll_child->SetShouldFlattenTransform(false);
@@ -7699,7 +7705,8 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) {
gfx::PointF(),
gfx::Size(50, 50),
true,
- false);
+ false,
+ true);
SetLayerPropertiesForTesting(container.get(),
container_transform,
gfx::Point3F(),
@@ -7863,7 +7870,8 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) {
gfx::PointF(),
gfx::Size(1, 2),
true,
- false);
+ false,
+ true);
SetLayerPropertiesForTesting(parent_raw,
identity_matrix,
gfx::Point3F(),
@@ -8099,7 +8107,8 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
gfx::PointF(),
gfx::Size(1, 2),
true,
- false);
+ false,
+ true);
SetLayerPropertiesForTesting(parent_raw,
identity_matrix,
gfx::Point3F(),
@@ -8146,7 +8155,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->CreateRenderSurface();
ExecuteCalculateDrawProperties(grand_parent_raw);
member_id = render_surface_layer_list_count();
@@ -8185,8 +8194,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->ClearRenderSurface();
+ child_raw->CreateRenderSurface();
grand_child2_raw->SetDrawsContent(true);
ExecuteCalculateDrawProperties(grand_parent_raw);
@@ -8353,7 +8362,8 @@ TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) {
gfx::PointF(),
gfx::Size(1, 1),
true,
- false);
+ false,
+ true);
SetLayerPropertiesForTesting(child1_layer,
scale_transform_child1,
gfx::Point3F(),

Powered by Google App Engine
This is Rietveld 408576698