OLD | NEW |
---|---|
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.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 12 matching lines...) Expand all Loading... | |
23 #include "cc/layers/layer_impl.h" | 23 #include "cc/layers/layer_impl.h" |
24 #include "cc/layers/painted_scrollbar_layer.h" | 24 #include "cc/layers/painted_scrollbar_layer.h" |
25 #include "cc/layers/picture_layer.h" | 25 #include "cc/layers/picture_layer.h" |
26 #include "cc/layers/solid_color_layer.h" | 26 #include "cc/layers/solid_color_layer.h" |
27 #include "cc/layers/video_layer.h" | 27 #include "cc/layers/video_layer.h" |
28 #include "cc/output/begin_frame_args.h" | 28 #include "cc/output/begin_frame_args.h" |
29 #include "cc/output/copy_output_request.h" | 29 #include "cc/output/copy_output_request.h" |
30 #include "cc/output/copy_output_result.h" | 30 #include "cc/output/copy_output_result.h" |
31 #include "cc/output/output_surface.h" | 31 #include "cc/output/output_surface.h" |
32 #include "cc/output/swap_promise.h" | 32 #include "cc/output/swap_promise.h" |
33 #include "cc/playback/display_item_list_settings.h" | |
34 #include "cc/quads/draw_quad.h" | 33 #include "cc/quads/draw_quad.h" |
35 #include "cc/quads/render_pass_draw_quad.h" | 34 #include "cc/quads/render_pass_draw_quad.h" |
36 #include "cc/quads/tile_draw_quad.h" | 35 #include "cc/quads/tile_draw_quad.h" |
37 #include "cc/resources/ui_resource_manager.h" | 36 #include "cc/resources/ui_resource_manager.h" |
38 #include "cc/test/fake_content_layer_client.h" | 37 #include "cc/test/fake_content_layer_client.h" |
39 #include "cc/test/fake_layer_tree_host_client.h" | 38 #include "cc/test/fake_layer_tree_host_client.h" |
40 #include "cc/test/fake_output_surface.h" | 39 #include "cc/test/fake_output_surface.h" |
41 #include "cc/test/fake_painted_scrollbar_layer.h" | 40 #include "cc/test/fake_painted_scrollbar_layer.h" |
42 #include "cc/test/fake_picture_layer.h" | 41 #include "cc/test/fake_picture_layer.h" |
43 #include "cc/test/fake_picture_layer_impl.h" | 42 #include "cc/test/fake_picture_layer_impl.h" |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
911 scoped_refptr<Layer> child_; | 910 scoped_refptr<Layer> child_; |
912 }; | 911 }; |
913 | 912 |
914 // This test compares the value of tree indexes from Layers on the engine to the | 913 // This test compares the value of tree indexes from Layers on the engine to the |
915 // resulting PropertyTrees copied to the pending tree after the commit on the | 914 // resulting PropertyTrees copied to the pending tree after the commit on the |
916 // client. This will result in a failure for LTH remote test since while the | 915 // client. This will result in a failure for LTH remote test since while the |
917 // client side Layers would have the correct values for these indexes, but the | 916 // client side Layers would have the correct values for these indexes, but the |
918 // engine will never build PropertyTrees in LTH remote. See crbug.com/655795. | 917 // engine will never build PropertyTrees in LTH remote. See crbug.com/655795. |
919 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushNodeOwnerToNodeIdMap); | 918 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushNodeOwnerToNodeIdMap); |
920 | 919 |
920 class LayerTreeHostTestPushElementIdToNodeIdMap : public LayerTreeHostTest { | |
921 protected: | |
922 void SetupTree() override { | |
923 root_ = Layer::Create(); | |
924 child_ = Layer::Create(); | |
925 child_->SetElementId(kTestElementId); | |
926 root_->AddChild(child_); | |
927 layer_tree()->SetRootLayer(root_); | |
928 LayerTreeHostTest::SetupTree(); | |
929 } | |
930 | |
931 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | |
932 | |
933 void DidCommit() override { | |
934 switch (layer_tree_host()->SourceFrameNumber()) { | |
935 case 1: | |
936 child_->SetForceRenderSurfaceForTesting(true); | |
937 break; | |
938 case 2: | |
939 child_->SetForceRenderSurfaceForTesting(false); | |
940 break; | |
941 } | |
942 } | |
943 | |
944 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | |
945 PropertyTrees* property_trees = impl->sync_tree()->property_trees(); | |
946 auto root_element_id_to_transform_node_index = | |
ajuma
2017/01/10 00:02:36
int child_transform_node_index
wkorman
2017/01/10 00:13:09
Moved inline to the one case statement where it's
| |
947 property_trees->element_id_to_transform_node_index[kTestElementId]; | |
948 auto root_element_id_to_effect_node_index = | |
ajuma
2017/01/10 00:02:36
int child_effect_node_index
wkorman
2017/01/10 00:13:09
Moved inline to the one case statement where it's
| |
949 property_trees->element_id_to_effect_node_index[kTestElementId]; | |
950 | |
951 LayerImpl* child_impl_ = impl->active_tree()->LayerById(child_->id()); | |
952 switch (impl->sync_tree()->source_frame_number()) { | |
953 case 0: | |
954 EXPECT_EQ(2U, child_impl_->layer_tree_impl() | |
955 ->property_trees() | |
956 ->transform_tree.size()); | |
957 EXPECT_EQ(2U, child_impl_->layer_tree_impl() | |
958 ->property_trees() | |
959 ->effect_tree.size()); | |
960 EXPECT_EQ(0, root_element_id_to_transform_node_index); | |
961 EXPECT_EQ(0, root_element_id_to_effect_node_index); | |
ajuma
2017/01/10 00:02:36
These 0s are because kTestElementId isn't present
wkorman
2017/01/10 00:13:09
Good point, revised here and below to find() == en
| |
962 break; | |
963 case 1: | |
964 EXPECT_EQ(3U, child_impl_->layer_tree_impl() | |
wkorman
2017/01/09 21:41:55
We don't currently set the element id on the trans
| |
965 ->property_trees() | |
966 ->transform_tree.size()); | |
967 EXPECT_EQ(3U, child_impl_->layer_tree_impl() | |
968 ->property_trees() | |
969 ->effect_tree.size()); | |
970 EXPECT_EQ(2, root_element_id_to_transform_node_index); | |
971 EXPECT_EQ(2, root_element_id_to_effect_node_index); | |
972 break; | |
973 case 2: | |
974 EXPECT_EQ(2U, child_impl_->layer_tree_impl() | |
975 ->property_trees() | |
976 ->transform_tree.size()); | |
977 EXPECT_EQ(2U, child_impl_->layer_tree_impl() | |
978 ->property_trees() | |
979 ->effect_tree.size()); | |
980 EXPECT_EQ(0, root_element_id_to_transform_node_index); | |
981 EXPECT_EQ(0, root_element_id_to_effect_node_index); | |
ajuma
2017/01/10 00:02:36
Same comment about checking that kTestElementId is
wkorman
2017/01/10 00:13:09
Done.
| |
982 break; | |
983 } | |
984 EndTest(); | |
985 } | |
986 | |
987 void AfterTest() override {} | |
988 | |
989 private: | |
990 const ElementId kTestElementId = ElementId(42, 8118); | |
991 | |
992 scoped_refptr<Layer> root_; | |
993 scoped_refptr<Layer> child_; | |
994 }; | |
995 | |
996 // Validates that, for a layer with a compositor element id set on it, mappings | |
997 // from compositor element id to transform/effect node indexes are created as | |
998 // part of building a layer's property tree and are present on the impl thread. | |
999 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushElementIdToNodeIdMap); | |
1000 | |
921 class LayerTreeHostTestSurfaceDamage : public LayerTreeHostTest { | 1001 class LayerTreeHostTestSurfaceDamage : public LayerTreeHostTest { |
922 protected: | 1002 protected: |
923 void SetupTree() override { | 1003 void SetupTree() override { |
924 root_ = Layer::Create(); | 1004 root_ = Layer::Create(); |
925 child_ = Layer::Create(); | 1005 child_ = Layer::Create(); |
926 grand_child_ = Layer::Create(); | 1006 grand_child_ = Layer::Create(); |
927 | 1007 |
928 layer_tree()->SetRootLayer(root_); | 1008 layer_tree()->SetRootLayer(root_); |
929 root_->AddChild(child_); | 1009 root_->AddChild(child_); |
930 child_->AddChild(grand_child_); | 1010 child_->AddChild(grand_child_); |
(...skipping 6143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7074 EndTest(); | 7154 EndTest(); |
7075 } | 7155 } |
7076 | 7156 |
7077 void AfterTest() override {} | 7157 void AfterTest() override {} |
7078 }; | 7158 }; |
7079 | 7159 |
7080 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); | 7160 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); |
7081 | 7161 |
7082 } // namespace | 7162 } // namespace |
7083 } // namespace cc | 7163 } // namespace cc |
OLD | NEW |