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 LayerImpl* child_impl_ = impl->sync_tree()->LayerById(child_->id()); |
| 947 switch (impl->sync_tree()->source_frame_number()) { |
| 948 case 0: |
| 949 EXPECT_EQ(2U, child_impl_->layer_tree_impl() |
| 950 ->property_trees() |
| 951 ->transform_tree.size()); |
| 952 EXPECT_EQ(2U, child_impl_->layer_tree_impl() |
| 953 ->property_trees() |
| 954 ->effect_tree.size()); |
| 955 EXPECT_TRUE(property_trees->element_id_to_transform_node_index.find( |
| 956 kTestElementId) == |
| 957 property_trees->element_id_to_transform_node_index.end()); |
| 958 EXPECT_TRUE(property_trees->element_id_to_effect_node_index.find( |
| 959 kTestElementId) == |
| 960 property_trees->element_id_to_effect_node_index.end()); |
| 961 break; |
| 962 case 1: |
| 963 EXPECT_EQ(3U, child_impl_->layer_tree_impl() |
| 964 ->property_trees() |
| 965 ->transform_tree.size()); |
| 966 EXPECT_EQ(3U, child_impl_->layer_tree_impl() |
| 967 ->property_trees() |
| 968 ->effect_tree.size()); |
| 969 EXPECT_EQ( |
| 970 2, |
| 971 property_trees->element_id_to_transform_node_index[kTestElementId]); |
| 972 EXPECT_EQ( |
| 973 2, property_trees->element_id_to_effect_node_index[kTestElementId]); |
| 974 break; |
| 975 case 2: |
| 976 EXPECT_EQ(2U, child_impl_->layer_tree_impl() |
| 977 ->property_trees() |
| 978 ->transform_tree.size()); |
| 979 EXPECT_EQ(2U, child_impl_->layer_tree_impl() |
| 980 ->property_trees() |
| 981 ->effect_tree.size()); |
| 982 EXPECT_TRUE(property_trees->element_id_to_transform_node_index.find( |
| 983 kTestElementId) == |
| 984 property_trees->element_id_to_transform_node_index.end()); |
| 985 EXPECT_TRUE(property_trees->element_id_to_effect_node_index.find( |
| 986 kTestElementId) == |
| 987 property_trees->element_id_to_effect_node_index.end()); |
| 988 break; |
| 989 } |
| 990 EndTest(); |
| 991 } |
| 992 |
| 993 void AfterTest() override {} |
| 994 |
| 995 private: |
| 996 const ElementId kTestElementId = ElementId(42, 8118); |
| 997 |
| 998 scoped_refptr<Layer> root_; |
| 999 scoped_refptr<Layer> child_; |
| 1000 }; |
| 1001 |
| 1002 // Validates that, for a layer with a compositor element id set on it, mappings |
| 1003 // from compositor element id to transform/effect node indexes are created as |
| 1004 // part of building a layer's property tree and are present on the impl thread. |
| 1005 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushElementIdToNodeIdMap); |
| 1006 |
921 class LayerTreeHostTestSurfaceDamage : public LayerTreeHostTest { | 1007 class LayerTreeHostTestSurfaceDamage : public LayerTreeHostTest { |
922 protected: | 1008 protected: |
923 void SetupTree() override { | 1009 void SetupTree() override { |
924 root_ = Layer::Create(); | 1010 root_ = Layer::Create(); |
925 child_ = Layer::Create(); | 1011 child_ = Layer::Create(); |
926 grand_child_ = Layer::Create(); | 1012 grand_child_ = Layer::Create(); |
927 | 1013 |
928 layer_tree()->SetRootLayer(root_); | 1014 layer_tree()->SetRootLayer(root_); |
929 root_->AddChild(child_); | 1015 root_->AddChild(child_); |
930 child_->AddChild(grand_child_); | 1016 child_->AddChild(grand_child_); |
(...skipping 6143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7074 EndTest(); | 7160 EndTest(); |
7075 } | 7161 } |
7076 | 7162 |
7077 void AfterTest() override {} | 7163 void AfterTest() override {} |
7078 }; | 7164 }; |
7079 | 7165 |
7080 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); | 7166 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); |
7081 | 7167 |
7082 } // namespace | 7168 } // namespace |
7083 } // namespace cc | 7169 } // namespace cc |
OLD | NEW |