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

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 2017263002: cc: Move copy requests from layers to the effect tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo in comment Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 5514 matching lines...) Expand 10 before | Expand all | Expand 10 after
5525 // Hide the copy_grand_parent and its subtree. But make a copy request in that 5525 // Hide the copy_grand_parent and its subtree. But make a copy request in that
5526 // hidden subtree on copy_layer. Also hide the copy grand child and its 5526 // hidden subtree on copy_layer. Also hide the copy grand child and its
5527 // subtree. 5527 // subtree.
5528 copy_grand_parent_layer->test_properties()->hide_layer_and_subtree = true; 5528 copy_grand_parent_layer->test_properties()->hide_layer_and_subtree = true;
5529 copy_grand_parent_sibling_before_layer->test_properties() 5529 copy_grand_parent_sibling_before_layer->test_properties()
5530 ->hide_layer_and_subtree = true; 5530 ->hide_layer_and_subtree = true;
5531 copy_grand_parent_sibling_after_layer->test_properties() 5531 copy_grand_parent_sibling_after_layer->test_properties()
5532 ->hide_layer_and_subtree = true; 5532 ->hide_layer_and_subtree = true;
5533 copy_grand_child_layer->test_properties()->hide_layer_and_subtree = true; 5533 copy_grand_child_layer->test_properties()->hide_layer_and_subtree = true;
5534 5534
5535 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; 5535 copy_layer->test_properties()->copy_requests.push_back(
5536 copy_requests.push_back(
5537 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); 5536 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback)));
5538 copy_layer->PassCopyRequests(&copy_requests);
5539 EXPECT_TRUE(copy_layer->HasCopyRequest());
5540 5537
5541 LayerImplList render_surface_layer_list; 5538 LayerImplList render_surface_layer_list;
5542 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 5539 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
5543 root_layer, root_layer->bounds(), &render_surface_layer_list); 5540 root_layer, root_layer->bounds(), &render_surface_layer_list);
5544 inputs.can_adjust_raster_scales = true; 5541 inputs.can_adjust_raster_scales = true;
5545 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); 5542 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
5546 5543
5547 EXPECT_GT(root_layer->num_copy_requests_in_target_subtree(), 0); 5544 EXPECT_GT(root_layer->num_copy_requests_in_target_subtree(), 0);
5548 EXPECT_GT(copy_grand_parent_layer->num_copy_requests_in_target_subtree(), 0); 5545 EXPECT_GT(copy_grand_parent_layer->num_copy_requests_in_target_subtree(), 0);
5549 EXPECT_GT(copy_parent_layer->num_copy_requests_in_target_subtree(), 0); 5546 EXPECT_GT(copy_parent_layer->num_copy_requests_in_target_subtree(), 0);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
5632 true, false, true); 5629 true, false, true);
5633 copy_layer->SetDrawsContent(true); 5630 copy_layer->SetDrawsContent(true);
5634 5631
5635 std::unique_ptr<LayerImpl> copy_child = 5632 std::unique_ptr<LayerImpl> copy_child =
5636 LayerImpl::Create(host_impl.pending_tree(), 4); 5633 LayerImpl::Create(host_impl.pending_tree(), 4);
5637 SetLayerPropertiesForTesting(copy_child.get(), identity_matrix, 5634 SetLayerPropertiesForTesting(copy_child.get(), identity_matrix,
5638 gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20), 5635 gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20),
5639 true, false, false); 5636 true, false, false);
5640 copy_child->SetDrawsContent(true); 5637 copy_child->SetDrawsContent(true);
5641 5638
5642 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; 5639 copy_layer->test_properties()->copy_requests.push_back(
5643 copy_requests.push_back(
5644 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); 5640 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback)));
5645 copy_layer->PassCopyRequests(&copy_requests);
5646 EXPECT_TRUE(copy_layer->HasCopyRequest());
5647 5641
5648 copy_layer->AddChild(std::move(copy_child)); 5642 copy_layer->AddChild(std::move(copy_child));
5649 copy_parent->AddChild(std::move(copy_layer)); 5643 copy_parent->AddChild(std::move(copy_layer));
5650 root->AddChild(std::move(copy_parent)); 5644 root->AddChild(std::move(copy_parent));
5651 5645
5652 LayerImplList render_surface_layer_list; 5646 LayerImplList render_surface_layer_list;
5653 LayerImpl* root_layer = root.get(); 5647 LayerImpl* root_layer = root.get();
5654 root_layer->layer_tree_impl()->SetRootLayer(std::move(root)); 5648 root_layer->layer_tree_impl()->SetRootLayer(std::move(root));
5655 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 5649 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
5656 root_layer, root_layer->bounds(), &render_surface_layer_list); 5650 root_layer, root_layer->bounds(), &render_surface_layer_list);
(...skipping 3079 matching lines...) Expand 10 before | Expand all | Expand 10 after
8736 child_ptr->SetOpacity(0.7f); 8730 child_ptr->SetOpacity(0.7f);
8737 host_impl.active_tree()->property_trees()->needs_rebuild = true; 8731 host_impl.active_tree()->property_trees()->needs_rebuild = true;
8738 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8732 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8739 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); 8733 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect());
8740 root_ptr->SetOpacity(1.f); 8734 root_ptr->SetOpacity(1.f);
8741 8735
8742 child_ptr->SetOpacity(0.f); 8736 child_ptr->SetOpacity(0.f);
8743 // Now, even though child has zero opacity, we will configure |grandchild| and 8737 // Now, even though child has zero opacity, we will configure |grandchild| and
8744 // |greatgrandchild| in several ways that should force the subtree to be 8738 // |greatgrandchild| in several ways that should force the subtree to be
8745 // processed anyhow. 8739 // processed anyhow.
8746 std::vector<std::unique_ptr<CopyOutputRequest>> requests; 8740 grandchild_ptr->test_properties()->copy_requests.push_back(
8747 requests.push_back(CopyOutputRequest::CreateEmptyRequest()); 8741 CopyOutputRequest::CreateEmptyRequest());
8748
8749 grandchild_ptr->PassCopyRequests(&requests);
8750 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; 8742 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true;
8751 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8743 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8752 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); 8744 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect());
8753 requests.clear(); 8745
8754 grandchild_ptr->PassCopyRequests(&requests); 8746 host_impl.active_tree()->property_trees()->effect_tree.ClearCopyRequests();
8755 child_ptr->SetOpacity(1.f); 8747 child_ptr->SetOpacity(1.f);
8756 8748
8757 // A double sided render surface with backface visible should not be skipped 8749 // A double sided render surface with backface visible should not be skipped
8758 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); 8750 grandchild_ptr->set_visible_layer_rect(gfx::Rect());
8759 child_ptr->SetHasRenderSurface(true); 8751 child_ptr->SetHasRenderSurface(true);
8760 child_ptr->test_properties()->double_sided = true; 8752 child_ptr->test_properties()->double_sided = true;
8761 child_ptr->SetTransform(rotate_back_and_translate); 8753 child_ptr->SetTransform(rotate_back_and_translate);
8762 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; 8754 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true;
8763 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8755 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8764 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); 8756 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect());
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
10100 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10092 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10101 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10093 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10102 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10094 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10103 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10095 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10104 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10096 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10105 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10097 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10106 } 10098 }
10107 10099
10108 } // namespace 10100 } // namespace
10109 } // namespace cc 10101 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698