| 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 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 case 3: | 815 case 3: |
| 816 // child_ should not create any property tree node. | 816 // child_ should not create any property tree node. |
| 817 child_->SetForceRenderSurfaceForTesting(false); | 817 child_->SetForceRenderSurfaceForTesting(false); |
| 818 child_->SetScrollClipLayerId(Layer::INVALID_ID); | 818 child_->SetScrollClipLayerId(Layer::INVALID_ID); |
| 819 } | 819 } |
| 820 } | 820 } |
| 821 | 821 |
| 822 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 822 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
| 823 PropertyTrees* property_trees = impl->sync_tree()->property_trees(); | 823 PropertyTrees* property_trees = impl->sync_tree()->property_trees(); |
| 824 auto root_transform_id_to_index = | 824 auto root_transform_id_to_index = |
| 825 property_trees->transform_id_to_index_map.find(root_->id()); | 825 property_trees->layer_id_to_transform_node_index.find(root_->id()); |
| 826 auto child_transform_id_to_index = | 826 auto child_transform_id_to_index = |
| 827 property_trees->transform_id_to_index_map.find(child_->id()); | 827 property_trees->layer_id_to_transform_node_index.find(child_->id()); |
| 828 auto root_effect_id_to_index = | 828 auto root_effect_id_to_index = |
| 829 property_trees->effect_id_to_index_map.find(root_->id()); | 829 property_trees->layer_id_to_effect_node_index.find(root_->id()); |
| 830 auto child_effect_id_to_index = | 830 auto child_effect_id_to_index = |
| 831 property_trees->effect_id_to_index_map.find(child_->id()); | 831 property_trees->layer_id_to_effect_node_index.find(child_->id()); |
| 832 auto root_clip_id_to_index = | 832 auto root_clip_id_to_index = |
| 833 property_trees->clip_id_to_index_map.find(root_->id()); | 833 property_trees->layer_id_to_clip_node_index.find(root_->id()); |
| 834 auto child_clip_id_to_index = | 834 auto child_clip_id_to_index = |
| 835 property_trees->clip_id_to_index_map.find(child_->id()); | 835 property_trees->layer_id_to_clip_node_index.find(child_->id()); |
| 836 auto root_scroll_id_to_index = | 836 auto root_scroll_id_to_index = |
| 837 property_trees->scroll_id_to_index_map.find(root_->id()); | 837 property_trees->layer_id_to_scroll_node_index.find(root_->id()); |
| 838 auto child_scroll_id_to_index = | 838 auto child_scroll_id_to_index = |
| 839 property_trees->scroll_id_to_index_map.find(child_->id()); | 839 property_trees->layer_id_to_scroll_node_index.find(child_->id()); |
| 840 switch (impl->sync_tree()->source_frame_number()) { | 840 switch (impl->sync_tree()->source_frame_number()) { |
| 841 case 0: | 841 case 0: |
| 842 // root_ should create every property tree node and child_ should not | 842 // root_ should create every property tree node and child_ should not |
| 843 // create any. | 843 // create any. |
| 844 EXPECT_NE(root_transform_id_to_index, | 844 EXPECT_NE(root_transform_id_to_index, |
| 845 property_trees->transform_id_to_index_map.end()); | 845 property_trees->layer_id_to_transform_node_index.end()); |
| 846 EXPECT_EQ(root_transform_id_to_index->second, | 846 EXPECT_EQ(root_transform_id_to_index->second, |
| 847 root_->transform_tree_index()); | 847 root_->transform_tree_index()); |
| 848 EXPECT_NE(root_effect_id_to_index, | 848 EXPECT_NE(root_effect_id_to_index, |
| 849 property_trees->effect_id_to_index_map.end()); | 849 property_trees->layer_id_to_effect_node_index.end()); |
| 850 EXPECT_EQ(root_effect_id_to_index->second, root_->effect_tree_index()); | 850 EXPECT_EQ(root_effect_id_to_index->second, root_->effect_tree_index()); |
| 851 EXPECT_NE(root_clip_id_to_index, | 851 EXPECT_NE(root_clip_id_to_index, |
| 852 property_trees->clip_id_to_index_map.end()); | 852 property_trees->layer_id_to_clip_node_index.end()); |
| 853 EXPECT_EQ(root_clip_id_to_index->second, root_->clip_tree_index()); | 853 EXPECT_EQ(root_clip_id_to_index->second, root_->clip_tree_index()); |
| 854 EXPECT_NE(root_scroll_id_to_index, | 854 EXPECT_NE(root_scroll_id_to_index, |
| 855 property_trees->scroll_id_to_index_map.end()); | 855 property_trees->layer_id_to_scroll_node_index.end()); |
| 856 EXPECT_EQ(root_scroll_id_to_index->second, root_->scroll_tree_index()); | 856 EXPECT_EQ(root_scroll_id_to_index->second, root_->scroll_tree_index()); |
| 857 EXPECT_EQ(child_transform_id_to_index, | 857 EXPECT_EQ(child_transform_id_to_index, |
| 858 property_trees->transform_id_to_index_map.end()); | 858 property_trees->layer_id_to_transform_node_index.end()); |
| 859 EXPECT_EQ(child_effect_id_to_index, | 859 EXPECT_EQ(child_effect_id_to_index, |
| 860 property_trees->effect_id_to_index_map.end()); | 860 property_trees->layer_id_to_effect_node_index.end()); |
| 861 EXPECT_EQ(child_clip_id_to_index, | 861 EXPECT_EQ(child_clip_id_to_index, |
| 862 property_trees->clip_id_to_index_map.end()); | 862 property_trees->layer_id_to_clip_node_index.end()); |
| 863 EXPECT_EQ(child_scroll_id_to_index, | 863 EXPECT_EQ(child_scroll_id_to_index, |
| 864 property_trees->scroll_id_to_index_map.end()); | 864 property_trees->layer_id_to_scroll_node_index.end()); |
| 865 break; | 865 break; |
| 866 case 1: | 866 case 1: |
| 867 // child_ should create a transfrom, clip, effect nodes but not a scroll | 867 // child_ should create a transfrom, clip, effect nodes but not a scroll |
| 868 // node. | 868 // node. |
| 869 EXPECT_NE(property_trees->transform_id_to_index_map.find(child_->id()), | 869 EXPECT_NE( |
| 870 property_trees->transform_id_to_index_map.end()); | 870 property_trees->layer_id_to_transform_node_index.find(child_->id()), |
| 871 property_trees->layer_id_to_transform_node_index.end()); |
| 871 EXPECT_EQ(child_transform_id_to_index->second, | 872 EXPECT_EQ(child_transform_id_to_index->second, |
| 872 child_->transform_tree_index()); | 873 child_->transform_tree_index()); |
| 873 EXPECT_NE(property_trees->effect_id_to_index_map.find(child_->id()), | 874 EXPECT_NE( |
| 874 property_trees->effect_id_to_index_map.end()); | 875 property_trees->layer_id_to_effect_node_index.find(child_->id()), |
| 876 property_trees->layer_id_to_effect_node_index.end()); |
| 875 EXPECT_EQ(child_effect_id_to_index->second, | 877 EXPECT_EQ(child_effect_id_to_index->second, |
| 876 child_->effect_tree_index()); | 878 child_->effect_tree_index()); |
| 877 EXPECT_NE(property_trees->clip_id_to_index_map.find(child_->id()), | 879 EXPECT_NE( |
| 878 property_trees->clip_id_to_index_map.end()); | 880 property_trees->layer_id_to_clip_node_index.find(child_->id()), |
| 881 property_trees->layer_id_to_clip_node_index.end()); |
| 879 EXPECT_EQ(child_clip_id_to_index->second, child_->clip_tree_index()); | 882 EXPECT_EQ(child_clip_id_to_index->second, child_->clip_tree_index()); |
| 880 EXPECT_EQ(property_trees->scroll_id_to_index_map.find(child_->id()), | 883 EXPECT_EQ( |
| 881 property_trees->scroll_id_to_index_map.end()); | 884 property_trees->layer_id_to_scroll_node_index.find(child_->id()), |
| 885 property_trees->layer_id_to_scroll_node_index.end()); |
| 882 break; | 886 break; |
| 883 case 2: | 887 case 2: |
| 884 // child_ should create a scroll node. | 888 // child_ should create a scroll node. |
| 885 EXPECT_NE(property_trees->scroll_id_to_index_map.find(child_->id()), | 889 EXPECT_NE( |
| 886 property_trees->scroll_id_to_index_map.end()); | 890 property_trees->layer_id_to_scroll_node_index.find(child_->id()), |
| 891 property_trees->layer_id_to_scroll_node_index.end()); |
| 887 EXPECT_EQ(child_scroll_id_to_index->second, | 892 EXPECT_EQ(child_scroll_id_to_index->second, |
| 888 child_->scroll_tree_index()); | 893 child_->scroll_tree_index()); |
| 889 break; | 894 break; |
| 890 case 3: | 895 case 3: |
| 891 // child_ should not create any property tree nodes. | 896 // child_ should not create any property tree nodes. |
| 892 EXPECT_EQ(property_trees->transform_id_to_index_map.find(child_->id()), | 897 EXPECT_EQ( |
| 893 property_trees->transform_id_to_index_map.end()); | 898 property_trees->layer_id_to_transform_node_index.find(child_->id()), |
| 894 EXPECT_EQ(property_trees->effect_id_to_index_map.find(child_->id()), | 899 property_trees->layer_id_to_transform_node_index.end()); |
| 895 property_trees->effect_id_to_index_map.end()); | 900 EXPECT_EQ( |
| 896 EXPECT_EQ(property_trees->clip_id_to_index_map.find(child_->id()), | 901 property_trees->layer_id_to_effect_node_index.find(child_->id()), |
| 897 property_trees->clip_id_to_index_map.end()); | 902 property_trees->layer_id_to_effect_node_index.end()); |
| 898 EXPECT_EQ(property_trees->scroll_id_to_index_map.find(child_->id()), | 903 EXPECT_EQ( |
| 899 property_trees->scroll_id_to_index_map.end()); | 904 property_trees->layer_id_to_clip_node_index.find(child_->id()), |
| 905 property_trees->layer_id_to_clip_node_index.end()); |
| 906 EXPECT_EQ( |
| 907 property_trees->layer_id_to_scroll_node_index.find(child_->id()), |
| 908 property_trees->layer_id_to_scroll_node_index.end()); |
| 900 | 909 |
| 901 EndTest(); | 910 EndTest(); |
| 902 break; | 911 break; |
| 903 } | 912 } |
| 904 } | 913 } |
| 905 | 914 |
| 906 void AfterTest() override {} | 915 void AfterTest() override {} |
| 907 | 916 |
| 908 private: | 917 private: |
| 909 scoped_refptr<Layer> root_; | 918 scoped_refptr<Layer> root_; |
| (...skipping 6250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7160 EndTest(); | 7169 EndTest(); |
| 7161 } | 7170 } |
| 7162 | 7171 |
| 7163 void AfterTest() override {} | 7172 void AfterTest() override {} |
| 7164 }; | 7173 }; |
| 7165 | 7174 |
| 7166 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); | 7175 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); |
| 7167 | 7176 |
| 7168 } // namespace | 7177 } // namespace |
| 7169 } // namespace cc | 7178 } // namespace cc |
| OLD | NEW |