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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 class LayerTreeHostTestSetNeedsCommitInsideLayout : public LayerTreeHostTest { | 101 class LayerTreeHostTestSetNeedsCommitInsideLayout : public LayerTreeHostTest { |
102 protected: | 102 protected: |
103 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 103 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
104 | 104 |
105 void UpdateLayerTreeHost() override { | 105 void UpdateLayerTreeHost() override { |
106 // This shouldn't cause a second commit to happen. | 106 // This shouldn't cause a second commit to happen. |
107 layer_tree_host()->SetNeedsCommit(); | 107 layer_tree_host()->SetNeedsCommit(); |
108 } | 108 } |
109 | 109 |
110 void DidCommit() override { | 110 void DidCommit() override { |
111 EXPECT_EQ(1, layer_tree_host()->source_frame_number()); | 111 EXPECT_EQ(1, layer_tree_host()->SourceFrameNumber()); |
112 EndTest(); | 112 EndTest(); |
113 } | 113 } |
114 | 114 |
115 void AfterTest() override {} | 115 void AfterTest() override {} |
116 }; | 116 }; |
117 | 117 |
118 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommitInsideLayout); | 118 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommitInsideLayout); |
119 | 119 |
120 class LayerTreeHostTestFrameOrdering : public LayerTreeHostTest { | 120 class LayerTreeHostTestFrameOrdering : public LayerTreeHostTest { |
121 protected: | 121 protected: |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 class LayerTreeHostTestSetNeedsUpdateInsideLayout : public LayerTreeHostTest { | 195 class LayerTreeHostTestSetNeedsUpdateInsideLayout : public LayerTreeHostTest { |
196 protected: | 196 protected: |
197 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 197 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
198 | 198 |
199 void UpdateLayerTreeHost() override { | 199 void UpdateLayerTreeHost() override { |
200 // This shouldn't cause a second commit to happen. | 200 // This shouldn't cause a second commit to happen. |
201 layer_tree_host()->SetNeedsUpdateLayers(); | 201 layer_tree_host()->SetNeedsUpdateLayers(); |
202 } | 202 } |
203 | 203 |
204 void DidCommit() override { | 204 void DidCommit() override { |
205 EXPECT_EQ(1, layer_tree_host()->source_frame_number()); | 205 EXPECT_EQ(1, layer_tree_host()->SourceFrameNumber()); |
206 EndTest(); | 206 EndTest(); |
207 } | 207 } |
208 | 208 |
209 void AfterTest() override {} | 209 void AfterTest() override {} |
210 }; | 210 }; |
211 | 211 |
212 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsUpdateInsideLayout); | 212 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsUpdateInsideLayout); |
213 | 213 |
214 // Test if the LTHI receives ReadyToActivate notifications from the TileManager | 214 // Test if the LTHI receives ReadyToActivate notifications from the TileManager |
215 // when no raster tasks get scheduled. | 215 // when no raster tasks get scheduled. |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 root_ = Layer::Create(); | 787 root_ = Layer::Create(); |
788 child_ = Layer::Create(); | 788 child_ = Layer::Create(); |
789 root_->AddChild(child_); | 789 root_->AddChild(child_); |
790 layer_tree()->SetRootLayer(root_); | 790 layer_tree()->SetRootLayer(root_); |
791 LayerTreeHostTest::SetupTree(); | 791 LayerTreeHostTest::SetupTree(); |
792 } | 792 } |
793 | 793 |
794 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 794 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
795 | 795 |
796 void DidCommit() override { | 796 void DidCommit() override { |
797 switch (layer_tree_host()->source_frame_number()) { | 797 switch (layer_tree_host()->SourceFrameNumber()) { |
798 case 1: | 798 case 1: |
799 // child_ should create transform, effect, clip node. | 799 // child_ should create transform, effect, clip node. |
800 child_->SetForceRenderSurfaceForTesting(true); | 800 child_->SetForceRenderSurfaceForTesting(true); |
801 break; | 801 break; |
802 case 2: | 802 case 2: |
803 // child_ should create a scroll node. | 803 // child_ should create a scroll node. |
804 child_->SetScrollClipLayerId(root_->id()); | 804 child_->SetScrollClipLayerId(root_->id()); |
805 break; | 805 break; |
806 case 3: | 806 case 3: |
807 // child_ should not create any property tree node. | 807 // child_ should not create any property tree node. |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 layer_tree()->SetRootLayer(root); | 910 layer_tree()->SetRootLayer(root); |
911 LayerTreeHostTest::SetupTree(); | 911 LayerTreeHostTest::SetupTree(); |
912 } | 912 } |
913 | 913 |
914 void BeginTest() override { | 914 void BeginTest() override { |
915 index_ = 0; | 915 index_ = 0; |
916 PostSetNeedsCommitToMainThread(); | 916 PostSetNeedsCommitToMainThread(); |
917 } | 917 } |
918 | 918 |
919 void DidCommit() override { | 919 void DidCommit() override { |
920 switch (layer_tree_host()->source_frame_number()) { | 920 switch (layer_tree_host()->SourceFrameNumber()) { |
921 case 0: | 921 case 0: |
922 break; | 922 break; |
923 case 1: | 923 case 1: |
924 scoped_refptr<Layer> replica_layer = Layer::Create(); | 924 scoped_refptr<Layer> replica_layer = Layer::Create(); |
925 layer_tree()->root_layer()->SetReplicaLayer(replica_layer.get()); | 925 layer_tree()->root_layer()->SetReplicaLayer(replica_layer.get()); |
926 break; | 926 break; |
927 } | 927 } |
928 } | 928 } |
929 | 929 |
930 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 930 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 FILTER, | 972 FILTER, |
973 END, | 973 END, |
974 }; | 974 }; |
975 | 975 |
976 void BeginTest() override { | 976 void BeginTest() override { |
977 index_ = OPACITY; | 977 index_ = OPACITY; |
978 PostSetNeedsCommitToMainThread(); | 978 PostSetNeedsCommitToMainThread(); |
979 } | 979 } |
980 | 980 |
981 void DidCommit() override { | 981 void DidCommit() override { |
982 switch (layer_tree_host()->source_frame_number()) { | 982 switch (layer_tree_host()->SourceFrameNumber()) { |
983 case 2: | 983 case 2: |
984 // We rebuild property trees for this case to test the code path of | 984 // We rebuild property trees for this case to test the code path of |
985 // damage status synchronization when property trees are different. | 985 // damage status synchronization when property trees are different. |
986 layer_tree()->property_trees()->needs_rebuild = true; | 986 layer_tree()->property_trees()->needs_rebuild = true; |
987 break; | 987 break; |
988 default: | 988 default: |
989 EXPECT_FALSE(layer_tree()->property_trees()->needs_rebuild); | 989 EXPECT_FALSE(layer_tree()->property_trees()->needs_rebuild); |
990 } | 990 } |
991 } | 991 } |
992 | 992 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 brightness_filter_.Append(FilterOperation::CreateBrightnessFilter(0.25f)); | 1063 brightness_filter_.Append(FilterOperation::CreateBrightnessFilter(0.25f)); |
1064 sepia_filter_.Append(FilterOperation::CreateSepiaFilter(0.75f)); | 1064 sepia_filter_.Append(FilterOperation::CreateSepiaFilter(0.75f)); |
1065 LayerTreeHostTest::SetupTree(); | 1065 LayerTreeHostTest::SetupTree(); |
1066 } | 1066 } |
1067 | 1067 |
1068 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1068 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1069 | 1069 |
1070 void DidCommit() override { | 1070 void DidCommit() override { |
1071 EffectTree& effect_tree = layer_tree()->property_trees()->effect_tree; | 1071 EffectTree& effect_tree = layer_tree()->property_trees()->effect_tree; |
1072 EffectNode* node = effect_tree.Node(root_->effect_tree_index()); | 1072 EffectNode* node = effect_tree.Node(root_->effect_tree_index()); |
1073 switch (layer_tree_host()->source_frame_number()) { | 1073 switch (layer_tree_host()->SourceFrameNumber()) { |
1074 case 1: | 1074 case 1: |
1075 node->opacity = 0.5f; | 1075 node->opacity = 0.5f; |
1076 node->is_currently_animating_opacity = true; | 1076 node->is_currently_animating_opacity = true; |
1077 break; | 1077 break; |
1078 case 2: | 1078 case 2: |
1079 node->is_currently_animating_opacity = true; | 1079 node->is_currently_animating_opacity = true; |
1080 break; | 1080 break; |
1081 case 3: | 1081 case 3: |
1082 node->is_currently_animating_opacity = false; | 1082 node->is_currently_animating_opacity = false; |
1083 break; | 1083 break; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 } | 1173 } |
1174 | 1174 |
1175 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1175 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1176 | 1176 |
1177 void DidCommit() override { | 1177 void DidCommit() override { |
1178 TransformTree& transform_tree = | 1178 TransformTree& transform_tree = |
1179 layer_tree()->property_trees()->transform_tree; | 1179 layer_tree()->property_trees()->transform_tree; |
1180 TransformNode* node = transform_tree.Node(root_->transform_tree_index()); | 1180 TransformNode* node = transform_tree.Node(root_->transform_tree_index()); |
1181 gfx::Transform rotate10; | 1181 gfx::Transform rotate10; |
1182 rotate10.Rotate(10.f); | 1182 rotate10.Rotate(10.f); |
1183 switch (layer_tree_host()->source_frame_number()) { | 1183 switch (layer_tree_host()->SourceFrameNumber()) { |
1184 case 1: | 1184 case 1: |
1185 node->local = rotate10; | 1185 node->local = rotate10; |
1186 node->is_currently_animating = true; | 1186 node->is_currently_animating = true; |
1187 break; | 1187 break; |
1188 case 2: | 1188 case 2: |
1189 node->is_currently_animating = true; | 1189 node->is_currently_animating = true; |
1190 break; | 1190 break; |
1191 case 3: | 1191 case 3: |
1192 node->is_currently_animating = false; | 1192 node->is_currently_animating = false; |
1193 break; | 1193 break; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 | 1260 |
1261 root_->AddChild(child_); | 1261 root_->AddChild(child_); |
1262 child_->AddChild(grand_child_); | 1262 child_->AddChild(grand_child_); |
1263 layer_tree()->SetRootLayer(root_); | 1263 layer_tree()->SetRootLayer(root_); |
1264 LayerTreeHostTest::SetupTree(); | 1264 LayerTreeHostTest::SetupTree(); |
1265 } | 1265 } |
1266 | 1266 |
1267 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1267 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1268 | 1268 |
1269 void DidCommit() override { | 1269 void DidCommit() override { |
1270 if (layer_tree_host()->source_frame_number() == 1) { | 1270 if (layer_tree_host()->SourceFrameNumber() == 1) { |
1271 gfx::Transform scale; | 1271 gfx::Transform scale; |
1272 scale.Scale(2.0, 2.0); | 1272 scale.Scale(2.0, 2.0); |
1273 LayerInternalsForTest(child_.get()).OnTransformAnimated(scale); | 1273 LayerInternalsForTest(child_.get()).OnTransformAnimated(scale); |
1274 } | 1274 } |
1275 } | 1275 } |
1276 | 1276 |
1277 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 1277 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
1278 if (impl->sync_tree()->source_frame_number() == 0) | 1278 if (impl->sync_tree()->source_frame_number() == 0) |
1279 PostSetNeedsCommitToMainThread(); | 1279 PostSetNeedsCommitToMainThread(); |
1280 } | 1280 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 layer_tree()->SetRootLayer(root); | 1331 layer_tree()->SetRootLayer(root); |
1332 LayerTreeHostTest::SetupTree(); | 1332 LayerTreeHostTest::SetupTree(); |
1333 } | 1333 } |
1334 | 1334 |
1335 void BeginTest() override { | 1335 void BeginTest() override { |
1336 index_ = 0; | 1336 index_ = 0; |
1337 PostSetNeedsCommitToMainThread(); | 1337 PostSetNeedsCommitToMainThread(); |
1338 } | 1338 } |
1339 | 1339 |
1340 void DidCommit() override { | 1340 void DidCommit() override { |
1341 switch (layer_tree_host()->source_frame_number()) { | 1341 switch (layer_tree_host()->SourceFrameNumber()) { |
1342 case 1: | 1342 case 1: |
1343 // Root and mask layer should have the same source frame number as they | 1343 // Root and mask layer should have the same source frame number as they |
1344 // will be in the layer update list but the child is not as it has empty | 1344 // will be in the layer update list but the child is not as it has empty |
1345 // bounds. | 1345 // bounds. |
1346 EXPECT_EQ( | 1346 EXPECT_EQ( |
1347 mask_layer->paint_properties().source_frame_number, | 1347 mask_layer->paint_properties().source_frame_number, |
1348 layer_tree()->root_layer()->paint_properties().source_frame_number); | 1348 layer_tree()->root_layer()->paint_properties().source_frame_number); |
1349 EXPECT_NE(mask_layer->paint_properties().source_frame_number, | 1349 EXPECT_NE(mask_layer->paint_properties().source_frame_number, |
1350 layer_tree() | 1350 layer_tree() |
1351 ->root_layer() | 1351 ->root_layer() |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1580 } | 1580 } |
1581 | 1581 |
1582 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1582 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1583 | 1583 |
1584 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 1584 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
1585 if (host_impl->active_tree()->source_frame_number() == 1) | 1585 if (host_impl->active_tree()->source_frame_number() == 1) |
1586 EndTest(); | 1586 EndTest(); |
1587 } | 1587 } |
1588 | 1588 |
1589 void DidCommit() override { | 1589 void DidCommit() override { |
1590 switch (layer_tree_host()->source_frame_number()) { | 1590 switch (layer_tree_host()->SourceFrameNumber()) { |
1591 case 1: | 1591 case 1: |
1592 // SetBounds grows the layer and exposes new content. | 1592 // SetBounds grows the layer and exposes new content. |
1593 scaled_layer_->SetBounds(gfx::Size(4, 4)); | 1593 scaled_layer_->SetBounds(gfx::Size(4, 4)); |
1594 break; | 1594 break; |
1595 default: | 1595 default: |
1596 // No extra commits. | 1596 // No extra commits. |
1597 EXPECT_EQ(2, layer_tree_host()->source_frame_number()); | 1597 EXPECT_EQ(2, layer_tree_host()->SourceFrameNumber()); |
1598 } | 1598 } |
1599 } | 1599 } |
1600 | 1600 |
1601 void AfterTest() override { | 1601 void AfterTest() override { |
1602 EXPECT_EQ(gfx::Size(4, 4).ToString(), scaled_layer_->bounds().ToString()); | 1602 EXPECT_EQ(gfx::Size(4, 4).ToString(), scaled_layer_->bounds().ToString()); |
1603 } | 1603 } |
1604 | 1604 |
1605 private: | 1605 private: |
1606 FakeContentLayerClient client_; | 1606 FakeContentLayerClient client_; |
1607 scoped_refptr<Layer> root_layer_; | 1607 scoped_refptr<Layer> root_layer_; |
(...skipping 28 matching lines...) Expand all Loading... |
1636 } | 1636 } |
1637 | 1637 |
1638 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1638 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1639 | 1639 |
1640 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 1640 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
1641 if (host_impl->active_tree()->source_frame_number() == 1) | 1641 if (host_impl->active_tree()->source_frame_number() == 1) |
1642 EndTest(); | 1642 EndTest(); |
1643 } | 1643 } |
1644 | 1644 |
1645 void DidCommit() override { | 1645 void DidCommit() override { |
1646 switch (layer_tree_host()->source_frame_number()) { | 1646 switch (layer_tree_host()->SourceFrameNumber()) { |
1647 case 1: | 1647 case 1: |
1648 // Changing the device scale factor causes a commit. It also changes | 1648 // Changing the device scale factor causes a commit. It also changes |
1649 // the content bounds of |scrollbar_|, which should not generate | 1649 // the content bounds of |scrollbar_|, which should not generate |
1650 // a second commit as a result. | 1650 // a second commit as a result. |
1651 layer_tree()->SetDeviceScaleFactor(4.f); | 1651 layer_tree()->SetDeviceScaleFactor(4.f); |
1652 break; | 1652 break; |
1653 default: | 1653 default: |
1654 // No extra commits. | 1654 // No extra commits. |
1655 EXPECT_EQ(2, layer_tree_host()->source_frame_number()); | 1655 EXPECT_EQ(2, layer_tree_host()->SourceFrameNumber()); |
1656 break; | 1656 break; |
1657 } | 1657 } |
1658 } | 1658 } |
1659 | 1659 |
1660 void AfterTest() override {} | 1660 void AfterTest() override {} |
1661 | 1661 |
1662 private: | 1662 private: |
1663 FakeContentLayerClient client_; | 1663 FakeContentLayerClient client_; |
1664 scoped_refptr<Layer> root_layer_; | 1664 scoped_refptr<Layer> root_layer_; |
1665 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_; | 1665 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_; |
(...skipping 17 matching lines...) Expand all Loading... |
1683 root_layer_->AddChild(child_layer_); | 1683 root_layer_->AddChild(child_layer_); |
1684 | 1684 |
1685 layer_tree()->SetRootLayer(root_layer_); | 1685 layer_tree()->SetRootLayer(root_layer_); |
1686 LayerTreeHostTest::SetupTree(); | 1686 LayerTreeHostTest::SetupTree(); |
1687 client_.set_bounds(root_layer_->bounds()); | 1687 client_.set_bounds(root_layer_->bounds()); |
1688 } | 1688 } |
1689 | 1689 |
1690 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1690 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1691 | 1691 |
1692 void DidCommit() override { | 1692 void DidCommit() override { |
1693 if (layer_tree_host()->source_frame_number() == 1) | 1693 if (layer_tree_host()->SourceFrameNumber() == 1) |
1694 layer_tree()->SetDeviceScaleFactor(4.f); | 1694 layer_tree()->SetDeviceScaleFactor(4.f); |
1695 } | 1695 } |
1696 | 1696 |
1697 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 1697 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
1698 if (host_impl->sync_tree()->source_frame_number() == 1) { | 1698 if (host_impl->sync_tree()->source_frame_number() == 1) { |
1699 EXPECT_EQ(4.f, host_impl->sync_tree()->device_scale_factor()); | 1699 EXPECT_EQ(4.f, host_impl->sync_tree()->device_scale_factor()); |
1700 if (host_impl->pending_tree()) { | 1700 if (host_impl->pending_tree()) { |
1701 // The active tree's device scale factor shouldn't change until | 1701 // The active tree's device scale factor shouldn't change until |
1702 // activation. | 1702 // activation. |
1703 EXPECT_EQ(1.f, host_impl->active_tree()->device_scale_factor()); | 1703 EXPECT_EQ(1.f, host_impl->active_tree()->device_scale_factor()); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1879 EXPECT_EQ(gfx::Rect(child_layer_->bounds()), root_damage_rect); | 1879 EXPECT_EQ(gfx::Rect(child_layer_->bounds()), root_damage_rect); |
1880 break; | 1880 break; |
1881 default: | 1881 default: |
1882 NOTREACHED(); | 1882 NOTREACHED(); |
1883 } | 1883 } |
1884 | 1884 |
1885 return draw_result; | 1885 return draw_result; |
1886 } | 1886 } |
1887 | 1887 |
1888 void DidCommitAndDrawFrame() override { | 1888 void DidCommitAndDrawFrame() override { |
1889 switch (layer_tree_host()->source_frame_number()) { | 1889 switch (layer_tree_host()->SourceFrameNumber()) { |
1890 case 1: | 1890 case 1: |
1891 // Test not owning the surface. | 1891 // Test not owning the surface. |
1892 parent_layer_->SetOpacity(1.0f); | 1892 parent_layer_->SetOpacity(1.0f); |
1893 break; | 1893 break; |
1894 case 2: | 1894 case 2: |
1895 parent_layer_->SetOpacity(0.0f); | 1895 parent_layer_->SetOpacity(0.0f); |
1896 break; | 1896 break; |
1897 case 3: | 1897 case 3: |
1898 // Test owning the surface. | 1898 // Test owning the surface. |
1899 parent_layer_->SetOpacity(0.5f); | 1899 parent_layer_->SetOpacity(0.5f); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1992 break; | 1992 break; |
1993 } | 1993 } |
1994 default: | 1994 default: |
1995 NOTREACHED(); | 1995 NOTREACHED(); |
1996 } | 1996 } |
1997 | 1997 |
1998 return draw_result; | 1998 return draw_result; |
1999 } | 1999 } |
2000 | 2000 |
2001 void DidCommitAndDrawFrame() override { | 2001 void DidCommitAndDrawFrame() override { |
2002 switch (layer_tree_host()->source_frame_number()) { | 2002 switch (layer_tree_host()->SourceFrameNumber()) { |
2003 case 1: { | 2003 case 1: { |
2004 // Test not owning the surface. | 2004 // Test not owning the surface. |
2005 child_layer_->SetOpacity(0.5f); | 2005 child_layer_->SetOpacity(0.5f); |
2006 break; | 2006 break; |
2007 } | 2007 } |
2008 case 2: | 2008 case 2: |
2009 EndTest(); | 2009 EndTest(); |
2010 break; | 2010 break; |
2011 default: | 2011 default: |
2012 NOTREACHED(); | 2012 NOTREACHED(); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2227 EndTest(); | 2227 EndTest(); |
2228 break; | 2228 break; |
2229 case 3: | 2229 case 3: |
2230 break; | 2230 break; |
2231 default: | 2231 default: |
2232 NOTREACHED(); | 2232 NOTREACHED(); |
2233 } | 2233 } |
2234 } | 2234 } |
2235 | 2235 |
2236 void DidCommitAndDrawFrame() override { | 2236 void DidCommitAndDrawFrame() override { |
2237 switch (layer_tree_host()->source_frame_number()) { | 2237 switch (layer_tree_host()->SourceFrameNumber()) { |
2238 case 1: | 2238 case 1: |
2239 layer_tree()->StartPageScaleAnimation(gfx::Vector2d(), false, 1.25f, | 2239 layer_tree()->StartPageScaleAnimation(gfx::Vector2d(), false, 1.25f, |
2240 base::TimeDelta()); | 2240 base::TimeDelta()); |
2241 break; | 2241 break; |
2242 } | 2242 } |
2243 } | 2243 } |
2244 | 2244 |
2245 void AfterTest() override {} | 2245 void AfterTest() override {} |
2246 | 2246 |
2247 FakeContentLayerClient client_; | 2247 FakeContentLayerClient client_; |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2569 scoped_refptr<Layer> root_layer = PictureLayer::Create(&client_); | 2569 scoped_refptr<Layer> root_layer = PictureLayer::Create(&client_); |
2570 client_.set_fill_with_nonsolid_color(true); | 2570 client_.set_fill_with_nonsolid_color(true); |
2571 root_layer->SetIsDrawable(true); | 2571 root_layer->SetIsDrawable(true); |
2572 root_layer->SetBounds(gfx::Size(10, 10)); | 2572 root_layer->SetBounds(gfx::Size(10, 10)); |
2573 root_layer->SetContentsOpaque(true); | 2573 root_layer->SetContentsOpaque(true); |
2574 | 2574 |
2575 layer_tree()->SetRootLayer(root_layer); | 2575 layer_tree()->SetRootLayer(root_layer); |
2576 | 2576 |
2577 // The expectations are based on the assumption that the default | 2577 // The expectations are based on the assumption that the default |
2578 // LCD settings are: | 2578 // LCD settings are: |
2579 EXPECT_TRUE(layer_tree_host()->settings().can_use_lcd_text); | 2579 EXPECT_TRUE(layer_tree_host()->GetSettings().can_use_lcd_text); |
2580 | 2580 |
2581 LayerTreeHostTest::SetupTree(); | 2581 LayerTreeHostTest::SetupTree(); |
2582 client_.set_bounds(root_layer->bounds()); | 2582 client_.set_bounds(root_layer->bounds()); |
2583 } | 2583 } |
2584 | 2584 |
2585 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2585 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
2586 | 2586 |
2587 void DidCommitAndDrawFrame() override { | 2587 void DidCommitAndDrawFrame() override { |
2588 switch (layer_tree_host()->source_frame_number()) { | 2588 switch (layer_tree_host()->SourceFrameNumber()) { |
2589 case 1: | 2589 case 1: |
2590 PostSetNeedsCommitToMainThread(); | 2590 PostSetNeedsCommitToMainThread(); |
2591 break; | 2591 break; |
2592 case 2: | 2592 case 2: |
2593 // Change layer opacity that should trigger lcd change. | 2593 // Change layer opacity that should trigger lcd change. |
2594 layer_tree()->root_layer()->SetOpacity(.5f); | 2594 layer_tree()->root_layer()->SetOpacity(.5f); |
2595 break; | 2595 break; |
2596 case 3: | 2596 case 3: |
2597 // Change layer opacity that should not trigger lcd change. | 2597 // Change layer opacity that should not trigger lcd change. |
2598 layer_tree()->root_layer()->SetOpacity(1.f); | 2598 layer_tree()->root_layer()->SetOpacity(1.f); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2767 scoped_refptr<ContextProvider> compositor_context_provider, | 2767 scoped_refptr<ContextProvider> compositor_context_provider, |
2768 scoped_refptr<ContextProvider> worker_context_provider) override { | 2768 scoped_refptr<ContextProvider> worker_context_provider) override { |
2769 auto on_draw_callback = base::Bind( | 2769 auto on_draw_callback = base::Bind( |
2770 &LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor:: | 2770 &LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor:: |
2771 CallOnDraw, | 2771 CallOnDraw, |
2772 base::Unretained(this)); | 2772 base::Unretained(this)); |
2773 auto output_surface = base::MakeUnique<OnDrawOutputSurface>( | 2773 auto output_surface = base::MakeUnique<OnDrawOutputSurface>( |
2774 compositor_context_provider, std::move(worker_context_provider), | 2774 compositor_context_provider, std::move(worker_context_provider), |
2775 CreateDisplayOutputSurface(compositor_context_provider), | 2775 CreateDisplayOutputSurface(compositor_context_provider), |
2776 shared_bitmap_manager(), gpu_memory_buffer_manager(), | 2776 shared_bitmap_manager(), gpu_memory_buffer_manager(), |
2777 layer_tree_host()->settings().renderer_settings, ImplThreadTaskRunner(), | 2777 layer_tree_host()->GetSettings().renderer_settings, |
2778 false /* synchronous_composite */, | 2778 ImplThreadTaskRunner(), false /* synchronous_composite */, |
2779 false /* force_disable_reclaim_resources */, | 2779 false /* force_disable_reclaim_resources */, |
2780 std::move(on_draw_callback)); | 2780 std::move(on_draw_callback)); |
2781 output_surface_ = output_surface.get(); | 2781 output_surface_ = output_surface.get(); |
2782 return std::move(output_surface); | 2782 return std::move(output_surface); |
2783 } | 2783 } |
2784 | 2784 |
2785 void CallOnDraw() { | 2785 void CallOnDraw() { |
2786 if (!TestEnded()) { | 2786 if (!TestEnded()) { |
2787 // Synchronous compositor does not draw unless told to do so by the output | 2787 // Synchronous compositor does not draw unless told to do so by the output |
2788 // surface. But it needs to be done on a new stack frame. | 2788 // surface. But it needs to be done on a new stack frame. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2843 void BeginTest() override { | 2843 void BeginTest() override { |
2844 frame_ = 0; | 2844 frame_ = 0; |
2845 PostSetNeedsCommitToMainThread(); | 2845 PostSetNeedsCommitToMainThread(); |
2846 } | 2846 } |
2847 | 2847 |
2848 // Round 1: commit + draw | 2848 // Round 1: commit + draw |
2849 // Round 2: commit only (no draw/swap) | 2849 // Round 2: commit only (no draw/swap) |
2850 // Round 3: draw only (no commit) | 2850 // Round 3: draw only (no commit) |
2851 | 2851 |
2852 void DidCommit() override { | 2852 void DidCommit() override { |
2853 int commit = layer_tree_host()->source_frame_number(); | 2853 int commit = layer_tree_host()->SourceFrameNumber(); |
2854 switch (commit) { | 2854 switch (commit) { |
2855 case 2: | 2855 case 2: |
2856 // Round 2 done. | 2856 // Round 2 done. |
2857 EXPECT_EQ(1, frame_); | 2857 EXPECT_EQ(1, frame_); |
2858 layer_tree_host()->SetNeedsRedraw(); | 2858 layer_tree_host()->SetNeedsRedraw(); |
2859 break; | 2859 break; |
2860 } | 2860 } |
2861 } | 2861 } |
2862 | 2862 |
2863 void DidCompleteSwapBuffers() override { | 2863 void DidCompleteSwapBuffers() override { |
2864 int commit = layer_tree_host()->source_frame_number(); | 2864 int commit = layer_tree_host()->SourceFrameNumber(); |
2865 ++frame_; | 2865 ++frame_; |
2866 switch (frame_) { | 2866 switch (frame_) { |
2867 case 1: | 2867 case 1: |
2868 // Round 1 done. | 2868 // Round 1 done. |
2869 EXPECT_EQ(1, commit); | 2869 EXPECT_EQ(1, commit); |
2870 layer_tree_host()->SetNeedsCommit(); | 2870 layer_tree_host()->SetNeedsCommit(); |
2871 break; | 2871 break; |
2872 case 2: | 2872 case 2: |
2873 // Round 3 done. | 2873 // Round 3 done. |
2874 EXPECT_EQ(2, commit); | 2874 EXPECT_EQ(2, commit); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2916 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface( | 2916 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface( |
2917 scoped_refptr<ContextProvider> compositor_context_provider, | 2917 scoped_refptr<ContextProvider> compositor_context_provider, |
2918 scoped_refptr<ContextProvider> worker_context_provider) override { | 2918 scoped_refptr<ContextProvider> worker_context_provider) override { |
2919 auto on_draw_callback = | 2919 auto on_draw_callback = |
2920 base::Bind(&LayerTreeHostTestResourcelessSoftwareDraw::CallOnDraw, | 2920 base::Bind(&LayerTreeHostTestResourcelessSoftwareDraw::CallOnDraw, |
2921 base::Unretained(this)); | 2921 base::Unretained(this)); |
2922 auto output_surface = base::MakeUnique<OnDrawOutputSurface>( | 2922 auto output_surface = base::MakeUnique<OnDrawOutputSurface>( |
2923 compositor_context_provider, std::move(worker_context_provider), | 2923 compositor_context_provider, std::move(worker_context_provider), |
2924 CreateDisplayOutputSurface(compositor_context_provider), | 2924 CreateDisplayOutputSurface(compositor_context_provider), |
2925 shared_bitmap_manager(), gpu_memory_buffer_manager(), | 2925 shared_bitmap_manager(), gpu_memory_buffer_manager(), |
2926 layer_tree_host()->settings().renderer_settings, ImplThreadTaskRunner(), | 2926 layer_tree_host()->GetSettings().renderer_settings, |
2927 false /* synchronous_composite */, | 2927 ImplThreadTaskRunner(), false /* synchronous_composite */, |
2928 false /* force_disable_reclaim_resources */, | 2928 false /* force_disable_reclaim_resources */, |
2929 std::move(on_draw_callback)); | 2929 std::move(on_draw_callback)); |
2930 output_surface_ = output_surface.get(); | 2930 output_surface_ = output_surface.get(); |
2931 return std::move(output_surface); | 2931 return std::move(output_surface); |
2932 } | 2932 } |
2933 | 2933 |
2934 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2934 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
2935 | 2935 |
2936 void CallOnDraw() { | 2936 void CallOnDraw() { |
2937 if (!TestEnded()) { | 2937 if (!TestEnded()) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2997 public: | 2997 public: |
2998 LayerTreeHostTestUIResource() : num_ui_resources_(0) {} | 2998 LayerTreeHostTestUIResource() : num_ui_resources_(0) {} |
2999 | 2999 |
3000 void InitializeSettings(LayerTreeSettings* settings) override { | 3000 void InitializeSettings(LayerTreeSettings* settings) override { |
3001 settings->renderer_settings.texture_id_allocation_chunk_size = 1; | 3001 settings->renderer_settings.texture_id_allocation_chunk_size = 1; |
3002 } | 3002 } |
3003 | 3003 |
3004 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 3004 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
3005 | 3005 |
3006 void DidCommit() override { | 3006 void DidCommit() override { |
3007 int frame = layer_tree_host()->source_frame_number(); | 3007 int frame = layer_tree_host()->SourceFrameNumber(); |
3008 switch (frame) { | 3008 switch (frame) { |
3009 case 1: | 3009 case 1: |
3010 CreateResource(); | 3010 CreateResource(); |
3011 CreateResource(); | 3011 CreateResource(); |
3012 PostSetNeedsCommitToMainThread(); | 3012 PostSetNeedsCommitToMainThread(); |
3013 break; | 3013 break; |
3014 case 2: | 3014 case 2: |
3015 // Usually ScopedUIResource are deleted from the manager in their | 3015 // Usually ScopedUIResource are deleted from the manager in their |
3016 // destructor. Here we just want to test that a direct call to | 3016 // destructor. Here we just want to test that a direct call to |
3017 // DeleteUIResource works. | 3017 // DeleteUIResource works. |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3576 scrollbar_layer_ = FakePaintedScrollbarLayer::Create( | 3576 scrollbar_layer_ = FakePaintedScrollbarLayer::Create( |
3577 paint_scrollbar, has_thumb, root_->id()); | 3577 paint_scrollbar, has_thumb, root_->id()); |
3578 | 3578 |
3579 root_->AddChild(scrollbar_layer_); | 3579 root_->AddChild(scrollbar_layer_); |
3580 | 3580 |
3581 layer_tree()->SetRootLayer(root_); | 3581 layer_tree()->SetRootLayer(root_); |
3582 LayerTreeHostTest::SetupTree(); | 3582 LayerTreeHostTest::SetupTree(); |
3583 } | 3583 } |
3584 | 3584 |
3585 void DidCommitAndDrawFrame() override { | 3585 void DidCommitAndDrawFrame() override { |
3586 switch (layer_tree_host()->source_frame_number()) { | 3586 switch (layer_tree_host()->SourceFrameNumber()) { |
3587 case 0: | 3587 case 0: |
3588 break; | 3588 break; |
3589 case 1: { | 3589 case 1: { |
3590 // During update, the ignore_set_needs_commit_ bit is set to true to | 3590 // During update, the ignore_set_needs_commit_ bit is set to true to |
3591 // avoid causing a second commit to be scheduled. If a property change | 3591 // avoid causing a second commit to be scheduled. If a property change |
3592 // is made during this, however, it needs to be pushed in the upcoming | 3592 // is made during this, however, it needs to be pushed in the upcoming |
3593 // commit. | 3593 // commit. |
3594 std::unique_ptr<base::AutoReset<bool>> ignore = | 3594 std::unique_ptr<base::AutoReset<bool>> ignore = |
3595 scrollbar_layer_->IgnoreSetNeedsCommit(); | 3595 scrollbar_layer_->IgnoreSetNeedsCommit(); |
3596 | 3596 |
(...skipping 29 matching lines...) Expand all Loading... |
3626 void SetupTree() override { | 3626 void SetupTree() override { |
3627 root_ = PushPropertiesCountingLayer::Create(); | 3627 root_ = PushPropertiesCountingLayer::Create(); |
3628 child_ = PushPropertiesCountingLayer::Create(); | 3628 child_ = PushPropertiesCountingLayer::Create(); |
3629 root_->AddChild(child_); | 3629 root_->AddChild(child_); |
3630 | 3630 |
3631 layer_tree()->SetRootLayer(root_); | 3631 layer_tree()->SetRootLayer(root_); |
3632 LayerTreeHostTest::SetupTree(); | 3632 LayerTreeHostTest::SetupTree(); |
3633 } | 3633 } |
3634 | 3634 |
3635 void DidCommitAndDrawFrame() override { | 3635 void DidCommitAndDrawFrame() override { |
3636 switch (layer_tree_host()->source_frame_number()) { | 3636 switch (layer_tree_host()->SourceFrameNumber()) { |
3637 case 0: | 3637 case 0: |
3638 break; | 3638 break; |
3639 case 1: { | 3639 case 1: { |
3640 // During update, the ignore_set_needs_commit_ bit is set to true to | 3640 // During update, the ignore_set_needs_commit_ bit is set to true to |
3641 // avoid causing a second commit to be scheduled. If a property change | 3641 // avoid causing a second commit to be scheduled. If a property change |
3642 // is made during this, however, it needs to be pushed in the upcoming | 3642 // is made during this, however, it needs to be pushed in the upcoming |
3643 // commit. | 3643 // commit. |
3644 EXPECT_FALSE( | 3644 EXPECT_FALSE( |
3645 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3645 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); |
3646 EXPECT_FALSE( | 3646 EXPECT_FALSE( |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3720 size_t expected_push_properties_child_; | 3720 size_t expected_push_properties_child_; |
3721 size_t expected_push_properties_grandchild1_; | 3721 size_t expected_push_properties_grandchild1_; |
3722 size_t expected_push_properties_grandchild2_; | 3722 size_t expected_push_properties_grandchild2_; |
3723 size_t expected_push_properties_grandchild3_; | 3723 size_t expected_push_properties_grandchild3_; |
3724 }; | 3724 }; |
3725 | 3725 |
3726 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush | 3726 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush |
3727 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3727 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3728 protected: | 3728 protected: |
3729 void DidCommitAndDrawFrame() override { | 3729 void DidCommitAndDrawFrame() override { |
3730 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3730 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; |
3731 switch (last_source_frame_number) { | 3731 switch (last_source_frame_number) { |
3732 case 0: | 3732 case 0: |
3733 // All layers will need push properties as we set their layer tree host | 3733 // All layers will need push properties as we set their layer tree host |
3734 layer_tree()->SetRootLayer(root_); | 3734 layer_tree()->SetRootLayer(root_); |
3735 EXPECT_TRUE( | 3735 EXPECT_TRUE( |
3736 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3736 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); |
3737 EXPECT_TRUE( | 3737 EXPECT_TRUE( |
3738 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3738 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); |
3739 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3739 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
3740 grandchild1_.get())); | 3740 grandchild1_.get())); |
3741 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3741 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
3742 grandchild2_.get())); | 3742 grandchild2_.get())); |
3743 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3743 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
3744 grandchild3_.get())); | 3744 grandchild3_.get())); |
3745 break; | 3745 break; |
3746 case 1: | 3746 case 1: |
3747 EndTest(); | 3747 EndTest(); |
3748 break; | 3748 break; |
3749 } | 3749 } |
3750 } | 3750 } |
3751 }; | 3751 }; |
3752 | 3752 |
3753 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); | 3753 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); |
3754 | 3754 |
3755 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion | 3755 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion |
3756 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3756 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3757 protected: | 3757 protected: |
3758 void DidCommitAndDrawFrame() override { | 3758 void DidCommitAndDrawFrame() override { |
3759 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3759 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; |
3760 switch (last_source_frame_number) { | 3760 switch (last_source_frame_number) { |
3761 case 0: | 3761 case 0: |
3762 layer_tree()->SetRootLayer(root_); | 3762 layer_tree()->SetRootLayer(root_); |
3763 break; | 3763 break; |
3764 case 1: | 3764 case 1: |
3765 EXPECT_FALSE( | 3765 EXPECT_FALSE( |
3766 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3766 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); |
3767 EXPECT_FALSE( | 3767 EXPECT_FALSE( |
3768 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3768 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); |
3769 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3769 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3833 } | 3833 } |
3834 }; | 3834 }; |
3835 | 3835 |
3836 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); | 3836 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); |
3837 | 3837 |
3838 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence | 3838 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence |
3839 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3839 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3840 protected: | 3840 protected: |
3841 void DidCommitAndDrawFrame() override { | 3841 void DidCommitAndDrawFrame() override { |
3842 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 3842 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
3843 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3843 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; |
3844 switch (last_source_frame_number) { | 3844 switch (last_source_frame_number) { |
3845 case 0: | 3845 case 0: |
3846 layer_tree->SetRootLayer(root_); | 3846 layer_tree->SetRootLayer(root_); |
3847 grandchild1_->set_persist_needs_push_properties(true); | 3847 grandchild1_->set_persist_needs_push_properties(true); |
3848 grandchild2_->set_persist_needs_push_properties(true); | 3848 grandchild2_->set_persist_needs_push_properties(true); |
3849 break; | 3849 break; |
3850 case 1: | 3850 case 1: |
3851 EXPECT_FALSE( | 3851 EXPECT_FALSE( |
3852 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 3852 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3853 EXPECT_FALSE( | 3853 EXPECT_FALSE( |
(...skipping 28 matching lines...) Expand all Loading... |
3882 }; | 3882 }; |
3883 | 3883 |
3884 MULTI_THREAD_TEST_F( | 3884 MULTI_THREAD_TEST_F( |
3885 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); | 3885 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); |
3886 | 3886 |
3887 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree | 3887 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree |
3888 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3888 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3889 protected: | 3889 protected: |
3890 void DidCommitAndDrawFrame() override { | 3890 void DidCommitAndDrawFrame() override { |
3891 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 3891 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
3892 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3892 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; |
3893 switch (last_source_frame_number) { | 3893 switch (last_source_frame_number) { |
3894 case 0: | 3894 case 0: |
3895 layer_tree->SetRootLayer(root_); | 3895 layer_tree->SetRootLayer(root_); |
3896 break; | 3896 break; |
3897 case 1: | 3897 case 1: |
3898 EXPECT_FALSE( | 3898 EXPECT_FALSE( |
3899 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 3899 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3900 EXPECT_FALSE( | 3900 EXPECT_FALSE( |
3901 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 3901 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3902 EXPECT_FALSE( | 3902 EXPECT_FALSE( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3951 }; | 3951 }; |
3952 | 3952 |
3953 MULTI_THREAD_TEST_F( | 3953 MULTI_THREAD_TEST_F( |
3954 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); | 3954 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); |
3955 | 3955 |
3956 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild | 3956 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild |
3957 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3957 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3958 protected: | 3958 protected: |
3959 void DidCommitAndDrawFrame() override { | 3959 void DidCommitAndDrawFrame() override { |
3960 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 3960 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
3961 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3961 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; |
3962 switch (last_source_frame_number) { | 3962 switch (last_source_frame_number) { |
3963 case 0: | 3963 case 0: |
3964 layer_tree->SetRootLayer(root_); | 3964 layer_tree->SetRootLayer(root_); |
3965 break; | 3965 break; |
3966 case 1: | 3966 case 1: |
3967 EXPECT_FALSE( | 3967 EXPECT_FALSE( |
3968 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 3968 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3969 EXPECT_FALSE( | 3969 EXPECT_FALSE( |
3970 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 3970 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3971 EXPECT_FALSE( | 3971 EXPECT_FALSE( |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4016 }; | 4016 }; |
4017 | 4017 |
4018 MULTI_THREAD_TEST_F( | 4018 MULTI_THREAD_TEST_F( |
4019 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); | 4019 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); |
4020 | 4020 |
4021 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent | 4021 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent |
4022 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 4022 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
4023 protected: | 4023 protected: |
4024 void DidCommitAndDrawFrame() override { | 4024 void DidCommitAndDrawFrame() override { |
4025 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 4025 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
4026 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 4026 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; |
4027 switch (last_source_frame_number) { | 4027 switch (last_source_frame_number) { |
4028 case 0: | 4028 case 0: |
4029 layer_tree->SetRootLayer(root_); | 4029 layer_tree->SetRootLayer(root_); |
4030 break; | 4030 break; |
4031 case 1: | 4031 case 1: |
4032 EXPECT_FALSE( | 4032 EXPECT_FALSE( |
4033 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4033 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
4034 EXPECT_FALSE( | 4034 EXPECT_FALSE( |
4035 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4035 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
4036 EXPECT_FALSE( | 4036 EXPECT_FALSE( |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4148 void BeginTest() override { | 4148 void BeginTest() override { |
4149 ASSERT_TRUE(invalidate_layer_) | 4149 ASSERT_TRUE(invalidate_layer_) |
4150 << "Derived tests must set this in SetupTree"; | 4150 << "Derived tests must set this in SetupTree"; |
4151 | 4151 |
4152 // One initial commit. | 4152 // One initial commit. |
4153 PostSetNeedsCommitToMainThread(); | 4153 PostSetNeedsCommitToMainThread(); |
4154 } | 4154 } |
4155 | 4155 |
4156 void DidCommitAndDrawFrame() override { | 4156 void DidCommitAndDrawFrame() override { |
4157 // After commit, invalidate the layer. This should cause a commit. | 4157 // After commit, invalidate the layer. This should cause a commit. |
4158 if (layer_tree_host()->source_frame_number() == 1) | 4158 if (layer_tree_host()->SourceFrameNumber() == 1) |
4159 invalidate_layer_->SetNeedsDisplay(); | 4159 invalidate_layer_->SetNeedsDisplay(); |
4160 } | 4160 } |
4161 | 4161 |
4162 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 4162 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
4163 num_draws_++; | 4163 num_draws_++; |
4164 if (impl->active_tree()->source_frame_number() == 1) | 4164 if (impl->active_tree()->source_frame_number() == 1) |
4165 EndTest(); | 4165 EndTest(); |
4166 } | 4166 } |
4167 | 4167 |
4168 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 4168 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4224 parent_layer_->AddChild(child_layer_); | 4224 parent_layer_->AddChild(child_layer_); |
4225 | 4225 |
4226 layer_tree()->SetRootLayer(root_layer_); | 4226 layer_tree()->SetRootLayer(root_layer_); |
4227 LayerTreeHostTest::SetupTree(); | 4227 LayerTreeHostTest::SetupTree(); |
4228 } | 4228 } |
4229 | 4229 |
4230 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4230 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
4231 | 4231 |
4232 void DidCommitAndDrawFrame() override { | 4232 void DidCommitAndDrawFrame() override { |
4233 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 4233 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
4234 switch (layer_tree_host()->source_frame_number()) { | 4234 switch (layer_tree_host()->SourceFrameNumber()) { |
4235 case 1: | 4235 case 1: |
4236 // The layer type used does not need to push properties every frame. | 4236 // The layer type used does not need to push properties every frame. |
4237 EXPECT_FALSE( | 4237 EXPECT_FALSE( |
4238 layer_tree->LayerNeedsPushPropertiesForTesting(child_layer_.get())); | 4238 layer_tree->LayerNeedsPushPropertiesForTesting(child_layer_.get())); |
4239 | 4239 |
4240 // Change the bounds of the child layer, but make it skipped | 4240 // Change the bounds of the child layer, but make it skipped |
4241 // by CalculateDrawProperties. | 4241 // by CalculateDrawProperties. |
4242 parent_layer_->SetOpacity(0.f); | 4242 parent_layer_->SetOpacity(0.f); |
4243 child_layer_->SetBounds(gfx::Size(5, 5)); | 4243 child_layer_->SetBounds(gfx::Size(5, 5)); |
4244 break; | 4244 break; |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4435 LayerTreeHostTest::SetupTree(); | 4435 LayerTreeHostTest::SetupTree(); |
4436 client_.set_bounds(root_->bounds()); | 4436 client_.set_bounds(root_->bounds()); |
4437 } | 4437 } |
4438 | 4438 |
4439 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4439 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
4440 | 4440 |
4441 void DidCommitAndDrawFrame() override { | 4441 void DidCommitAndDrawFrame() override { |
4442 // Lost context sometimes takes two frames to recreate. The third frame | 4442 // Lost context sometimes takes two frames to recreate. The third frame |
4443 // is sometimes aborted, so wait until the fourth frame to verify that | 4443 // is sometimes aborted, so wait until the fourth frame to verify that |
4444 // the memory has been set, and the fifth frame to end the test. | 4444 // the memory has been set, and the fifth frame to end the test. |
4445 if (layer_tree_host()->source_frame_number() < 5) { | 4445 if (layer_tree_host()->SourceFrameNumber() < 5) { |
4446 layer_tree_host()->SetNeedsCommit(); | 4446 layer_tree_host()->SetNeedsCommit(); |
4447 } else if (layer_tree_host()->source_frame_number() == 5) { | 4447 } else if (layer_tree_host()->SourceFrameNumber() == 5) { |
4448 EndTest(); | 4448 EndTest(); |
4449 } | 4449 } |
4450 } | 4450 } |
4451 | 4451 |
4452 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 4452 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
4453 switch (impl->active_tree()->source_frame_number()) { | 4453 switch (impl->active_tree()->source_frame_number()) { |
4454 case 1: | 4454 case 1: |
4455 EXPECT_EQ(first_output_surface_memory_limit_, | 4455 EXPECT_EQ(first_output_surface_memory_limit_, |
4456 impl->memory_allocation_limit_bytes()); | 4456 impl->memory_allocation_limit_bytes()); |
4457 // Lose the output surface. | 4457 // Lose the output surface. |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4692 PostSetNeedsCommitToMainThread(); | 4692 PostSetNeedsCommitToMainThread(); |
4693 } | 4693 } |
4694 | 4694 |
4695 void DidCommit() override { | 4695 void DidCommit() override { |
4696 MainThreadTaskRunner()->PostTask( | 4696 MainThreadTaskRunner()->PostTask( |
4697 FROM_HERE, base::Bind(&LayerTreeHostTestKeepSwapPromise::ChangeFrame, | 4697 FROM_HERE, base::Bind(&LayerTreeHostTestKeepSwapPromise::ChangeFrame, |
4698 base::Unretained(this))); | 4698 base::Unretained(this))); |
4699 } | 4699 } |
4700 | 4700 |
4701 void ChangeFrame() { | 4701 void ChangeFrame() { |
4702 switch (layer_tree_host()->source_frame_number()) { | 4702 switch (layer_tree_host()->SourceFrameNumber()) { |
4703 case 1: | 4703 case 1: |
4704 layer_->SetBounds(gfx::Size(10, 11)); | 4704 layer_->SetBounds(gfx::Size(10, 11)); |
4705 layer_tree_host()->QueueSwapPromise( | 4705 layer_tree_host()->QueueSwapPromise( |
4706 base::MakeUnique<TestSwapPromise>(&swap_promise_result_)); | 4706 base::MakeUnique<TestSwapPromise>(&swap_promise_result_)); |
4707 break; | 4707 break; |
4708 case 2: | 4708 case 2: |
4709 break; | 4709 break; |
4710 default: | 4710 default: |
4711 NOTREACHED(); | 4711 NOTREACHED(); |
4712 break; | 4712 break; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4782 layer_->SetIsDrawable(true); | 4782 layer_->SetIsDrawable(true); |
4783 layer_->SetBounds(gfx::Size(10, 10)); | 4783 layer_->SetBounds(gfx::Size(10, 10)); |
4784 layer_tree()->SetRootLayer(layer_); | 4784 layer_tree()->SetRootLayer(layer_); |
4785 gfx::Size bounds(100, 100); | 4785 gfx::Size bounds(100, 100); |
4786 layer_tree()->SetViewportSize(bounds); | 4786 layer_tree()->SetViewportSize(bounds); |
4787 PostSetNeedsCommitToMainThread(); | 4787 PostSetNeedsCommitToMainThread(); |
4788 } | 4788 } |
4789 | 4789 |
4790 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { | 4790 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { |
4791 // Safe to check frame number here because main thread is blocked. | 4791 // Safe to check frame number here because main thread is blocked. |
4792 if (layer_tree_host()->source_frame_number() == 0) { | 4792 if (layer_tree_host()->SourceFrameNumber() == 0) { |
4793 host_impl->BlockNotifyReadyToActivateForTesting(true); | 4793 host_impl->BlockNotifyReadyToActivateForTesting(true); |
4794 } else { | 4794 } else { |
4795 NOTREACHED(); | 4795 NOTREACHED(); |
4796 } | 4796 } |
4797 } | 4797 } |
4798 | 4798 |
4799 void DidCommit() override { | 4799 void DidCommit() override { |
4800 MainThreadTaskRunner()->PostTask( | 4800 MainThreadTaskRunner()->PostTask( |
4801 FROM_HERE, | 4801 FROM_HERE, |
4802 base::Bind(&LayerTreeHostTestKeepSwapPromiseMFBA::ChangeFrame, | 4802 base::Bind(&LayerTreeHostTestKeepSwapPromiseMFBA::ChangeFrame, |
4803 base::Unretained(this))); | 4803 base::Unretained(this))); |
4804 } | 4804 } |
4805 | 4805 |
4806 void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl, | 4806 void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl, |
4807 CommitEarlyOutReason reason) override { | 4807 CommitEarlyOutReason reason) override { |
4808 base::AutoLock lock(swap_promise_result_.lock); | 4808 base::AutoLock lock(swap_promise_result_.lock); |
4809 EXPECT_FALSE(swap_promise_result_.did_not_swap_called); | 4809 EXPECT_FALSE(swap_promise_result_.did_not_swap_called); |
4810 EXPECT_FALSE(swap_promise_result_.did_activate_called); | 4810 EXPECT_FALSE(swap_promise_result_.did_activate_called); |
4811 EXPECT_FALSE(swap_promise_result_.did_swap_called); | 4811 EXPECT_FALSE(swap_promise_result_.did_swap_called); |
4812 host_impl->BlockNotifyReadyToActivateForTesting(false); | 4812 host_impl->BlockNotifyReadyToActivateForTesting(false); |
4813 } | 4813 } |
4814 | 4814 |
4815 void ChangeFrame() { | 4815 void ChangeFrame() { |
4816 switch (layer_tree_host()->source_frame_number()) { | 4816 switch (layer_tree_host()->SourceFrameNumber()) { |
4817 case 1: | 4817 case 1: |
4818 // Make no changes so that we abort the next commit caused by queuing | 4818 // Make no changes so that we abort the next commit caused by queuing |
4819 // the swap promise. | 4819 // the swap promise. |
4820 layer_tree_host()->QueueSwapPromise( | 4820 layer_tree_host()->QueueSwapPromise( |
4821 base::MakeUnique<TestSwapPromise>(&swap_promise_result_)); | 4821 base::MakeUnique<TestSwapPromise>(&swap_promise_result_)); |
4822 layer_tree_host()->SetNeedsUpdateLayers(); | 4822 layer_tree_host()->SetNeedsUpdateLayers(); |
4823 break; | 4823 break; |
4824 case 2: | 4824 case 2: |
4825 break; | 4825 break; |
4826 default: | 4826 default: |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5018 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 5018 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
5019 host_impl->EvictAllUIResources(); | 5019 host_impl->EvictAllUIResources(); |
5020 // Existence of evicted UI resources will trigger NEW_CONTENT_TAKES_PRIORITY | 5020 // Existence of evicted UI resources will trigger NEW_CONTENT_TAKES_PRIORITY |
5021 // mode. Active tree should require high-res to draw after entering this | 5021 // mode. Active tree should require high-res to draw after entering this |
5022 // mode to ensure that high-res tiles are also required for a pending tree | 5022 // mode to ensure that high-res tiles are also required for a pending tree |
5023 // to be activated. | 5023 // to be activated. |
5024 EXPECT_TRUE(host_impl->RequiresHighResToDraw()); | 5024 EXPECT_TRUE(host_impl->RequiresHighResToDraw()); |
5025 } | 5025 } |
5026 | 5026 |
5027 void DidCommit() override { | 5027 void DidCommit() override { |
5028 int frame = layer_tree_host()->source_frame_number(); | 5028 int frame = layer_tree_host()->SourceFrameNumber(); |
5029 switch (frame) { | 5029 switch (frame) { |
5030 case 1: | 5030 case 1: |
5031 PostSetNeedsCommitToMainThread(); | 5031 PostSetNeedsCommitToMainThread(); |
5032 break; | 5032 break; |
5033 case 2: | 5033 case 2: |
5034 ui_resource_ = nullptr; | 5034 ui_resource_ = nullptr; |
5035 EndTest(); | 5035 EndTest(); |
5036 break; | 5036 break; |
5037 } | 5037 } |
5038 } | 5038 } |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5555 void InitializeSettings(LayerTreeSettings* settings) override { | 5555 void InitializeSettings(LayerTreeSettings* settings) override { |
5556 settings->single_thread_proxy_scheduler = false; | 5556 settings->single_thread_proxy_scheduler = false; |
5557 settings->use_zero_copy = true; | 5557 settings->use_zero_copy = true; |
5558 } | 5558 } |
5559 | 5559 |
5560 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface( | 5560 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface( |
5561 scoped_refptr<ContextProvider> compositor_context_provider, | 5561 scoped_refptr<ContextProvider> compositor_context_provider, |
5562 scoped_refptr<ContextProvider> worker_context_provider) override { | 5562 scoped_refptr<ContextProvider> worker_context_provider) override { |
5563 bool synchronous_composite = | 5563 bool synchronous_composite = |
5564 !HasImplThread() && | 5564 !HasImplThread() && |
5565 !layer_tree_host()->settings().single_thread_proxy_scheduler; | 5565 !layer_tree_host()->GetSettings().single_thread_proxy_scheduler; |
5566 // Relaiming resources is parameterized for this test. | 5566 // Relaiming resources is parameterized for this test. |
5567 bool force_disable_reclaim_resources = !reclaim_resources_; | 5567 bool force_disable_reclaim_resources = !reclaim_resources_; |
5568 return base::MakeUnique<TestDelegatingOutputSurface>( | 5568 return base::MakeUnique<TestDelegatingOutputSurface>( |
5569 compositor_context_provider, std::move(worker_context_provider), | 5569 compositor_context_provider, std::move(worker_context_provider), |
5570 CreateDisplayOutputSurface(compositor_context_provider), | 5570 CreateDisplayOutputSurface(compositor_context_provider), |
5571 shared_bitmap_manager(), gpu_memory_buffer_manager(), | 5571 shared_bitmap_manager(), gpu_memory_buffer_manager(), |
5572 layer_tree_host()->settings().renderer_settings, ImplThreadTaskRunner(), | 5572 layer_tree_host()->GetSettings().renderer_settings, |
5573 synchronous_composite, force_disable_reclaim_resources); | 5573 ImplThreadTaskRunner(), synchronous_composite, |
| 5574 force_disable_reclaim_resources); |
5574 } | 5575 } |
5575 | 5576 |
5576 void BeginTest() override { | 5577 void BeginTest() override { |
5577 // Successful composite. | 5578 // Successful composite. |
5578 std::unique_ptr<SwapPromise> swap_promise0( | 5579 std::unique_ptr<SwapPromise> swap_promise0( |
5579 new TestSwapPromise(&swap_promise_result_[0])); | 5580 new TestSwapPromise(&swap_promise_result_[0])); |
5580 layer_tree_host()->QueueSwapPromise(std::move(swap_promise0)); | 5581 layer_tree_host()->QueueSwapPromise(std::move(swap_promise0)); |
5581 layer_tree_host()->Composite(base::TimeTicks::Now()); | 5582 layer_tree_host()->Composite(base::TimeTicks::Now()); |
5582 | 5583 |
5583 // Fail to swap (no damage) if not reclaiming resources from the Display. | 5584 // Fail to swap (no damage) if not reclaiming resources from the Display. |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6326 root->AddChild(child); | 6327 root->AddChild(child); |
6327 layer_tree()->SetRootLayer(root); | 6328 layer_tree()->SetRootLayer(root); |
6328 LayerTreeHostTest::SetupTree(); | 6329 LayerTreeHostTest::SetupTree(); |
6329 } | 6330 } |
6330 | 6331 |
6331 static void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} | 6332 static void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} |
6332 | 6333 |
6333 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6334 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
6334 | 6335 |
6335 void WillCommit() override { | 6336 void WillCommit() override { |
6336 switch (layer_tree_host()->source_frame_number()) { | 6337 switch (layer_tree_host()->SourceFrameNumber()) { |
6337 case 1: | 6338 case 1: |
6338 EXPECT_GT(root->num_copy_requests_in_target_subtree(), 0); | 6339 EXPECT_GT(root->num_copy_requests_in_target_subtree(), 0); |
6339 break; | 6340 break; |
6340 } | 6341 } |
6341 } | 6342 } |
6342 | 6343 |
6343 void DidCommit() override { | 6344 void DidCommit() override { |
6344 gfx::Transform transform; | 6345 gfx::Transform transform; |
6345 switch (layer_tree_host()->source_frame_number()) { | 6346 switch (layer_tree_host()->SourceFrameNumber()) { |
6346 case 1: | 6347 case 1: |
6347 child->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( | 6348 child->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( |
6348 base::Bind(CopyOutputCallback))); | 6349 base::Bind(CopyOutputCallback))); |
6349 transform.Scale(2.0, 2.0); | 6350 transform.Scale(2.0, 2.0); |
6350 child->SetTransform(transform); | 6351 child->SetTransform(transform); |
6351 break; | 6352 break; |
6352 case 2: | 6353 case 2: |
6353 // By changing the scale of a layer which already owns a transform node, | 6354 // By changing the scale of a layer which already owns a transform node, |
6354 // a commit will be triggered but a property tree rebuild will not, this | 6355 // a commit will be triggered but a property tree rebuild will not, this |
6355 // is used to test sure that clearing copy requestts does trigger a | 6356 // is used to test sure that clearing copy requestts does trigger a |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6544 render_pass_quad->MaskUVRect().ToString()); | 6545 render_pass_quad->MaskUVRect().ToString()); |
6545 EXPECT_EQ(gfx::Vector2dF(0.005f, 0.005f).ToString(), | 6546 EXPECT_EQ(gfx::Vector2dF(0.005f, 0.005f).ToString(), |
6546 render_pass_quad->mask_uv_scale.ToString()); | 6547 render_pass_quad->mask_uv_scale.ToString()); |
6547 EndTest(); | 6548 EndTest(); |
6548 break; | 6549 break; |
6549 } | 6550 } |
6550 return draw_result; | 6551 return draw_result; |
6551 } | 6552 } |
6552 | 6553 |
6553 void DidCommit() override { | 6554 void DidCommit() override { |
6554 switch (layer_tree_host()->source_frame_number()) { | 6555 switch (layer_tree_host()->SourceFrameNumber()) { |
6555 case 1: | 6556 case 1: |
6556 gfx::Size double_root_size(200, 200); | 6557 gfx::Size double_root_size(200, 200); |
6557 layer_tree()->SetViewportSize(double_root_size); | 6558 layer_tree()->SetViewportSize(double_root_size); |
6558 layer_tree()->SetDeviceScaleFactor(2.f); | 6559 layer_tree()->SetDeviceScaleFactor(2.f); |
6559 break; | 6560 break; |
6560 } | 6561 } |
6561 } | 6562 } |
6562 | 6563 |
6563 void AfterTest() override {} | 6564 void AfterTest() override {} |
6564 | 6565 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6632 render_pass_quad->MaskUVRect().ToString()); | 6633 render_pass_quad->MaskUVRect().ToString()); |
6633 EXPECT_EQ(gfx::Vector2dF(0.01f, 0.01f).ToString(), | 6634 EXPECT_EQ(gfx::Vector2dF(0.01f, 0.01f).ToString(), |
6634 render_pass_quad->mask_uv_scale.ToString()); | 6635 render_pass_quad->mask_uv_scale.ToString()); |
6635 EndTest(); | 6636 EndTest(); |
6636 break; | 6637 break; |
6637 } | 6638 } |
6638 return draw_result; | 6639 return draw_result; |
6639 } | 6640 } |
6640 | 6641 |
6641 void DidCommit() override { | 6642 void DidCommit() override { |
6642 switch (layer_tree_host()->source_frame_number()) { | 6643 switch (layer_tree_host()->SourceFrameNumber()) { |
6643 case 1: | 6644 case 1: |
6644 gfx::Size double_root_size(200, 200); | 6645 gfx::Size double_root_size(200, 200); |
6645 layer_tree()->SetViewportSize(double_root_size); | 6646 layer_tree()->SetViewportSize(double_root_size); |
6646 layer_tree()->SetDeviceScaleFactor(2.f); | 6647 layer_tree()->SetDeviceScaleFactor(2.f); |
6647 break; | 6648 break; |
6648 } | 6649 } |
6649 } | 6650 } |
6650 | 6651 |
6651 void AfterTest() override {} | 6652 void AfterTest() override {} |
6652 | 6653 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6725 render_pass_quad->MaskUVRect().ToString()); | 6726 render_pass_quad->MaskUVRect().ToString()); |
6726 EXPECT_EQ(gfx::Vector2dF(0.01f, 0.01f).ToString(), | 6727 EXPECT_EQ(gfx::Vector2dF(0.01f, 0.01f).ToString(), |
6727 render_pass_quad->mask_uv_scale.ToString()); | 6728 render_pass_quad->mask_uv_scale.ToString()); |
6728 EndTest(); | 6729 EndTest(); |
6729 break; | 6730 break; |
6730 } | 6731 } |
6731 return draw_result; | 6732 return draw_result; |
6732 } | 6733 } |
6733 | 6734 |
6734 void DidCommit() override { | 6735 void DidCommit() override { |
6735 switch (layer_tree_host()->source_frame_number()) { | 6736 switch (layer_tree_host()->SourceFrameNumber()) { |
6736 case 1: | 6737 case 1: |
6737 gfx::Size double_root_size(200, 200); | 6738 gfx::Size double_root_size(200, 200); |
6738 layer_tree()->SetViewportSize(double_root_size); | 6739 layer_tree()->SetViewportSize(double_root_size); |
6739 layer_tree()->SetDeviceScaleFactor(2.f); | 6740 layer_tree()->SetDeviceScaleFactor(2.f); |
6740 break; | 6741 break; |
6741 } | 6742 } |
6742 } | 6743 } |
6743 | 6744 |
6744 void AfterTest() override {} | 6745 void AfterTest() override {} |
6745 | 6746 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6825 replica_quad->MaskUVRect().ToString()); | 6826 replica_quad->MaskUVRect().ToString()); |
6826 EXPECT_EQ(gfx::Vector2dF(0.02f, 0.02f).ToString(), | 6827 EXPECT_EQ(gfx::Vector2dF(0.02f, 0.02f).ToString(), |
6827 replica_quad->mask_uv_scale.ToString()); | 6828 replica_quad->mask_uv_scale.ToString()); |
6828 EndTest(); | 6829 EndTest(); |
6829 break; | 6830 break; |
6830 } | 6831 } |
6831 return draw_result; | 6832 return draw_result; |
6832 } | 6833 } |
6833 | 6834 |
6834 void DidCommit() override { | 6835 void DidCommit() override { |
6835 switch (layer_tree_host()->source_frame_number()) { | 6836 switch (layer_tree_host()->SourceFrameNumber()) { |
6836 case 1: | 6837 case 1: |
6837 // Move the child to (-50, 0) instead. Now the mask should be moved to | 6838 // Move the child to (-50, 0) instead. Now the mask should be moved to |
6838 // still cover the layer being replicated. | 6839 // still cover the layer being replicated. |
6839 content_child_layer_->SetPosition(gfx::PointF(-50.f, 0.f)); | 6840 content_child_layer_->SetPosition(gfx::PointF(-50.f, 0.f)); |
6840 break; | 6841 break; |
6841 } | 6842 } |
6842 } | 6843 } |
6843 | 6844 |
6844 void AfterTest() override {} | 6845 void AfterTest() override {} |
6845 | 6846 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7036 private: | 7037 private: |
7037 FakeContentLayerClient client_; | 7038 FakeContentLayerClient client_; |
7038 const gfx::Size viewport_size_; | 7039 const gfx::Size viewport_size_; |
7039 const gfx::Size large_image_size_; | 7040 const gfx::Size large_image_size_; |
7040 }; | 7041 }; |
7041 | 7042 |
7042 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage); | 7043 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage); |
7043 | 7044 |
7044 } // namespace | 7045 } // namespace |
7045 } // namespace cc | 7046 } // namespace cc |
OLD | NEW |