| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "cc/test/fake_scoped_ui_resource.h" | 46 #include "cc/test/fake_scoped_ui_resource.h" |
| 47 #include "cc/test/fake_video_frame_provider.h" | 47 #include "cc/test/fake_video_frame_provider.h" |
| 48 #include "cc/test/geometry_test_utils.h" | 48 #include "cc/test/geometry_test_utils.h" |
| 49 #include "cc/test/layer_tree_test.h" | 49 #include "cc/test/layer_tree_test.h" |
| 50 #include "cc/test/push_properties_counting_layer.h" | 50 #include "cc/test/push_properties_counting_layer.h" |
| 51 #include "cc/test/push_properties_counting_layer_impl.h" | 51 #include "cc/test/push_properties_counting_layer_impl.h" |
| 52 #include "cc/test/render_pass_test_utils.h" | 52 #include "cc/test/render_pass_test_utils.h" |
| 53 #include "cc/test/skia_common.h" | 53 #include "cc/test/skia_common.h" |
| 54 #include "cc/test/test_compositor_frame_sink.h" | 54 #include "cc/test/test_compositor_frame_sink.h" |
| 55 #include "cc/test/test_web_graphics_context_3d.h" | 55 #include "cc/test/test_web_graphics_context_3d.h" |
| 56 #include "cc/trees/clip_node.h" |
| 56 #include "cc/trees/effect_node.h" | 57 #include "cc/trees/effect_node.h" |
| 57 #include "cc/trees/layer_tree_host_common.h" | 58 #include "cc/trees/layer_tree_host_common.h" |
| 58 #include "cc/trees/layer_tree_host_impl.h" | 59 #include "cc/trees/layer_tree_host_impl.h" |
| 59 #include "cc/trees/layer_tree_impl.h" | 60 #include "cc/trees/layer_tree_impl.h" |
| 60 #include "cc/trees/scroll_node.h" | 61 #include "cc/trees/scroll_node.h" |
| 61 #include "cc/trees/single_thread_proxy.h" | 62 #include "cc/trees/single_thread_proxy.h" |
| 62 #include "cc/trees/swap_promise_manager.h" | 63 #include "cc/trees/swap_promise_manager.h" |
| 63 #include "cc/trees/transform_node.h" | 64 #include "cc/trees/transform_node.h" |
| 64 #include "gpu/GLES2/gl2extchromium.h" | 65 #include "gpu/GLES2/gl2extchromium.h" |
| 65 #include "testing/gmock/include/gmock/gmock.h" | 66 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 break; | 813 break; |
| 813 case 3: | 814 case 3: |
| 814 // child_ should not create any property tree node. | 815 // child_ should not create any property tree node. |
| 815 child_->SetForceRenderSurfaceForTesting(false); | 816 child_->SetForceRenderSurfaceForTesting(false); |
| 816 child_->SetScrollClipLayerId(Layer::INVALID_ID); | 817 child_->SetScrollClipLayerId(Layer::INVALID_ID); |
| 817 } | 818 } |
| 818 } | 819 } |
| 819 | 820 |
| 820 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 821 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
| 821 PropertyTrees* property_trees = impl->sync_tree()->property_trees(); | 822 PropertyTrees* property_trees = impl->sync_tree()->property_trees(); |
| 822 auto root_transform_id_to_index = | 823 auto* root_transform_node = |
| 823 property_trees->layer_id_to_transform_node_index.find(root_->id()); | 824 property_trees->transform_tree.FindNodeFromId(root_->id()); |
| 824 auto child_transform_id_to_index = | 825 auto* child_transform_node = |
| 825 property_trees->layer_id_to_transform_node_index.find(child_->id()); | 826 property_trees->transform_tree.FindNodeFromId(child_->id()); |
| 826 auto root_effect_id_to_index = | 827 auto* root_effect_node = |
| 827 property_trees->layer_id_to_effect_node_index.find(root_->id()); | 828 property_trees->effect_tree.FindNodeFromId(root_->id()); |
| 828 auto child_effect_id_to_index = | 829 auto* child_effect_node = |
| 829 property_trees->layer_id_to_effect_node_index.find(child_->id()); | 830 property_trees->effect_tree.FindNodeFromId(child_->id()); |
| 830 auto root_clip_id_to_index = | 831 auto* root_clip_node = |
| 831 property_trees->layer_id_to_clip_node_index.find(root_->id()); | 832 property_trees->clip_tree.FindNodeFromId(root_->id()); |
| 832 auto child_clip_id_to_index = | 833 auto* child_clip_node = |
| 833 property_trees->layer_id_to_clip_node_index.find(child_->id()); | 834 property_trees->clip_tree.FindNodeFromId(child_->id()); |
| 834 auto root_scroll_id_to_index = | 835 auto* root_scroll_node = |
| 835 property_trees->layer_id_to_scroll_node_index.find(root_->id()); | 836 property_trees->scroll_tree.FindNodeFromId(root_->id()); |
| 836 auto child_scroll_id_to_index = | 837 auto* child_scroll_node = |
| 837 property_trees->layer_id_to_scroll_node_index.find(child_->id()); | 838 property_trees->scroll_tree.FindNodeFromId(child_->id()); |
| 838 switch (impl->sync_tree()->source_frame_number()) { | 839 switch (impl->sync_tree()->source_frame_number()) { |
| 839 case 0: | 840 case 0: |
| 840 // root_ should create every property tree node and child_ should not | 841 // root_ should create every property tree node and child_ should not |
| 841 // create any. | 842 // create any. |
| 842 EXPECT_NE(root_transform_id_to_index, | 843 EXPECT_NE(root_transform_node, nullptr); |
| 843 property_trees->layer_id_to_transform_node_index.end()); | 844 EXPECT_EQ(root_transform_node->id, root_->transform_tree_index()); |
| 844 EXPECT_EQ(root_transform_id_to_index->second, | 845 EXPECT_NE(root_effect_node, nullptr); |
| 845 root_->transform_tree_index()); | 846 EXPECT_EQ(root_effect_node->id, root_->effect_tree_index()); |
| 846 EXPECT_NE(root_effect_id_to_index, | 847 EXPECT_NE(root_clip_node, nullptr); |
| 847 property_trees->layer_id_to_effect_node_index.end()); | 848 EXPECT_EQ(root_clip_node->id, root_->clip_tree_index()); |
| 848 EXPECT_EQ(root_effect_id_to_index->second, root_->effect_tree_index()); | 849 EXPECT_NE(root_scroll_node, nullptr); |
| 849 EXPECT_NE(root_clip_id_to_index, | 850 EXPECT_EQ(root_scroll_node->id, root_->scroll_tree_index()); |
| 850 property_trees->layer_id_to_clip_node_index.end()); | 851 EXPECT_EQ(child_transform_node, nullptr); |
| 851 EXPECT_EQ(root_clip_id_to_index->second, root_->clip_tree_index()); | 852 EXPECT_EQ(child_effect_node, nullptr); |
| 852 EXPECT_NE(root_scroll_id_to_index, | 853 EXPECT_EQ(child_clip_node, nullptr); |
| 853 property_trees->layer_id_to_scroll_node_index.end()); | 854 EXPECT_EQ(child_scroll_node, nullptr); |
| 854 EXPECT_EQ(root_scroll_id_to_index->second, root_->scroll_tree_index()); | |
| 855 EXPECT_EQ(child_transform_id_to_index, | |
| 856 property_trees->layer_id_to_transform_node_index.end()); | |
| 857 EXPECT_EQ(child_effect_id_to_index, | |
| 858 property_trees->layer_id_to_effect_node_index.end()); | |
| 859 EXPECT_EQ(child_clip_id_to_index, | |
| 860 property_trees->layer_id_to_clip_node_index.end()); | |
| 861 EXPECT_EQ(child_scroll_id_to_index, | |
| 862 property_trees->layer_id_to_scroll_node_index.end()); | |
| 863 break; | 855 break; |
| 864 case 1: | 856 case 1: |
| 865 // child_ should create a transfrom, clip, effect nodes but not a scroll | 857 // child_ should create a transfrom, clip, effect nodes but not a scroll |
| 866 // node. | 858 // node. |
| 867 EXPECT_NE( | 859 EXPECT_NE(child_transform_node, nullptr); |
| 868 property_trees->layer_id_to_transform_node_index.find(child_->id()), | 860 EXPECT_EQ(child_transform_node->id, child_->transform_tree_index()); |
| 869 property_trees->layer_id_to_transform_node_index.end()); | 861 EXPECT_NE(child_effect_node, nullptr); |
| 870 EXPECT_EQ(child_transform_id_to_index->second, | 862 EXPECT_EQ(child_effect_node->id, child_->effect_tree_index()); |
| 871 child_->transform_tree_index()); | 863 EXPECT_NE(child_clip_node, nullptr); |
| 872 EXPECT_NE( | 864 EXPECT_EQ(child_clip_node->id, child_->clip_tree_index()); |
| 873 property_trees->layer_id_to_effect_node_index.find(child_->id()), | 865 EXPECT_EQ(child_scroll_node, nullptr); |
| 874 property_trees->layer_id_to_effect_node_index.end()); | |
| 875 EXPECT_EQ(child_effect_id_to_index->second, | |
| 876 child_->effect_tree_index()); | |
| 877 EXPECT_NE( | |
| 878 property_trees->layer_id_to_clip_node_index.find(child_->id()), | |
| 879 property_trees->layer_id_to_clip_node_index.end()); | |
| 880 EXPECT_EQ(child_clip_id_to_index->second, child_->clip_tree_index()); | |
| 881 EXPECT_EQ( | |
| 882 property_trees->layer_id_to_scroll_node_index.find(child_->id()), | |
| 883 property_trees->layer_id_to_scroll_node_index.end()); | |
| 884 break; | 866 break; |
| 885 case 2: | 867 case 2: |
| 886 // child_ should create a scroll node. | 868 // child_ should create a scroll node. |
| 887 EXPECT_NE( | 869 EXPECT_NE(child_scroll_node, nullptr); |
| 888 property_trees->layer_id_to_scroll_node_index.find(child_->id()), | 870 EXPECT_EQ(child_scroll_node->id, child_->scroll_tree_index()); |
| 889 property_trees->layer_id_to_scroll_node_index.end()); | |
| 890 EXPECT_EQ(child_scroll_id_to_index->second, | |
| 891 child_->scroll_tree_index()); | |
| 892 break; | 871 break; |
| 893 case 3: | 872 case 3: |
| 894 // child_ should not create any property tree nodes. | 873 // child_ should not create any property tree nodes. |
| 895 EXPECT_EQ( | 874 EXPECT_EQ(child_transform_node, nullptr); |
| 896 property_trees->layer_id_to_transform_node_index.find(child_->id()), | 875 EXPECT_EQ(child_effect_node, nullptr); |
| 897 property_trees->layer_id_to_transform_node_index.end()); | 876 EXPECT_EQ(child_clip_node, nullptr); |
| 898 EXPECT_EQ( | 877 EXPECT_EQ(child_scroll_node, nullptr); |
| 899 property_trees->layer_id_to_effect_node_index.find(child_->id()), | |
| 900 property_trees->layer_id_to_effect_node_index.end()); | |
| 901 EXPECT_EQ( | |
| 902 property_trees->layer_id_to_clip_node_index.find(child_->id()), | |
| 903 property_trees->layer_id_to_clip_node_index.end()); | |
| 904 EXPECT_EQ( | |
| 905 property_trees->layer_id_to_scroll_node_index.find(child_->id()), | |
| 906 property_trees->layer_id_to_scroll_node_index.end()); | |
| 907 | |
| 908 EndTest(); | 878 EndTest(); |
| 909 break; | 879 break; |
| 910 } | 880 } |
| 911 } | 881 } |
| 912 | 882 |
| 913 void AfterTest() override {} | 883 void AfterTest() override {} |
| 914 | 884 |
| 915 private: | 885 private: |
| 916 scoped_refptr<Layer> root_; | 886 scoped_refptr<Layer> root_; |
| 917 scoped_refptr<Layer> child_; | 887 scoped_refptr<Layer> child_; |
| (...skipping 6258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7176 | 7146 |
| 7177 private: | 7147 private: |
| 7178 bool first_ = true; | 7148 bool first_ = true; |
| 7179 SkBitmap bitmap_; | 7149 SkBitmap bitmap_; |
| 7180 }; | 7150 }; |
| 7181 | 7151 |
| 7182 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestQueueImageDecodeNonLazy); | 7152 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestQueueImageDecodeNonLazy); |
| 7183 | 7153 |
| 7184 } // namespace | 7154 } // namespace |
| 7185 } // namespace cc | 7155 } // namespace cc |
| OLD | NEW |