| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 class LayerTreeHostTestReadyToActivateNonEmpty | 265 class LayerTreeHostTestReadyToActivateNonEmpty |
| 266 : public LayerTreeHostTestReadyToActivateEmpty { | 266 : public LayerTreeHostTestReadyToActivateEmpty { |
| 267 public: | 267 public: |
| 268 void SetupTree() override { | 268 void SetupTree() override { |
| 269 client_.set_fill_with_nonsolid_color(true); | 269 client_.set_fill_with_nonsolid_color(true); |
| 270 scoped_refptr<FakePictureLayer> root_layer = | 270 scoped_refptr<FakePictureLayer> root_layer = |
| 271 FakePictureLayer::Create(&client_); | 271 FakePictureLayer::Create(&client_); |
| 272 root_layer->SetBounds(gfx::Size(1024, 1024)); | 272 root_layer->SetBounds(gfx::Size(1024, 1024)); |
| 273 root_layer->SetIsDrawable(true); | 273 root_layer->SetIsDrawable(true); |
| 274 | 274 |
| 275 layer_tree()->SetRootLayer(root_layer); | 275 layer_tree_host()->SetRootLayer(root_layer); |
| 276 LayerTreeHostTest::SetupTree(); | 276 LayerTreeHostTest::SetupTree(); |
| 277 client_.set_bounds(root_layer->bounds()); | 277 client_.set_bounds(root_layer->bounds()); |
| 278 } | 278 } |
| 279 | 279 |
| 280 void AfterTest() override { | 280 void AfterTest() override { |
| 281 EXPECT_TRUE(did_notify_ready_to_activate_); | 281 EXPECT_TRUE(did_notify_ready_to_activate_); |
| 282 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); | 282 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); |
| 283 EXPECT_LE(size_t(1), required_for_activation_count_); | 283 EXPECT_LE(size_t(1), required_for_activation_count_); |
| 284 } | 284 } |
| 285 | 285 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 class LayerTreeHostTestReadyToDrawNonEmpty | 336 class LayerTreeHostTestReadyToDrawNonEmpty |
| 337 : public LayerTreeHostTestReadyToDrawEmpty { | 337 : public LayerTreeHostTestReadyToDrawEmpty { |
| 338 public: | 338 public: |
| 339 void SetupTree() override { | 339 void SetupTree() override { |
| 340 client_.set_fill_with_nonsolid_color(true); | 340 client_.set_fill_with_nonsolid_color(true); |
| 341 scoped_refptr<FakePictureLayer> root_layer = | 341 scoped_refptr<FakePictureLayer> root_layer = |
| 342 FakePictureLayer::Create(&client_); | 342 FakePictureLayer::Create(&client_); |
| 343 root_layer->SetBounds(gfx::Size(1024, 1024)); | 343 root_layer->SetBounds(gfx::Size(1024, 1024)); |
| 344 root_layer->SetIsDrawable(true); | 344 root_layer->SetIsDrawable(true); |
| 345 | 345 |
| 346 layer_tree()->SetRootLayer(root_layer); | 346 layer_tree_host()->SetRootLayer(root_layer); |
| 347 LayerTreeHostTest::SetupTree(); | 347 LayerTreeHostTest::SetupTree(); |
| 348 client_.set_bounds(root_layer->bounds()); | 348 client_.set_bounds(root_layer->bounds()); |
| 349 } | 349 } |
| 350 | 350 |
| 351 void AfterTest() override { | 351 void AfterTest() override { |
| 352 EXPECT_TRUE(did_notify_ready_to_draw_); | 352 EXPECT_TRUE(did_notify_ready_to_draw_); |
| 353 EXPECT_TRUE(all_tiles_required_for_draw_are_ready_to_draw_); | 353 EXPECT_TRUE(all_tiles_required_for_draw_are_ready_to_draw_); |
| 354 EXPECT_LE(size_t(1), required_for_draw_count_); | 354 EXPECT_LE(size_t(1), required_for_draw_count_); |
| 355 } | 355 } |
| 356 | 356 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 375 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 375 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 376 | 376 |
| 377 void SetupTree() override { | 377 void SetupTree() override { |
| 378 client_.set_fill_with_nonsolid_color(true); | 378 client_.set_fill_with_nonsolid_color(true); |
| 379 scoped_refptr<FakePictureLayer> root_layer = | 379 scoped_refptr<FakePictureLayer> root_layer = |
| 380 FakePictureLayer::Create(&client_); | 380 FakePictureLayer::Create(&client_); |
| 381 root_layer->SetBounds(gfx::Size(1024, 1024)); | 381 root_layer->SetBounds(gfx::Size(1024, 1024)); |
| 382 client_.set_bounds(root_layer->bounds()); | 382 client_.set_bounds(root_layer->bounds()); |
| 383 root_layer->SetIsDrawable(true); | 383 root_layer->SetIsDrawable(true); |
| 384 | 384 |
| 385 layer_tree()->SetRootLayer(root_layer); | 385 layer_tree_host()->SetRootLayer(root_layer); |
| 386 LayerTreeHostTest::SetupTree(); | 386 LayerTreeHostTest::SetupTree(); |
| 387 } | 387 } |
| 388 | 388 |
| 389 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 389 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
| 390 if (!toggled_visibility_) { | 390 if (!toggled_visibility_) { |
| 391 { | 391 { |
| 392 DebugScopedSetMainThread main(task_runner_provider()); | 392 DebugScopedSetMainThread main(task_runner_provider()); |
| 393 layer_tree_host()->SetVisible(false); | 393 layer_tree_host()->SetVisible(false); |
| 394 } | 394 } |
| 395 toggled_visibility_ = true; | 395 toggled_visibility_ = true; |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 }; | 693 }; |
| 694 | 694 |
| 695 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit2); | 695 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit2); |
| 696 | 696 |
| 697 // Verify that we pass property values in PushPropertiesTo. | 697 // Verify that we pass property values in PushPropertiesTo. |
| 698 class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest { | 698 class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest { |
| 699 protected: | 699 protected: |
| 700 void SetupTree() override { | 700 void SetupTree() override { |
| 701 scoped_refptr<Layer> root = Layer::Create(); | 701 scoped_refptr<Layer> root = Layer::Create(); |
| 702 root->SetBounds(gfx::Size(10, 10)); | 702 root->SetBounds(gfx::Size(10, 10)); |
| 703 layer_tree()->SetRootLayer(root); | 703 layer_tree_host()->SetRootLayer(root); |
| 704 LayerTreeHostTest::SetupTree(); | 704 LayerTreeHostTest::SetupTree(); |
| 705 } | 705 } |
| 706 | 706 |
| 707 enum Properties { | 707 enum Properties { |
| 708 STARTUP, | 708 STARTUP, |
| 709 BOUNDS, | 709 BOUNDS, |
| 710 HIDE_LAYER_AND_SUBTREE, | 710 HIDE_LAYER_AND_SUBTREE, |
| 711 DRAWS_CONTENT, | 711 DRAWS_CONTENT, |
| 712 DONE, | 712 DONE, |
| 713 }; | 713 }; |
| 714 | 714 |
| 715 void BeginTest() override { | 715 void BeginTest() override { |
| 716 index_ = STARTUP; | 716 index_ = STARTUP; |
| 717 PostSetNeedsCommitToMainThread(); | 717 PostSetNeedsCommitToMainThread(); |
| 718 } | 718 } |
| 719 | 719 |
| 720 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 720 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
| 721 VerifyAfterValues(impl->active_tree()->root_layer_for_testing()); | 721 VerifyAfterValues(impl->active_tree()->root_layer_for_testing()); |
| 722 } | 722 } |
| 723 | 723 |
| 724 void DidCommitAndDrawFrame() override { | 724 void DidCommitAndDrawFrame() override { |
| 725 SetBeforeValues(layer_tree()->root_layer()); | 725 SetBeforeValues(layer_tree_host()->root_layer()); |
| 726 VerifyBeforeValues(layer_tree()->root_layer()); | 726 VerifyBeforeValues(layer_tree_host()->root_layer()); |
| 727 | 727 |
| 728 ++index_; | 728 ++index_; |
| 729 if (index_ == DONE) { | 729 if (index_ == DONE) { |
| 730 EndTest(); | 730 EndTest(); |
| 731 return; | 731 return; |
| 732 } | 732 } |
| 733 | 733 |
| 734 SetAfterValues(layer_tree()->root_layer()); | 734 SetAfterValues(layer_tree_host()->root_layer()); |
| 735 } | 735 } |
| 736 | 736 |
| 737 void AfterTest() override {} | 737 void AfterTest() override {} |
| 738 | 738 |
| 739 void VerifyBeforeValues(Layer* layer) { | 739 void VerifyBeforeValues(Layer* layer) { |
| 740 EXPECT_EQ(gfx::Size(10, 10).ToString(), layer->bounds().ToString()); | 740 EXPECT_EQ(gfx::Size(10, 10).ToString(), layer->bounds().ToString()); |
| 741 EXPECT_FALSE(layer->hide_layer_and_subtree()); | 741 EXPECT_FALSE(layer->hide_layer_and_subtree()); |
| 742 EXPECT_FALSE(layer->DrawsContent()); | 742 EXPECT_FALSE(layer->DrawsContent()); |
| 743 } | 743 } |
| 744 | 744 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 }; | 788 }; |
| 789 | 789 |
| 790 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); | 790 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); |
| 791 | 791 |
| 792 class LayerTreeHostTestPushNodeOwnerToNodeIdMap : public LayerTreeHostTest { | 792 class LayerTreeHostTestPushNodeOwnerToNodeIdMap : public LayerTreeHostTest { |
| 793 protected: | 793 protected: |
| 794 void SetupTree() override { | 794 void SetupTree() override { |
| 795 root_ = Layer::Create(); | 795 root_ = Layer::Create(); |
| 796 child_ = Layer::Create(); | 796 child_ = Layer::Create(); |
| 797 root_->AddChild(child_); | 797 root_->AddChild(child_); |
| 798 layer_tree()->SetRootLayer(root_); | 798 layer_tree_host()->SetRootLayer(root_); |
| 799 LayerTreeHostTest::SetupTree(); | 799 LayerTreeHostTest::SetupTree(); |
| 800 } | 800 } |
| 801 | 801 |
| 802 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 802 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 803 | 803 |
| 804 void DidCommit() override { | 804 void DidCommit() override { |
| 805 switch (layer_tree_host()->SourceFrameNumber()) { | 805 switch (layer_tree_host()->SourceFrameNumber()) { |
| 806 case 1: | 806 case 1: |
| 807 // child_ should create transform, effect, clip node. | 807 // child_ should create transform, effect, clip node. |
| 808 child_->SetForceRenderSurfaceForTesting(true); | 808 child_->SetForceRenderSurfaceForTesting(true); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 | 920 |
| 921 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushNodeOwnerToNodeIdMap); | 921 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushNodeOwnerToNodeIdMap); |
| 922 | 922 |
| 923 class LayerTreeHostTestPushElementIdToNodeIdMap : public LayerTreeHostTest { | 923 class LayerTreeHostTestPushElementIdToNodeIdMap : public LayerTreeHostTest { |
| 924 protected: | 924 protected: |
| 925 void SetupTree() override { | 925 void SetupTree() override { |
| 926 root_ = Layer::Create(); | 926 root_ = Layer::Create(); |
| 927 child_ = Layer::Create(); | 927 child_ = Layer::Create(); |
| 928 child_->SetElementId(kTestElementId); | 928 child_->SetElementId(kTestElementId); |
| 929 root_->AddChild(child_); | 929 root_->AddChild(child_); |
| 930 layer_tree()->SetRootLayer(root_); | 930 layer_tree_host()->SetRootLayer(root_); |
| 931 LayerTreeHostTest::SetupTree(); | 931 LayerTreeHostTest::SetupTree(); |
| 932 } | 932 } |
| 933 | 933 |
| 934 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 934 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 935 | 935 |
| 936 void DidCommit() override { | 936 void DidCommit() override { |
| 937 switch (layer_tree_host()->SourceFrameNumber()) { | 937 switch (layer_tree_host()->SourceFrameNumber()) { |
| 938 case 1: | 938 case 1: |
| 939 child_->SetForceRenderSurfaceForTesting(true); | 939 child_->SetForceRenderSurfaceForTesting(true); |
| 940 child_->AddMainThreadScrollingReasons( | 940 child_->AddMainThreadScrollingReasons( |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 // part of building a layer's property tree and are present on the impl thread. | 1025 // part of building a layer's property tree and are present on the impl thread. |
| 1026 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushElementIdToNodeIdMap); | 1026 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushElementIdToNodeIdMap); |
| 1027 | 1027 |
| 1028 class LayerTreeHostTestSurfaceDamage : public LayerTreeHostTest { | 1028 class LayerTreeHostTestSurfaceDamage : public LayerTreeHostTest { |
| 1029 protected: | 1029 protected: |
| 1030 void SetupTree() override { | 1030 void SetupTree() override { |
| 1031 root_ = Layer::Create(); | 1031 root_ = Layer::Create(); |
| 1032 child_ = Layer::Create(); | 1032 child_ = Layer::Create(); |
| 1033 grand_child_ = Layer::Create(); | 1033 grand_child_ = Layer::Create(); |
| 1034 | 1034 |
| 1035 layer_tree()->SetRootLayer(root_); | 1035 layer_tree_host()->SetRootLayer(root_); |
| 1036 root_->AddChild(child_); | 1036 root_->AddChild(child_); |
| 1037 child_->AddChild(grand_child_); | 1037 child_->AddChild(grand_child_); |
| 1038 | 1038 |
| 1039 root_->SetBounds(gfx::Size(50, 50)); | 1039 root_->SetBounds(gfx::Size(50, 50)); |
| 1040 root_->SetMasksToBounds(true); | 1040 root_->SetMasksToBounds(true); |
| 1041 child_->SetForceRenderSurfaceForTesting(true); | 1041 child_->SetForceRenderSurfaceForTesting(true); |
| 1042 | 1042 |
| 1043 LayerTreeHostTest::SetupTree(); | 1043 LayerTreeHostTest::SetupTree(); |
| 1044 } | 1044 } |
| 1045 | 1045 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 | 1108 |
| 1109 // Verify damage status of property trees is preserved after commit. | 1109 // Verify damage status of property trees is preserved after commit. |
| 1110 class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest { | 1110 class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest { |
| 1111 protected: | 1111 protected: |
| 1112 void SetupTree() override { | 1112 void SetupTree() override { |
| 1113 root_ = Layer::Create(); | 1113 root_ = Layer::Create(); |
| 1114 child_ = Layer::Create(); | 1114 child_ = Layer::Create(); |
| 1115 // This is to force the child to create a transform and effect node. | 1115 // This is to force the child to create a transform and effect node. |
| 1116 child_->SetForceRenderSurfaceForTesting(true); | 1116 child_->SetForceRenderSurfaceForTesting(true); |
| 1117 root_->AddChild(child_); | 1117 root_->AddChild(child_); |
| 1118 layer_tree()->SetRootLayer(root_); | 1118 layer_tree_host()->SetRootLayer(root_); |
| 1119 LayerTreeHostTest::SetupTree(); | 1119 LayerTreeHostTest::SetupTree(); |
| 1120 } | 1120 } |
| 1121 | 1121 |
| 1122 enum Animations { | 1122 enum Animations { |
| 1123 OPACITY, | 1123 OPACITY, |
| 1124 TRANSFORM, | 1124 TRANSFORM, |
| 1125 FILTER, | 1125 FILTER, |
| 1126 END, | 1126 END, |
| 1127 }; | 1127 }; |
| 1128 | 1128 |
| 1129 void BeginTest() override { | 1129 void BeginTest() override { |
| 1130 index_ = OPACITY; | 1130 index_ = OPACITY; |
| 1131 PostSetNeedsCommitToMainThread(); | 1131 PostSetNeedsCommitToMainThread(); |
| 1132 } | 1132 } |
| 1133 | 1133 |
| 1134 void DidCommit() override { | 1134 void DidCommit() override { |
| 1135 switch (layer_tree_host()->SourceFrameNumber()) { | 1135 switch (layer_tree_host()->SourceFrameNumber()) { |
| 1136 case 2: | 1136 case 2: |
| 1137 // We rebuild property trees for this case to test the code path of | 1137 // We rebuild property trees for this case to test the code path of |
| 1138 // damage status synchronization when property trees are different. | 1138 // damage status synchronization when property trees are different. |
| 1139 layer_tree()->property_trees()->needs_rebuild = true; | 1139 layer_tree_host()->property_trees()->needs_rebuild = true; |
| 1140 break; | 1140 break; |
| 1141 default: | 1141 default: |
| 1142 EXPECT_FALSE(layer_tree()->property_trees()->needs_rebuild); | 1142 EXPECT_FALSE(layer_tree_host()->property_trees()->needs_rebuild); |
| 1143 } | 1143 } |
| 1144 } | 1144 } |
| 1145 | 1145 |
| 1146 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 1146 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
| 1147 gfx::Transform transform; | 1147 gfx::Transform transform; |
| 1148 FilterOperations filters; | 1148 FilterOperations filters; |
| 1149 LayerImpl* root = impl->active_tree()->root_layer_for_testing(); | 1149 LayerImpl* root = impl->active_tree()->root_layer_for_testing(); |
| 1150 switch (static_cast<Animations>(index_)) { | 1150 switch (static_cast<Animations>(index_)) { |
| 1151 case OPACITY: | 1151 case OPACITY: |
| 1152 index_++; | 1152 index_++; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 scoped_refptr<Layer> root_; | 1204 scoped_refptr<Layer> root_; |
| 1205 scoped_refptr<Layer> child_; | 1205 scoped_refptr<Layer> child_; |
| 1206 }; | 1206 }; |
| 1207 | 1207 |
| 1208 SINGLE_THREAD_TEST_F(LayerTreeHostTestPropertyTreesChangedSync); | 1208 SINGLE_THREAD_TEST_F(LayerTreeHostTestPropertyTreesChangedSync); |
| 1209 | 1209 |
| 1210 class LayerTreeHostTestEffectTreeSync : public LayerTreeHostTest { | 1210 class LayerTreeHostTestEffectTreeSync : public LayerTreeHostTest { |
| 1211 protected: | 1211 protected: |
| 1212 void SetupTree() override { | 1212 void SetupTree() override { |
| 1213 root_ = Layer::Create(); | 1213 root_ = Layer::Create(); |
| 1214 layer_tree()->SetRootLayer(root_); | 1214 layer_tree_host()->SetRootLayer(root_); |
| 1215 blur_filter_.Append(FilterOperation::CreateBlurFilter(0.5f)); | 1215 blur_filter_.Append(FilterOperation::CreateBlurFilter(0.5f)); |
| 1216 brightness_filter_.Append(FilterOperation::CreateBrightnessFilter(0.25f)); | 1216 brightness_filter_.Append(FilterOperation::CreateBrightnessFilter(0.25f)); |
| 1217 sepia_filter_.Append(FilterOperation::CreateSepiaFilter(0.75f)); | 1217 sepia_filter_.Append(FilterOperation::CreateSepiaFilter(0.75f)); |
| 1218 LayerTreeHostTest::SetupTree(); | 1218 LayerTreeHostTest::SetupTree(); |
| 1219 } | 1219 } |
| 1220 | 1220 |
| 1221 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1221 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1222 | 1222 |
| 1223 void DidCommit() override { | 1223 void DidCommit() override { |
| 1224 EffectTree& effect_tree = layer_tree()->property_trees()->effect_tree; | 1224 EffectTree& effect_tree = layer_tree_host()->property_trees()->effect_tree; |
| 1225 EffectNode* node = effect_tree.Node(root_->effect_tree_index()); | 1225 EffectNode* node = effect_tree.Node(root_->effect_tree_index()); |
| 1226 switch (layer_tree_host()->SourceFrameNumber()) { | 1226 switch (layer_tree_host()->SourceFrameNumber()) { |
| 1227 case 1: | 1227 case 1: |
| 1228 node->opacity = 0.5f; | 1228 node->opacity = 0.5f; |
| 1229 node->is_currently_animating_opacity = true; | 1229 node->is_currently_animating_opacity = true; |
| 1230 break; | 1230 break; |
| 1231 case 2: | 1231 case 2: |
| 1232 node->is_currently_animating_opacity = true; | 1232 node->is_currently_animating_opacity = true; |
| 1233 break; | 1233 break; |
| 1234 case 3: | 1234 case 3: |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 FilterOperations brightness_filter_; | 1314 FilterOperations brightness_filter_; |
| 1315 FilterOperations sepia_filter_; | 1315 FilterOperations sepia_filter_; |
| 1316 }; | 1316 }; |
| 1317 | 1317 |
| 1318 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestEffectTreeSync); | 1318 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestEffectTreeSync); |
| 1319 | 1319 |
| 1320 class LayerTreeHostTestTransformTreeSync : public LayerTreeHostTest { | 1320 class LayerTreeHostTestTransformTreeSync : public LayerTreeHostTest { |
| 1321 protected: | 1321 protected: |
| 1322 void SetupTree() override { | 1322 void SetupTree() override { |
| 1323 root_ = Layer::Create(); | 1323 root_ = Layer::Create(); |
| 1324 layer_tree()->SetRootLayer(root_); | 1324 layer_tree_host()->SetRootLayer(root_); |
| 1325 LayerTreeHostTest::SetupTree(); | 1325 LayerTreeHostTest::SetupTree(); |
| 1326 } | 1326 } |
| 1327 | 1327 |
| 1328 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1328 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1329 | 1329 |
| 1330 void DidCommit() override { | 1330 void DidCommit() override { |
| 1331 TransformTree& transform_tree = | 1331 TransformTree& transform_tree = |
| 1332 layer_tree()->property_trees()->transform_tree; | 1332 layer_tree_host()->property_trees()->transform_tree; |
| 1333 TransformNode* node = transform_tree.Node(root_->transform_tree_index()); | 1333 TransformNode* node = transform_tree.Node(root_->transform_tree_index()); |
| 1334 gfx::Transform rotate10; | 1334 gfx::Transform rotate10; |
| 1335 rotate10.Rotate(10.f); | 1335 rotate10.Rotate(10.f); |
| 1336 switch (layer_tree_host()->SourceFrameNumber()) { | 1336 switch (layer_tree_host()->SourceFrameNumber()) { |
| 1337 case 1: | 1337 case 1: |
| 1338 node->local = rotate10; | 1338 node->local = rotate10; |
| 1339 node->is_currently_animating = true; | 1339 node->is_currently_animating = true; |
| 1340 break; | 1340 break; |
| 1341 case 2: | 1341 case 2: |
| 1342 node->is_currently_animating = true; | 1342 node->is_currently_animating = true; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 root_->SetBounds(gfx::Size(50, 50)); | 1406 root_->SetBounds(gfx::Size(50, 50)); |
| 1407 | 1407 |
| 1408 // Make sure child and grand_child have transform nodes. | 1408 // Make sure child and grand_child have transform nodes. |
| 1409 gfx::Transform rotation; | 1409 gfx::Transform rotation; |
| 1410 rotation.RotateAboutZAxis(45.0); | 1410 rotation.RotateAboutZAxis(45.0); |
| 1411 child_->SetTransform(rotation); | 1411 child_->SetTransform(rotation); |
| 1412 grand_child_->SetTransform(rotation); | 1412 grand_child_->SetTransform(rotation); |
| 1413 | 1413 |
| 1414 root_->AddChild(child_); | 1414 root_->AddChild(child_); |
| 1415 child_->AddChild(grand_child_); | 1415 child_->AddChild(grand_child_); |
| 1416 layer_tree()->SetRootLayer(root_); | 1416 layer_tree_host()->SetRootLayer(root_); |
| 1417 LayerTreeHostTest::SetupTree(); | 1417 LayerTreeHostTest::SetupTree(); |
| 1418 } | 1418 } |
| 1419 | 1419 |
| 1420 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1420 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1421 | 1421 |
| 1422 void DidCommit() override { | 1422 void DidCommit() override { |
| 1423 if (layer_tree_host()->SourceFrameNumber() == 1) { | 1423 if (layer_tree_host()->SourceFrameNumber() == 1) { |
| 1424 gfx::Transform scale; | 1424 gfx::Transform scale; |
| 1425 scale.Scale(2.0, 2.0); | 1425 scale.Scale(2.0, 2.0); |
| 1426 LayerInternalsForTest(child_.get()).OnTransformAnimated(scale); | 1426 LayerInternalsForTest(child_.get()).OnTransformAnimated(scale); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1474 class LayerTreeHostTestSwitchMaskLayer : public LayerTreeHostTest { | 1474 class LayerTreeHostTestSwitchMaskLayer : public LayerTreeHostTest { |
| 1475 protected: | 1475 protected: |
| 1476 void SetupTree() override { | 1476 void SetupTree() override { |
| 1477 scoped_refptr<Layer> root = Layer::Create(); | 1477 scoped_refptr<Layer> root = Layer::Create(); |
| 1478 root->SetBounds(gfx::Size(10, 10)); | 1478 root->SetBounds(gfx::Size(10, 10)); |
| 1479 scoped_refptr<Layer> child = Layer::Create(); | 1479 scoped_refptr<Layer> child = Layer::Create(); |
| 1480 mask_layer = Layer::Create(); | 1480 mask_layer = Layer::Create(); |
| 1481 mask_layer->SetBounds(gfx::Size(10, 10)); | 1481 mask_layer->SetBounds(gfx::Size(10, 10)); |
| 1482 child->SetMaskLayer(mask_layer.get()); | 1482 child->SetMaskLayer(mask_layer.get()); |
| 1483 root->AddChild(std::move(child)); | 1483 root->AddChild(std::move(child)); |
| 1484 layer_tree()->SetRootLayer(root); | 1484 layer_tree_host()->SetRootLayer(root); |
| 1485 LayerTreeHostTest::SetupTree(); | 1485 LayerTreeHostTest::SetupTree(); |
| 1486 } | 1486 } |
| 1487 | 1487 |
| 1488 void BeginTest() override { | 1488 void BeginTest() override { |
| 1489 index_ = 0; | 1489 index_ = 0; |
| 1490 PostSetNeedsCommitToMainThread(); | 1490 PostSetNeedsCommitToMainThread(); |
| 1491 } | 1491 } |
| 1492 | 1492 |
| 1493 void DidCommit() override { | 1493 void DidCommit() override { |
| 1494 switch (layer_tree_host()->SourceFrameNumber()) { | 1494 switch (layer_tree_host()->SourceFrameNumber()) { |
| 1495 case 1: | 1495 case 1: |
| 1496 // Root and mask layer should have the same source frame number as they | 1496 // Root and mask layer should have the same source frame number as they |
| 1497 // will be in the layer update list but the child is not as it has empty | 1497 // will be in the layer update list but the child is not as it has empty |
| 1498 // bounds. | 1498 // bounds. |
| 1499 EXPECT_EQ( | 1499 EXPECT_EQ(mask_layer->paint_properties().source_frame_number, |
| 1500 mask_layer->paint_properties().source_frame_number, | 1500 layer_tree_host() |
| 1501 layer_tree()->root_layer()->paint_properties().source_frame_number); | 1501 ->root_layer() |
| 1502 ->paint_properties() |
| 1503 .source_frame_number); |
| 1502 EXPECT_NE(mask_layer->paint_properties().source_frame_number, | 1504 EXPECT_NE(mask_layer->paint_properties().source_frame_number, |
| 1503 layer_tree() | 1505 layer_tree_host() |
| 1504 ->root_layer() | 1506 ->root_layer() |
| 1505 ->child_at(0) | 1507 ->child_at(0) |
| 1506 ->paint_properties() | 1508 ->paint_properties() |
| 1507 .source_frame_number); | 1509 .source_frame_number); |
| 1508 layer_tree()->root_layer()->RemoveAllChildren(); | 1510 layer_tree_host()->root_layer()->RemoveAllChildren(); |
| 1509 layer_tree()->root_layer()->SetMaskLayer(mask_layer.get()); | 1511 layer_tree_host()->root_layer()->SetMaskLayer(mask_layer.get()); |
| 1510 break; | 1512 break; |
| 1511 } | 1513 } |
| 1512 } | 1514 } |
| 1513 | 1515 |
| 1514 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 1516 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
| 1515 switch (index_) { | 1517 switch (index_) { |
| 1516 case 0: | 1518 case 0: |
| 1517 index_++; | 1519 index_++; |
| 1518 EXPECT_FALSE(impl->sync_tree() | 1520 EXPECT_FALSE(impl->sync_tree() |
| 1519 ->root_layer_for_testing() | 1521 ->root_layer_for_testing() |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1578 // must contain invalid_rect. | 1580 // must contain invalid_rect. |
| 1579 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { | 1581 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { |
| 1580 public: | 1582 public: |
| 1581 LayerTreeHostTestSetNeedsRedrawRect() | 1583 LayerTreeHostTestSetNeedsRedrawRect() |
| 1582 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} | 1584 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} |
| 1583 | 1585 |
| 1584 void BeginTest() override { | 1586 void BeginTest() override { |
| 1585 root_layer_ = FakePictureLayer::Create(&client_); | 1587 root_layer_ = FakePictureLayer::Create(&client_); |
| 1586 root_layer_->SetIsDrawable(true); | 1588 root_layer_->SetIsDrawable(true); |
| 1587 root_layer_->SetBounds(bounds_); | 1589 root_layer_->SetBounds(bounds_); |
| 1588 layer_tree()->SetRootLayer(root_layer_); | 1590 layer_tree_host()->SetRootLayer(root_layer_); |
| 1589 layer_tree()->SetViewportSize(bounds_); | 1591 layer_tree_host()->SetViewportSize(bounds_); |
| 1590 PostSetNeedsCommitToMainThread(); | 1592 PostSetNeedsCommitToMainThread(); |
| 1591 client_.set_bounds(root_layer_->bounds()); | 1593 client_.set_bounds(root_layer_->bounds()); |
| 1592 } | 1594 } |
| 1593 | 1595 |
| 1594 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 1596 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 1595 LayerTreeHostImpl::FrameData* frame_data, | 1597 LayerTreeHostImpl::FrameData* frame_data, |
| 1596 DrawResult draw_result) override { | 1598 DrawResult draw_result) override { |
| 1597 EXPECT_EQ(DRAW_SUCCESS, draw_result); | 1599 EXPECT_EQ(DRAW_SUCCESS, draw_result); |
| 1598 | 1600 |
| 1599 gfx::Rect root_damage_rect; | 1601 gfx::Rect root_damage_rect; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 void BeginTest() override { | 1644 void BeginTest() override { |
| 1643 client_.set_fill_with_nonsolid_color(true); | 1645 client_.set_fill_with_nonsolid_color(true); |
| 1644 root_layer_ = FakePictureLayer::Create(&client_); | 1646 root_layer_ = FakePictureLayer::Create(&client_); |
| 1645 root_layer_->SetIsDrawable(true); | 1647 root_layer_->SetIsDrawable(true); |
| 1646 gfx::Transform transform; | 1648 gfx::Transform transform; |
| 1647 // Translate the layer out of the viewport to force it to not update its | 1649 // Translate the layer out of the viewport to force it to not update its |
| 1648 // tile size via PushProperties. | 1650 // tile size via PushProperties. |
| 1649 transform.Translate(10000.0, 10000.0); | 1651 transform.Translate(10000.0, 10000.0); |
| 1650 root_layer_->SetTransform(transform); | 1652 root_layer_->SetTransform(transform); |
| 1651 root_layer_->SetBounds(bounds_); | 1653 root_layer_->SetBounds(bounds_); |
| 1652 layer_tree()->SetRootLayer(root_layer_); | 1654 layer_tree_host()->SetRootLayer(root_layer_); |
| 1653 layer_tree()->SetViewportSize(bounds_); | 1655 layer_tree_host()->SetViewportSize(bounds_); |
| 1654 | 1656 |
| 1655 PostSetNeedsCommitToMainThread(); | 1657 PostSetNeedsCommitToMainThread(); |
| 1656 client_.set_bounds(root_layer_->bounds()); | 1658 client_.set_bounds(root_layer_->bounds()); |
| 1657 } | 1659 } |
| 1658 | 1660 |
| 1659 void InitializeSettings(LayerTreeSettings* settings) override { | 1661 void InitializeSettings(LayerTreeSettings* settings) override { |
| 1660 settings->gpu_rasterization_enabled = true; | 1662 settings->gpu_rasterization_enabled = true; |
| 1661 settings->gpu_rasterization_forced = true; | 1663 settings->gpu_rasterization_forced = true; |
| 1662 } | 1664 } |
| 1663 | 1665 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1679 auto* pending_tiling = pending_tiling_set->tiling_at(0); | 1681 auto* pending_tiling = pending_tiling_set->tiling_at(0); |
| 1680 EXPECT_EQ( | 1682 EXPECT_EQ( |
| 1681 pending_tiling->TilingDataForTesting().max_texture_size().width(), | 1683 pending_tiling->TilingDataForTesting().max_texture_size().width(), |
| 1682 active_tiling->TilingDataForTesting().max_texture_size().width()); | 1684 active_tiling->TilingDataForTesting().max_texture_size().width()); |
| 1683 } | 1685 } |
| 1684 } | 1686 } |
| 1685 | 1687 |
| 1686 void DidCommitAndDrawFrame() override { | 1688 void DidCommitAndDrawFrame() override { |
| 1687 // On the second commit, resize the viewport. | 1689 // On the second commit, resize the viewport. |
| 1688 if (num_draws_ == 1) { | 1690 if (num_draws_ == 1) { |
| 1689 layer_tree()->SetViewportSize(gfx::Size(400, 64)); | 1691 layer_tree_host()->SetViewportSize(gfx::Size(400, 64)); |
| 1690 } | 1692 } |
| 1691 if (num_draws_ < 2) { | 1693 if (num_draws_ < 2) { |
| 1692 layer_tree_host()->SetNeedsRedrawRect(invalid_rect_); | 1694 layer_tree_host()->SetNeedsRedrawRect(invalid_rect_); |
| 1693 layer_tree_host()->SetNeedsCommit(); | 1695 layer_tree_host()->SetNeedsCommit(); |
| 1694 num_draws_++; | 1696 num_draws_++; |
| 1695 } else { | 1697 } else { |
| 1696 EndTest(); | 1698 EndTest(); |
| 1697 } | 1699 } |
| 1698 } | 1700 } |
| 1699 | 1701 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1718 } | 1720 } |
| 1719 | 1721 |
| 1720 void SetupTree() override { | 1722 void SetupTree() override { |
| 1721 root_layer_ = Layer::Create(); | 1723 root_layer_ = Layer::Create(); |
| 1722 root_layer_->SetBounds(gfx::Size(10, 20)); | 1724 root_layer_->SetBounds(gfx::Size(10, 20)); |
| 1723 | 1725 |
| 1724 scaled_layer_ = FakePictureLayer::Create(&client_); | 1726 scaled_layer_ = FakePictureLayer::Create(&client_); |
| 1725 scaled_layer_->SetBounds(gfx::Size(1, 1)); | 1727 scaled_layer_->SetBounds(gfx::Size(1, 1)); |
| 1726 root_layer_->AddChild(scaled_layer_); | 1728 root_layer_->AddChild(scaled_layer_); |
| 1727 | 1729 |
| 1728 layer_tree()->SetRootLayer(root_layer_); | 1730 layer_tree_host()->SetRootLayer(root_layer_); |
| 1729 LayerTreeHostTest::SetupTree(); | 1731 LayerTreeHostTest::SetupTree(); |
| 1730 client_.set_bounds(root_layer_->bounds()); | 1732 client_.set_bounds(root_layer_->bounds()); |
| 1731 } | 1733 } |
| 1732 | 1734 |
| 1733 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1735 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1734 | 1736 |
| 1735 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 1737 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
| 1736 if (host_impl->active_tree()->source_frame_number() == 1) | 1738 if (host_impl->active_tree()->source_frame_number() == 1) |
| 1737 EndTest(); | 1739 EndTest(); |
| 1738 } | 1740 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1774 | 1776 |
| 1775 bool paint_scrollbar = true; | 1777 bool paint_scrollbar = true; |
| 1776 bool has_thumb = false; | 1778 bool has_thumb = false; |
| 1777 scrollbar_ = FakePaintedScrollbarLayer::Create(paint_scrollbar, has_thumb, | 1779 scrollbar_ = FakePaintedScrollbarLayer::Create(paint_scrollbar, has_thumb, |
| 1778 root_layer_->id()); | 1780 root_layer_->id()); |
| 1779 scrollbar_->SetPosition(gfx::PointF(0.f, 10.f)); | 1781 scrollbar_->SetPosition(gfx::PointF(0.f, 10.f)); |
| 1780 scrollbar_->SetBounds(gfx::Size(10, 10)); | 1782 scrollbar_->SetBounds(gfx::Size(10, 10)); |
| 1781 | 1783 |
| 1782 root_layer_->AddChild(scrollbar_); | 1784 root_layer_->AddChild(scrollbar_); |
| 1783 | 1785 |
| 1784 layer_tree()->SetRootLayer(root_layer_); | 1786 layer_tree_host()->SetRootLayer(root_layer_); |
| 1785 LayerTreeHostTest::SetupTree(); | 1787 LayerTreeHostTest::SetupTree(); |
| 1786 client_.set_bounds(root_layer_->bounds()); | 1788 client_.set_bounds(root_layer_->bounds()); |
| 1787 } | 1789 } |
| 1788 | 1790 |
| 1789 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1791 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1790 | 1792 |
| 1791 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 1793 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
| 1792 if (host_impl->active_tree()->source_frame_number() == 1) | 1794 if (host_impl->active_tree()->source_frame_number() == 1) |
| 1793 EndTest(); | 1795 EndTest(); |
| 1794 } | 1796 } |
| 1795 | 1797 |
| 1796 void DidCommit() override { | 1798 void DidCommit() override { |
| 1797 switch (layer_tree_host()->SourceFrameNumber()) { | 1799 switch (layer_tree_host()->SourceFrameNumber()) { |
| 1798 case 1: | 1800 case 1: |
| 1799 // Changing the device scale factor causes a commit. It also changes | 1801 // Changing the device scale factor causes a commit. It also changes |
| 1800 // the content bounds of |scrollbar_|, which should not generate | 1802 // the content bounds of |scrollbar_|, which should not generate |
| 1801 // a second commit as a result. | 1803 // a second commit as a result. |
| 1802 layer_tree()->SetDeviceScaleFactor(4.f); | 1804 layer_tree_host()->SetDeviceScaleFactor(4.f); |
| 1803 break; | 1805 break; |
| 1804 default: | 1806 default: |
| 1805 // No extra commits. | 1807 // No extra commits. |
| 1806 EXPECT_EQ(2, layer_tree_host()->SourceFrameNumber()); | 1808 EXPECT_EQ(2, layer_tree_host()->SourceFrameNumber()); |
| 1807 break; | 1809 break; |
| 1808 } | 1810 } |
| 1809 } | 1811 } |
| 1810 | 1812 |
| 1811 void AfterTest() override {} | 1813 void AfterTest() override {} |
| 1812 | 1814 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1826 } | 1828 } |
| 1827 | 1829 |
| 1828 void SetupTree() override { | 1830 void SetupTree() override { |
| 1829 root_layer_ = Layer::Create(); | 1831 root_layer_ = Layer::Create(); |
| 1830 root_layer_->SetBounds(gfx::Size(10, 20)); | 1832 root_layer_->SetBounds(gfx::Size(10, 20)); |
| 1831 | 1833 |
| 1832 child_layer_ = FakePictureLayer::Create(&client_); | 1834 child_layer_ = FakePictureLayer::Create(&client_); |
| 1833 child_layer_->SetBounds(gfx::Size(10, 10)); | 1835 child_layer_->SetBounds(gfx::Size(10, 10)); |
| 1834 root_layer_->AddChild(child_layer_); | 1836 root_layer_->AddChild(child_layer_); |
| 1835 | 1837 |
| 1836 layer_tree()->SetRootLayer(root_layer_); | 1838 layer_tree_host()->SetRootLayer(root_layer_); |
| 1837 LayerTreeHostTest::SetupTree(); | 1839 LayerTreeHostTest::SetupTree(); |
| 1838 client_.set_bounds(root_layer_->bounds()); | 1840 client_.set_bounds(root_layer_->bounds()); |
| 1839 } | 1841 } |
| 1840 | 1842 |
| 1841 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1843 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1842 | 1844 |
| 1843 void DidCommit() override { | 1845 void DidCommit() override { |
| 1844 if (layer_tree_host()->SourceFrameNumber() == 1) | 1846 if (layer_tree_host()->SourceFrameNumber() == 1) |
| 1845 layer_tree()->SetDeviceScaleFactor(4.f); | 1847 layer_tree_host()->SetDeviceScaleFactor(4.f); |
| 1846 } | 1848 } |
| 1847 | 1849 |
| 1848 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 1850 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
| 1849 if (host_impl->sync_tree()->source_frame_number() == 1) { | 1851 if (host_impl->sync_tree()->source_frame_number() == 1) { |
| 1850 EXPECT_EQ(4.f, host_impl->sync_tree()->device_scale_factor()); | 1852 EXPECT_EQ(4.f, host_impl->sync_tree()->device_scale_factor()); |
| 1851 if (host_impl->pending_tree()) { | 1853 if (host_impl->pending_tree()) { |
| 1852 // The active tree's device scale factor shouldn't change until | 1854 // The active tree's device scale factor shouldn't change until |
| 1853 // activation. | 1855 // activation. |
| 1854 EXPECT_EQ(1.f, host_impl->active_tree()->device_scale_factor()); | 1856 EXPECT_EQ(1.f, host_impl->active_tree()->device_scale_factor()); |
| 1855 } | 1857 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1891 space1_ = gfx::ColorSpace::CreateXYZD50(); | 1893 space1_ = gfx::ColorSpace::CreateXYZD50(); |
| 1892 space2_ = gfx::ColorSpace::CreateSRGB(); | 1894 space2_ = gfx::ColorSpace::CreateSRGB(); |
| 1893 | 1895 |
| 1894 root_layer_ = Layer::Create(); | 1896 root_layer_ = Layer::Create(); |
| 1895 root_layer_->SetBounds(gfx::Size(10, 20)); | 1897 root_layer_->SetBounds(gfx::Size(10, 20)); |
| 1896 | 1898 |
| 1897 child_layer_ = FakePictureLayer::Create(&client_); | 1899 child_layer_ = FakePictureLayer::Create(&client_); |
| 1898 child_layer_->SetBounds(gfx::Size(10, 10)); | 1900 child_layer_->SetBounds(gfx::Size(10, 10)); |
| 1899 root_layer_->AddChild(child_layer_); | 1901 root_layer_->AddChild(child_layer_); |
| 1900 | 1902 |
| 1901 layer_tree()->SetRootLayer(root_layer_); | 1903 layer_tree_host()->SetRootLayer(root_layer_); |
| 1902 layer_tree()->SetDeviceColorSpace(space1_); | 1904 layer_tree_host()->SetDeviceColorSpace(space1_); |
| 1903 LayerTreeHostTest::SetupTree(); | 1905 LayerTreeHostTest::SetupTree(); |
| 1904 client_.set_bounds(root_layer_->bounds()); | 1906 client_.set_bounds(root_layer_->bounds()); |
| 1905 } | 1907 } |
| 1906 | 1908 |
| 1907 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1909 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1908 | 1910 |
| 1909 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 1911 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 1910 LayerTreeHostImpl::FrameData* frame_data, | 1912 LayerTreeHostImpl::FrameData* frame_data, |
| 1911 DrawResult draw_result) override { | 1913 DrawResult draw_result) override { |
| 1912 EXPECT_EQ(DRAW_SUCCESS, draw_result); | 1914 EXPECT_EQ(DRAW_SUCCESS, draw_result); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1962 return draw_result; | 1964 return draw_result; |
| 1963 } | 1965 } |
| 1964 | 1966 |
| 1965 void DidCommit() override { | 1967 void DidCommit() override { |
| 1966 switch (layer_tree_host()->SourceFrameNumber()) { | 1968 switch (layer_tree_host()->SourceFrameNumber()) { |
| 1967 case 1: | 1969 case 1: |
| 1968 PostSetNeedsCommitToMainThread(); | 1970 PostSetNeedsCommitToMainThread(); |
| 1969 break; | 1971 break; |
| 1970 case 2: | 1972 case 2: |
| 1971 EXPECT_FALSE(child_layer_->NeedsDisplayForTesting()); | 1973 EXPECT_FALSE(child_layer_->NeedsDisplayForTesting()); |
| 1972 layer_tree()->SetDeviceColorSpace(space2_); | 1974 layer_tree_host()->SetDeviceColorSpace(space2_); |
| 1973 EXPECT_TRUE(child_layer_->NeedsDisplayForTesting()); | 1975 EXPECT_TRUE(child_layer_->NeedsDisplayForTesting()); |
| 1974 break; | 1976 break; |
| 1975 case 3: | 1977 case 3: |
| 1976 // The redundant SetDeviceColorSpace should cause no commit and no | 1978 // The redundant SetDeviceColorSpace should cause no commit and no |
| 1977 // damage. Force a commit for the test to continue. | 1979 // damage. Force a commit for the test to continue. |
| 1978 layer_tree()->SetDeviceColorSpace(space2_); | 1980 layer_tree_host()->SetDeviceColorSpace(space2_); |
| 1979 PostSetNeedsCommitToMainThread(); | 1981 PostSetNeedsCommitToMainThread(); |
| 1980 EXPECT_FALSE(child_layer_->NeedsDisplayForTesting()); | 1982 EXPECT_FALSE(child_layer_->NeedsDisplayForTesting()); |
| 1981 break; | 1983 break; |
| 1982 case 4: | 1984 case 4: |
| 1983 EXPECT_FALSE(child_layer_->NeedsDisplayForTesting()); | 1985 EXPECT_FALSE(child_layer_->NeedsDisplayForTesting()); |
| 1984 layer_tree()->SetDeviceColorSpace(space1_); | 1986 layer_tree_host()->SetDeviceColorSpace(space1_); |
| 1985 EXPECT_TRUE(child_layer_->NeedsDisplayForTesting()); | 1987 EXPECT_TRUE(child_layer_->NeedsDisplayForTesting()); |
| 1986 break; | 1988 break; |
| 1987 case 5: | 1989 case 5: |
| 1988 EXPECT_FALSE(child_layer_->NeedsDisplayForTesting()); | 1990 EXPECT_FALSE(child_layer_->NeedsDisplayForTesting()); |
| 1989 PostSetNeedsCommitToMainThread(); | 1991 PostSetNeedsCommitToMainThread(); |
| 1990 break; | 1992 break; |
| 1991 case 6: | 1993 case 6: |
| 1992 break; | 1994 break; |
| 1993 default: | 1995 default: |
| 1994 NOTREACHED(); | 1996 NOTREACHED(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2010 | 2012 |
| 2011 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { | 2013 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { |
| 2012 public: | 2014 public: |
| 2013 LayerTreeHostTestSetNextCommitForcesRedraw() | 2015 LayerTreeHostTestSetNextCommitForcesRedraw() |
| 2014 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} | 2016 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} |
| 2015 | 2017 |
| 2016 void BeginTest() override { | 2018 void BeginTest() override { |
| 2017 root_layer_ = FakePictureLayer::Create(&client_); | 2019 root_layer_ = FakePictureLayer::Create(&client_); |
| 2018 root_layer_->SetIsDrawable(true); | 2020 root_layer_->SetIsDrawable(true); |
| 2019 root_layer_->SetBounds(bounds_); | 2021 root_layer_->SetBounds(bounds_); |
| 2020 layer_tree()->SetRootLayer(root_layer_); | 2022 layer_tree_host()->SetRootLayer(root_layer_); |
| 2021 layer_tree()->SetViewportSize(bounds_); | 2023 layer_tree_host()->SetViewportSize(bounds_); |
| 2022 PostSetNeedsCommitToMainThread(); | 2024 PostSetNeedsCommitToMainThread(); |
| 2023 client_.set_bounds(root_layer_->bounds()); | 2025 client_.set_bounds(root_layer_->bounds()); |
| 2024 } | 2026 } |
| 2025 | 2027 |
| 2026 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 2028 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
| 2027 if (num_draws_ == 3) { | 2029 if (num_draws_ == 3) { |
| 2028 host_impl->SetViewportDamage(invalid_rect_); | 2030 host_impl->SetViewportDamage(invalid_rect_); |
| 2029 host_impl->SetNeedsRedraw(); | 2031 host_impl->SetNeedsRedraw(); |
| 2030 } | 2032 } |
| 2031 } | 2033 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2105 // If we don't set the minimum contents scale, it's harder to verify whether | 2107 // If we don't set the minimum contents scale, it's harder to verify whether |
| 2106 // the damage we get is correct. For other scale amounts, please see | 2108 // the damage we get is correct. For other scale amounts, please see |
| 2107 // LayerTreeHostTestDamageWithScale. | 2109 // LayerTreeHostTestDamageWithScale. |
| 2108 settings->minimum_contents_scale = 1.f; | 2110 settings->minimum_contents_scale = 1.f; |
| 2109 } | 2111 } |
| 2110 | 2112 |
| 2111 void SetupTree() override { | 2113 void SetupTree() override { |
| 2112 root_layer_ = FakePictureLayer::Create(&client_); | 2114 root_layer_ = FakePictureLayer::Create(&client_); |
| 2113 root_layer_->SetIsDrawable(true); | 2115 root_layer_->SetIsDrawable(true); |
| 2114 root_layer_->SetBounds(gfx::Size(50, 50)); | 2116 root_layer_->SetBounds(gfx::Size(50, 50)); |
| 2115 layer_tree()->SetRootLayer(root_layer_); | 2117 layer_tree_host()->SetRootLayer(root_layer_); |
| 2116 | 2118 |
| 2117 // The initially transparent layer has a larger child layer, which is | 2119 // The initially transparent layer has a larger child layer, which is |
| 2118 // not initially drawn because of the this (parent) layer. | 2120 // not initially drawn because of the this (parent) layer. |
| 2119 parent_layer_ = FakePictureLayer::Create(&client_); | 2121 parent_layer_ = FakePictureLayer::Create(&client_); |
| 2120 parent_layer_->SetBounds(gfx::Size(15, 15)); | 2122 parent_layer_->SetBounds(gfx::Size(15, 15)); |
| 2121 parent_layer_->SetOpacity(0.0f); | 2123 parent_layer_->SetOpacity(0.0f); |
| 2122 root_layer_->AddChild(parent_layer_); | 2124 root_layer_->AddChild(parent_layer_); |
| 2123 | 2125 |
| 2124 child_layer_ = FakePictureLayer::Create(&client_); | 2126 child_layer_ = FakePictureLayer::Create(&client_); |
| 2125 child_layer_->SetBounds(gfx::Size(25, 25)); | 2127 child_layer_->SetBounds(gfx::Size(25, 25)); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2209 root_layer_->SetBounds(gfx::Size(50, 50)); | 2211 root_layer_->SetBounds(gfx::Size(50, 50)); |
| 2210 | 2212 |
| 2211 recording.reset(new FakeRecordingSource); | 2213 recording.reset(new FakeRecordingSource); |
| 2212 child_layer_ = FakePictureLayer::CreateWithRecordingSource( | 2214 child_layer_ = FakePictureLayer::CreateWithRecordingSource( |
| 2213 &client_, std::move(recording)); | 2215 &client_, std::move(recording)); |
| 2214 child_layer_->SetBounds(gfx::Size(25, 25)); | 2216 child_layer_->SetBounds(gfx::Size(25, 25)); |
| 2215 child_layer_->SetIsDrawable(true); | 2217 child_layer_->SetIsDrawable(true); |
| 2216 child_layer_->SetContentsOpaque(true); | 2218 child_layer_->SetContentsOpaque(true); |
| 2217 root_layer_->AddChild(child_layer_); | 2219 root_layer_->AddChild(child_layer_); |
| 2218 | 2220 |
| 2219 layer_tree()->SetRootLayer(root_layer_); | 2221 layer_tree_host()->SetRootLayer(root_layer_); |
| 2220 LayerTreeHostTest::SetupTree(); | 2222 LayerTreeHostTest::SetupTree(); |
| 2221 client_.set_bounds(root_layer_->bounds()); | 2223 client_.set_bounds(root_layer_->bounds()); |
| 2222 } | 2224 } |
| 2223 | 2225 |
| 2224 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 2226 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
| 2225 // Force the layer to have a tiling at 1.3f scale. Note that if we simply | 2227 // Force the layer to have a tiling at 1.3f scale. Note that if we simply |
| 2226 // add tiling, it will be gone by the time we draw because of aggressive | 2228 // add tiling, it will be gone by the time we draw because of aggressive |
| 2227 // cleanup. AddTilingUntilNextDraw ensures that it remains there during | 2229 // cleanup. AddTilingUntilNextDraw ensures that it remains there during |
| 2228 // damage calculation. | 2230 // damage calculation. |
| 2229 FakePictureLayerImpl* child_layer_impl = static_cast<FakePictureLayerImpl*>( | 2231 FakePictureLayerImpl* child_layer_impl = static_cast<FakePictureLayerImpl*>( |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2299 | 2301 |
| 2300 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDamageWithScale); | 2302 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDamageWithScale); |
| 2301 | 2303 |
| 2302 // This test verifies that properties on the layer tree host are commited | 2304 // This test verifies that properties on the layer tree host are commited |
| 2303 // to the impl side. | 2305 // to the impl side. |
| 2304 class LayerTreeHostTestCommit : public LayerTreeHostTest { | 2306 class LayerTreeHostTestCommit : public LayerTreeHostTest { |
| 2305 public: | 2307 public: |
| 2306 LayerTreeHostTestCommit() {} | 2308 LayerTreeHostTestCommit() {} |
| 2307 | 2309 |
| 2308 void BeginTest() override { | 2310 void BeginTest() override { |
| 2309 layer_tree()->SetViewportSize(gfx::Size(20, 20)); | 2311 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); |
| 2310 layer_tree()->set_background_color(SK_ColorGRAY); | 2312 layer_tree_host()->set_background_color(SK_ColorGRAY); |
| 2311 layer_tree()->SetEventListenerProperties(EventListenerClass::kMouseWheel, | 2313 layer_tree_host()->SetEventListenerProperties( |
| 2312 EventListenerProperties::kPassive); | 2314 EventListenerClass::kMouseWheel, EventListenerProperties::kPassive); |
| 2313 layer_tree()->SetEventListenerProperties( | 2315 layer_tree_host()->SetEventListenerProperties( |
| 2314 EventListenerClass::kTouchStartOrMove, | 2316 EventListenerClass::kTouchStartOrMove, |
| 2315 EventListenerProperties::kBlocking); | 2317 EventListenerProperties::kBlocking); |
| 2316 layer_tree()->SetEventListenerProperties( | 2318 layer_tree_host()->SetEventListenerProperties( |
| 2317 EventListenerClass::kTouchEndOrCancel, | 2319 EventListenerClass::kTouchEndOrCancel, |
| 2318 EventListenerProperties::kBlockingAndPassive); | 2320 EventListenerProperties::kBlockingAndPassive); |
| 2319 layer_tree()->SetHaveScrollEventHandlers(true); | 2321 layer_tree_host()->SetHaveScrollEventHandlers(true); |
| 2320 | 2322 |
| 2321 PostSetNeedsCommitToMainThread(); | 2323 PostSetNeedsCommitToMainThread(); |
| 2322 } | 2324 } |
| 2323 | 2325 |
| 2324 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 2326 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
| 2325 EXPECT_EQ(gfx::Size(20, 20), impl->DrawViewportSize()); | 2327 EXPECT_EQ(gfx::Size(20, 20), impl->DrawViewportSize()); |
| 2326 EXPECT_EQ(SK_ColorGRAY, impl->active_tree()->background_color()); | 2328 EXPECT_EQ(SK_ColorGRAY, impl->active_tree()->background_color()); |
| 2327 EXPECT_EQ(EventListenerProperties::kPassive, | 2329 EXPECT_EQ(EventListenerProperties::kPassive, |
| 2328 impl->active_tree()->event_listener_properties( | 2330 impl->active_tree()->event_listener_properties( |
| 2329 EventListenerClass::kMouseWheel)); | 2331 EventListenerClass::kMouseWheel)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2346 // This test verifies that LayerTreeHostImpl's current frame time gets | 2348 // This test verifies that LayerTreeHostImpl's current frame time gets |
| 2347 // updated in consecutive frames when it doesn't draw due to tree | 2349 // updated in consecutive frames when it doesn't draw due to tree |
| 2348 // activation failure. | 2350 // activation failure. |
| 2349 class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails | 2351 class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails |
| 2350 : public LayerTreeHostTest { | 2352 : public LayerTreeHostTest { |
| 2351 public: | 2353 public: |
| 2352 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails() | 2354 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails() |
| 2353 : frame_count_with_pending_tree_(0) {} | 2355 : frame_count_with_pending_tree_(0) {} |
| 2354 | 2356 |
| 2355 void BeginTest() override { | 2357 void BeginTest() override { |
| 2356 layer_tree()->SetViewportSize(gfx::Size(20, 20)); | 2358 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); |
| 2357 layer_tree()->set_background_color(SK_ColorGRAY); | 2359 layer_tree_host()->set_background_color(SK_ColorGRAY); |
| 2358 | 2360 |
| 2359 PostSetNeedsCommitToMainThread(); | 2361 PostSetNeedsCommitToMainThread(); |
| 2360 } | 2362 } |
| 2361 | 2363 |
| 2362 void BeginCommitOnThread(LayerTreeHostImpl* impl) override { | 2364 void BeginCommitOnThread(LayerTreeHostImpl* impl) override { |
| 2363 EXPECT_EQ(frame_count_with_pending_tree_, 0); | 2365 EXPECT_EQ(frame_count_with_pending_tree_, 0); |
| 2364 impl->BlockNotifyReadyToActivateForTesting(true); | 2366 impl->BlockNotifyReadyToActivateForTesting(true); |
| 2365 } | 2367 } |
| 2366 | 2368 |
| 2367 void WillBeginImplFrameOnThread(LayerTreeHostImpl* impl, | 2369 void WillBeginImplFrameOnThread(LayerTreeHostImpl* impl, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2400 MULTI_THREAD_BLOCKNOTIFY_TEST_F( | 2402 MULTI_THREAD_BLOCKNOTIFY_TEST_F( |
| 2401 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); | 2403 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); |
| 2402 | 2404 |
| 2403 // This test verifies that LayerTreeHostImpl's current frame time gets | 2405 // This test verifies that LayerTreeHostImpl's current frame time gets |
| 2404 // updated in consecutive frames when it draws in each frame. | 2406 // updated in consecutive frames when it draws in each frame. |
| 2405 class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest { | 2407 class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest { |
| 2406 public: | 2408 public: |
| 2407 LayerTreeHostTestFrameTimeUpdatesAfterDraw() : frame_(0) {} | 2409 LayerTreeHostTestFrameTimeUpdatesAfterDraw() : frame_(0) {} |
| 2408 | 2410 |
| 2409 void BeginTest() override { | 2411 void BeginTest() override { |
| 2410 layer_tree()->SetViewportSize(gfx::Size(20, 20)); | 2412 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); |
| 2411 layer_tree()->set_background_color(SK_ColorGRAY); | 2413 layer_tree_host()->set_background_color(SK_ColorGRAY); |
| 2412 | 2414 |
| 2413 PostSetNeedsCommitToMainThread(); | 2415 PostSetNeedsCommitToMainThread(); |
| 2414 } | 2416 } |
| 2415 | 2417 |
| 2416 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 2418 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
| 2417 frame_++; | 2419 frame_++; |
| 2418 if (frame_ == 1) { | 2420 if (frame_ == 1) { |
| 2419 first_frame_time_ = impl->CurrentBeginFrameArgs().frame_time; | 2421 first_frame_time_ = impl->CurrentBeginFrameArgs().frame_time; |
| 2420 impl->SetNeedsRedraw(); | 2422 impl->SetNeedsRedraw(); |
| 2421 | 2423 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2451 | 2453 |
| 2452 // Verifies that StartPageScaleAnimation events propagate correctly | 2454 // Verifies that StartPageScaleAnimation events propagate correctly |
| 2453 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. | 2455 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. |
| 2454 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { | 2456 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { |
| 2455 public: | 2457 public: |
| 2456 LayerTreeHostTestStartPageScaleAnimation() {} | 2458 LayerTreeHostTestStartPageScaleAnimation() {} |
| 2457 | 2459 |
| 2458 void SetupTree() override { | 2460 void SetupTree() override { |
| 2459 LayerTreeHostTest::SetupTree(); | 2461 LayerTreeHostTest::SetupTree(); |
| 2460 | 2462 |
| 2461 Layer* root_layer = layer_tree()->root_layer(); | 2463 Layer* root_layer = layer_tree_host()->root_layer(); |
| 2462 | 2464 |
| 2463 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(&client_); | 2465 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(&client_); |
| 2464 layer->set_always_update_resources(true); | 2466 layer->set_always_update_resources(true); |
| 2465 scroll_layer_ = layer; | 2467 scroll_layer_ = layer; |
| 2466 | 2468 |
| 2467 scroll_layer_->SetBounds(gfx::Size(2 * root_layer->bounds().width(), | 2469 scroll_layer_->SetBounds(gfx::Size(2 * root_layer->bounds().width(), |
| 2468 2 * root_layer->bounds().height())); | 2470 2 * root_layer->bounds().height())); |
| 2469 scroll_layer_->SetScrollOffset(gfx::ScrollOffset()); | 2471 scroll_layer_->SetScrollOffset(gfx::ScrollOffset()); |
| 2470 | 2472 |
| 2471 CreateVirtualViewportLayers(root_layer, scroll_layer_, root_layer->bounds(), | 2473 CreateVirtualViewportLayers(root_layer, scroll_layer_, root_layer->bounds(), |
| 2472 root_layer->bounds(), layer_tree_host()); | 2474 root_layer->bounds(), layer_tree_host()); |
| 2473 | 2475 |
| 2474 layer_tree()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); | 2476 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); |
| 2475 client_.set_bounds(root_layer->bounds()); | 2477 client_.set_bounds(root_layer->bounds()); |
| 2476 } | 2478 } |
| 2477 | 2479 |
| 2478 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2480 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 2479 | 2481 |
| 2480 void ApplyViewportDeltas(const gfx::Vector2dF& scroll_delta, | 2482 void ApplyViewportDeltas(const gfx::Vector2dF& scroll_delta, |
| 2481 const gfx::Vector2dF&, | 2483 const gfx::Vector2dF&, |
| 2482 const gfx::Vector2dF& elastic_overscroll_delta, | 2484 const gfx::Vector2dF& elastic_overscroll_delta, |
| 2483 float scale, | 2485 float scale, |
| 2484 float) override { | 2486 float) override { |
| 2485 gfx::ScrollOffset offset = scroll_layer_->scroll_offset(); | 2487 gfx::ScrollOffset offset = scroll_layer_->scroll_offset(); |
| 2486 scroll_layer_->SetScrollOffset(ScrollOffsetWithDelta(offset, scroll_delta)); | 2488 scroll_layer_->SetScrollOffset(ScrollOffsetWithDelta(offset, scroll_delta)); |
| 2487 layer_tree()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f); | 2489 layer_tree_host()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f); |
| 2488 } | 2490 } |
| 2489 | 2491 |
| 2490 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 2492 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
| 2491 // We get one commit before the first draw, and the animation doesn't happen | 2493 // We get one commit before the first draw, and the animation doesn't happen |
| 2492 // until the second draw. | 2494 // until the second draw. |
| 2493 switch (impl->active_tree()->source_frame_number()) { | 2495 switch (impl->active_tree()->source_frame_number()) { |
| 2494 case 0: | 2496 case 0: |
| 2495 EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor()); | 2497 EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor()); |
| 2496 // We'll start an animation when we get back to the main thread. | 2498 // We'll start an animation when we get back to the main thread. |
| 2497 break; | 2499 break; |
| 2498 case 1: | 2500 case 1: |
| 2499 EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor()); | 2501 EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor()); |
| 2500 break; | 2502 break; |
| 2501 case 2: | 2503 case 2: |
| 2502 EXPECT_EQ(1.25f, impl->active_tree()->current_page_scale_factor()); | 2504 EXPECT_EQ(1.25f, impl->active_tree()->current_page_scale_factor()); |
| 2503 EndTest(); | 2505 EndTest(); |
| 2504 break; | 2506 break; |
| 2505 case 3: | 2507 case 3: |
| 2506 break; | 2508 break; |
| 2507 default: | 2509 default: |
| 2508 NOTREACHED(); | 2510 NOTREACHED(); |
| 2509 } | 2511 } |
| 2510 } | 2512 } |
| 2511 | 2513 |
| 2512 void DidCommitAndDrawFrame() override { | 2514 void DidCommitAndDrawFrame() override { |
| 2513 switch (layer_tree_host()->SourceFrameNumber()) { | 2515 switch (layer_tree_host()->SourceFrameNumber()) { |
| 2514 case 1: | 2516 case 1: |
| 2515 layer_tree()->StartPageScaleAnimation(gfx::Vector2d(), false, 1.25f, | 2517 layer_tree_host()->StartPageScaleAnimation(gfx::Vector2d(), false, |
| 2516 base::TimeDelta()); | 2518 1.25f, base::TimeDelta()); |
| 2517 break; | 2519 break; |
| 2518 } | 2520 } |
| 2519 } | 2521 } |
| 2520 | 2522 |
| 2521 void AfterTest() override {} | 2523 void AfterTest() override {} |
| 2522 | 2524 |
| 2523 FakeContentLayerClient client_; | 2525 FakeContentLayerClient client_; |
| 2524 scoped_refptr<Layer> scroll_layer_; | 2526 scoped_refptr<Layer> scroll_layer_; |
| 2525 }; | 2527 }; |
| 2526 | 2528 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2560 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers | 2562 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers |
| 2561 : public LayerTreeHostTest { | 2563 : public LayerTreeHostTest { |
| 2562 public: | 2564 public: |
| 2563 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {} | 2565 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {} |
| 2564 | 2566 |
| 2565 void BeginTest() override { | 2567 void BeginTest() override { |
| 2566 client_.set_fill_with_nonsolid_color(true); | 2568 client_.set_fill_with_nonsolid_color(true); |
| 2567 root_layer_ = FakePictureLayer::Create(&client_); | 2569 root_layer_ = FakePictureLayer::Create(&client_); |
| 2568 child_layer_ = FakePictureLayer::Create(&client_); | 2570 child_layer_ = FakePictureLayer::Create(&client_); |
| 2569 | 2571 |
| 2570 layer_tree()->SetViewportSize(gfx::Size(60, 60)); | 2572 layer_tree_host()->SetViewportSize(gfx::Size(60, 60)); |
| 2571 layer_tree()->SetDeviceScaleFactor(1.5); | 2573 layer_tree_host()->SetDeviceScaleFactor(1.5); |
| 2572 EXPECT_EQ(gfx::Size(60, 60), layer_tree()->device_viewport_size()); | 2574 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size()); |
| 2573 | 2575 |
| 2574 root_layer_->AddChild(child_layer_); | 2576 root_layer_->AddChild(child_layer_); |
| 2575 | 2577 |
| 2576 root_layer_->SetIsDrawable(true); | 2578 root_layer_->SetIsDrawable(true); |
| 2577 root_layer_->SetBounds(gfx::Size(30, 30)); | 2579 root_layer_->SetBounds(gfx::Size(30, 30)); |
| 2578 | 2580 |
| 2579 child_layer_->SetIsDrawable(true); | 2581 child_layer_->SetIsDrawable(true); |
| 2580 child_layer_->SetPosition(gfx::PointF(2.f, 2.f)); | 2582 child_layer_->SetPosition(gfx::PointF(2.f, 2.f)); |
| 2581 child_layer_->SetBounds(gfx::Size(10, 10)); | 2583 child_layer_->SetBounds(gfx::Size(10, 10)); |
| 2582 client_.set_bounds(gfx::Size(10, 10)); | 2584 client_.set_bounds(gfx::Size(10, 10)); |
| 2583 | 2585 |
| 2584 layer_tree()->SetRootLayer(root_layer_); | 2586 layer_tree_host()->SetRootLayer(root_layer_); |
| 2585 | 2587 |
| 2586 PostSetNeedsCommitToMainThread(); | 2588 PostSetNeedsCommitToMainThread(); |
| 2587 client_.set_bounds(root_layer_->bounds()); | 2589 client_.set_bounds(root_layer_->bounds()); |
| 2588 } | 2590 } |
| 2589 | 2591 |
| 2590 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 2592 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
| 2591 // Should only do one commit. | 2593 // Should only do one commit. |
| 2592 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); | 2594 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); |
| 2593 // Device scale factor should come over to impl. | 2595 // Device scale factor should come over to impl. |
| 2594 EXPECT_NEAR(impl->active_tree()->device_scale_factor(), 1.5f, 0.00001f); | 2596 EXPECT_NEAR(impl->active_tree()->device_scale_factor(), 1.5f, 0.00001f); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2658 }; | 2660 }; |
| 2659 | 2661 |
| 2660 MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers); | 2662 MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers); |
| 2661 | 2663 |
| 2662 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { | 2664 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { |
| 2663 public: | 2665 public: |
| 2664 LayerTreeHostTestContinuousInvalidate() | 2666 LayerTreeHostTestContinuousInvalidate() |
| 2665 : num_commit_complete_(0), num_draw_layers_(0) {} | 2667 : num_commit_complete_(0), num_draw_layers_(0) {} |
| 2666 | 2668 |
| 2667 void BeginTest() override { | 2669 void BeginTest() override { |
| 2668 layer_tree()->SetViewportSize(gfx::Size(10, 10)); | 2670 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); |
| 2669 layer_tree()->root_layer()->SetBounds(gfx::Size(10, 10)); | 2671 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); |
| 2670 | 2672 |
| 2671 layer_ = FakePictureLayer::Create(&client_); | 2673 layer_ = FakePictureLayer::Create(&client_); |
| 2672 layer_->SetBounds(gfx::Size(10, 10)); | 2674 layer_->SetBounds(gfx::Size(10, 10)); |
| 2673 layer_->SetPosition(gfx::PointF(0.f, 0.f)); | 2675 layer_->SetPosition(gfx::PointF(0.f, 0.f)); |
| 2674 layer_->SetIsDrawable(true); | 2676 layer_->SetIsDrawable(true); |
| 2675 layer_tree()->root_layer()->AddChild(layer_); | 2677 layer_tree_host()->root_layer()->AddChild(layer_); |
| 2676 | 2678 |
| 2677 PostSetNeedsCommitToMainThread(); | 2679 PostSetNeedsCommitToMainThread(); |
| 2678 client_.set_bounds(layer_->bounds()); | 2680 client_.set_bounds(layer_->bounds()); |
| 2679 } | 2681 } |
| 2680 | 2682 |
| 2681 void DidCommitAndDrawFrame() override { | 2683 void DidCommitAndDrawFrame() override { |
| 2682 if (num_draw_layers_ == 2) | 2684 if (num_draw_layers_ == 2) |
| 2683 return; | 2685 return; |
| 2684 layer_->SetNeedsDisplay(); | 2686 layer_->SetNeedsDisplay(); |
| 2685 } | 2687 } |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2841 public: | 2843 public: |
| 2842 void SetupTree() override { | 2844 void SetupTree() override { |
| 2843 num_tiles_rastered_ = 0; | 2845 num_tiles_rastered_ = 0; |
| 2844 | 2846 |
| 2845 scoped_refptr<Layer> root_layer = PictureLayer::Create(&client_); | 2847 scoped_refptr<Layer> root_layer = PictureLayer::Create(&client_); |
| 2846 client_.set_fill_with_nonsolid_color(true); | 2848 client_.set_fill_with_nonsolid_color(true); |
| 2847 root_layer->SetIsDrawable(true); | 2849 root_layer->SetIsDrawable(true); |
| 2848 root_layer->SetBounds(gfx::Size(10, 10)); | 2850 root_layer->SetBounds(gfx::Size(10, 10)); |
| 2849 root_layer->SetContentsOpaque(true); | 2851 root_layer->SetContentsOpaque(true); |
| 2850 | 2852 |
| 2851 layer_tree()->SetRootLayer(root_layer); | 2853 layer_tree_host()->SetRootLayer(root_layer); |
| 2852 | 2854 |
| 2853 // The expectations are based on the assumption that the default | 2855 // The expectations are based on the assumption that the default |
| 2854 // LCD settings are: | 2856 // LCD settings are: |
| 2855 EXPECT_TRUE(layer_tree_host()->GetSettings().can_use_lcd_text); | 2857 EXPECT_TRUE(layer_tree_host()->GetSettings().can_use_lcd_text); |
| 2856 | 2858 |
| 2857 LayerTreeHostTest::SetupTree(); | 2859 LayerTreeHostTest::SetupTree(); |
| 2858 client_.set_bounds(root_layer->bounds()); | 2860 client_.set_bounds(root_layer->bounds()); |
| 2859 } | 2861 } |
| 2860 | 2862 |
| 2861 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2863 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 2862 | 2864 |
| 2863 void DidCommitAndDrawFrame() override { | 2865 void DidCommitAndDrawFrame() override { |
| 2864 switch (layer_tree_host()->SourceFrameNumber()) { | 2866 switch (layer_tree_host()->SourceFrameNumber()) { |
| 2865 case 1: | 2867 case 1: |
| 2866 PostSetNeedsCommitToMainThread(); | 2868 PostSetNeedsCommitToMainThread(); |
| 2867 break; | 2869 break; |
| 2868 case 2: | 2870 case 2: |
| 2869 // Change layer opacity that should trigger lcd change. | 2871 // Change layer opacity that should trigger lcd change. |
| 2870 layer_tree()->root_layer()->SetOpacity(.5f); | 2872 layer_tree_host()->root_layer()->SetOpacity(.5f); |
| 2871 break; | 2873 break; |
| 2872 case 3: | 2874 case 3: |
| 2873 // Change layer opacity that should not trigger lcd change. | 2875 // Change layer opacity that should not trigger lcd change. |
| 2874 layer_tree()->root_layer()->SetOpacity(1.f); | 2876 layer_tree_host()->root_layer()->SetOpacity(1.f); |
| 2875 break; | 2877 break; |
| 2876 case 4: | 2878 case 4: |
| 2877 EndTest(); | 2879 EndTest(); |
| 2878 break; | 2880 break; |
| 2879 } | 2881 } |
| 2880 } | 2882 } |
| 2881 | 2883 |
| 2882 void NotifyTileStateChangedOnThread(LayerTreeHostImpl* host_impl, | 2884 void NotifyTileStateChangedOnThread(LayerTreeHostImpl* host_impl, |
| 2883 const Tile* tile) override { | 2885 const Tile* tile) override { |
| 2884 ++num_tiles_rastered_; | 2886 ++num_tiles_rastered_; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3075 | 3077 |
| 3076 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation | 3078 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation |
| 3077 : public LayerTreeHostTest { | 3079 : public LayerTreeHostTest { |
| 3078 protected: | 3080 protected: |
| 3079 void SetupTree() override { | 3081 void SetupTree() override { |
| 3080 LayerTreeHostTest::SetupTree(); | 3082 LayerTreeHostTest::SetupTree(); |
| 3081 | 3083 |
| 3082 scoped_refptr<Layer> layer = PictureLayer::Create(&client_); | 3084 scoped_refptr<Layer> layer = PictureLayer::Create(&client_); |
| 3083 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); | 3085 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); |
| 3084 layer->SetBounds(gfx::Size(10, 10)); | 3086 layer->SetBounds(gfx::Size(10, 10)); |
| 3085 layer_tree()->root_layer()->AddChild(layer); | 3087 layer_tree_host()->root_layer()->AddChild(layer); |
| 3086 client_.set_bounds(layer->bounds()); | 3088 client_.set_bounds(layer->bounds()); |
| 3087 } | 3089 } |
| 3088 | 3090 |
| 3089 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 3091 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 3090 | 3092 |
| 3091 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 3093 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
| 3092 EndTest(); | 3094 EndTest(); |
| 3093 } | 3095 } |
| 3094 | 3096 |
| 3095 void AfterTest() override {} | 3097 void AfterTest() override {} |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3111 // Round 2: commit only (no draw/swap) | 3113 // Round 2: commit only (no draw/swap) |
| 3112 // Round 3: draw only (no commit) | 3114 // Round 3: draw only (no commit) |
| 3113 | 3115 |
| 3114 void DidCommit() override { | 3116 void DidCommit() override { |
| 3115 int commit = layer_tree_host()->SourceFrameNumber(); | 3117 int commit = layer_tree_host()->SourceFrameNumber(); |
| 3116 switch (commit) { | 3118 switch (commit) { |
| 3117 case 2: | 3119 case 2: |
| 3118 // Round 2 done. | 3120 // Round 2 done. |
| 3119 EXPECT_EQ(1, frame_); | 3121 EXPECT_EQ(1, frame_); |
| 3120 layer_tree_host()->SetNeedsRedrawRect( | 3122 layer_tree_host()->SetNeedsRedrawRect( |
| 3121 gfx::Rect(layer_tree()->device_viewport_size())); | 3123 gfx::Rect(layer_tree_host()->device_viewport_size())); |
| 3122 break; | 3124 break; |
| 3123 } | 3125 } |
| 3124 } | 3126 } |
| 3125 | 3127 |
| 3126 void DidReceiveCompositorFrameAck() override { | 3128 void DidReceiveCompositorFrameAck() override { |
| 3127 int commit = layer_tree_host()->SourceFrameNumber(); | 3129 int commit = layer_tree_host()->SourceFrameNumber(); |
| 3128 ++frame_; | 3130 ++frame_; |
| 3129 switch (frame_) { | 3131 switch (frame_) { |
| 3130 case 1: | 3132 case 1: |
| 3131 // Round 1 done. | 3133 // Round 1 done. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3163 parent_layer_->SetIsDrawable(true); | 3165 parent_layer_->SetIsDrawable(true); |
| 3164 parent_layer_->SetBounds(gfx::Size(50, 50)); | 3166 parent_layer_->SetBounds(gfx::Size(50, 50)); |
| 3165 parent_layer_->SetForceRenderSurfaceForTesting(true); | 3167 parent_layer_->SetForceRenderSurfaceForTesting(true); |
| 3166 | 3168 |
| 3167 child_layer_ = FakePictureLayer::Create(&client_); | 3169 child_layer_ = FakePictureLayer::Create(&client_); |
| 3168 child_layer_->SetIsDrawable(true); | 3170 child_layer_->SetIsDrawable(true); |
| 3169 child_layer_->SetBounds(gfx::Size(50, 50)); | 3171 child_layer_->SetBounds(gfx::Size(50, 50)); |
| 3170 | 3172 |
| 3171 root_layer_->AddChild(parent_layer_); | 3173 root_layer_->AddChild(parent_layer_); |
| 3172 parent_layer_->AddChild(child_layer_); | 3174 parent_layer_->AddChild(child_layer_); |
| 3173 layer_tree()->SetRootLayer(root_layer_); | 3175 layer_tree_host()->SetRootLayer(root_layer_); |
| 3174 | 3176 |
| 3175 LayerTreeHostTest::SetupTree(); | 3177 LayerTreeHostTest::SetupTree(); |
| 3176 client_.set_bounds(root_layer_->bounds()); | 3178 client_.set_bounds(root_layer_->bounds()); |
| 3177 } | 3179 } |
| 3178 | 3180 |
| 3179 std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( | 3181 std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( |
| 3180 scoped_refptr<ContextProvider> compositor_context_provider, | 3182 scoped_refptr<ContextProvider> compositor_context_provider, |
| 3181 scoped_refptr<ContextProvider> worker_context_provider) override { | 3183 scoped_refptr<ContextProvider> worker_context_provider) override { |
| 3182 auto on_draw_callback = | 3184 auto on_draw_callback = |
| 3183 base::Bind(&LayerTreeHostTestResourcelessSoftwareDraw::CallOnDraw, | 3185 base::Bind(&LayerTreeHostTestResourcelessSoftwareDraw::CallOnDraw, |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3397 EXPECT_EQ(expected_push_properties_other_root_, | 3399 EXPECT_EQ(expected_push_properties_other_root_, |
| 3398 other_root_->push_properties_count()) | 3400 other_root_->push_properties_count()) |
| 3399 << "num_commits: " << num_commits_; | 3401 << "num_commits: " << num_commits_; |
| 3400 EXPECT_EQ(expected_push_properties_leaf_layer_, | 3402 EXPECT_EQ(expected_push_properties_leaf_layer_, |
| 3401 leaf_always_pushing_layer_->push_properties_count()) | 3403 leaf_always_pushing_layer_->push_properties_count()) |
| 3402 << "num_commits: " << num_commits_; | 3404 << "num_commits: " << num_commits_; |
| 3403 | 3405 |
| 3404 ++num_commits_; | 3406 ++num_commits_; |
| 3405 | 3407 |
| 3406 // The scrollbar layer always needs to be pushed. | 3408 // The scrollbar layer always needs to be pushed. |
| 3407 if (root_->GetLayerTree()) { | 3409 if (root_->layer_tree_host()) { |
| 3408 EXPECT_FALSE(root_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( | 3410 EXPECT_FALSE(root_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3409 root_.get())); | 3411 root_.get())); |
| 3410 } | 3412 } |
| 3411 if (child2_->GetLayerTree()) { | 3413 if (child2_->layer_tree_host()) { |
| 3412 EXPECT_FALSE(child2_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( | 3414 EXPECT_FALSE( |
| 3413 child2_.get())); | 3415 child2_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3416 child2_.get())); |
| 3414 } | 3417 } |
| 3415 if (leaf_always_pushing_layer_->GetLayerTree()) { | 3418 if (leaf_always_pushing_layer_->layer_tree_host()) { |
| 3416 EXPECT_TRUE(leaf_always_pushing_layer_->GetLayerTree() | 3419 EXPECT_TRUE(leaf_always_pushing_layer_->layer_tree_host() |
| 3417 ->LayerNeedsPushPropertiesForTesting( | 3420 ->LayerNeedsPushPropertiesForTesting( |
| 3418 leaf_always_pushing_layer_.get())); | 3421 leaf_always_pushing_layer_.get())); |
| 3419 } | 3422 } |
| 3420 | 3423 |
| 3421 // child_ and grandchild_ don't persist their need to push properties. | 3424 // child_ and grandchild_ don't persist their need to push properties. |
| 3422 if (child_->GetLayerTree()) { | 3425 if (child_->layer_tree_host()) { |
| 3423 EXPECT_FALSE(child_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( | 3426 EXPECT_FALSE( |
| 3424 child_.get())); | 3427 child_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3428 child_.get())); |
| 3425 } | 3429 } |
| 3426 if (grandchild_->GetLayerTree()) { | 3430 if (grandchild_->layer_tree_host()) { |
| 3427 EXPECT_FALSE( | 3431 EXPECT_FALSE( |
| 3428 grandchild_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( | 3432 grandchild_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3429 grandchild_.get())); | 3433 grandchild_.get())); |
| 3430 } | 3434 } |
| 3431 | 3435 |
| 3432 if (other_root_->GetLayerTree()) { | 3436 if (other_root_->layer_tree_host()) { |
| 3433 EXPECT_FALSE( | 3437 EXPECT_FALSE( |
| 3434 other_root_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( | 3438 other_root_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3435 other_root_.get())); | 3439 other_root_.get())); |
| 3436 } | 3440 } |
| 3437 | 3441 |
| 3438 switch (num_commits_) { | 3442 switch (num_commits_) { |
| 3439 case 1: | 3443 case 1: |
| 3440 layer_tree()->SetRootLayer(root_); | 3444 layer_tree_host()->SetRootLayer(root_); |
| 3441 // Layers added to the tree get committed. | 3445 // Layers added to the tree get committed. |
| 3442 ++expected_push_properties_root_; | 3446 ++expected_push_properties_root_; |
| 3443 ++expected_push_properties_child_; | 3447 ++expected_push_properties_child_; |
| 3444 ++expected_push_properties_grandchild_; | 3448 ++expected_push_properties_grandchild_; |
| 3445 ++expected_push_properties_child2_; | 3449 ++expected_push_properties_child2_; |
| 3446 break; | 3450 break; |
| 3447 case 2: | 3451 case 2: |
| 3448 layer_tree_host()->SetNeedsCommit(); | 3452 layer_tree_host()->SetNeedsCommit(); |
| 3449 // No layers need commit. | 3453 // No layers need commit. |
| 3450 break; | 3454 break; |
| 3451 case 3: | 3455 case 3: |
| 3452 layer_tree()->SetRootLayer(other_root_); | 3456 layer_tree_host()->SetRootLayer(other_root_); |
| 3453 // Layers added to the tree get committed. | 3457 // Layers added to the tree get committed. |
| 3454 ++expected_push_properties_other_root_; | 3458 ++expected_push_properties_other_root_; |
| 3455 break; | 3459 break; |
| 3456 case 4: | 3460 case 4: |
| 3457 layer_tree()->SetRootLayer(root_); | 3461 layer_tree_host()->SetRootLayer(root_); |
| 3458 // Layers added to the tree get committed. | 3462 // Layers added to the tree get committed. |
| 3459 ++expected_push_properties_root_; | 3463 ++expected_push_properties_root_; |
| 3460 ++expected_push_properties_child_; | 3464 ++expected_push_properties_child_; |
| 3461 ++expected_push_properties_grandchild_; | 3465 ++expected_push_properties_grandchild_; |
| 3462 ++expected_push_properties_child2_; | 3466 ++expected_push_properties_child2_; |
| 3463 break; | 3467 break; |
| 3464 case 5: | 3468 case 5: |
| 3465 layer_tree_host()->SetNeedsCommit(); | 3469 layer_tree_host()->SetNeedsCommit(); |
| 3466 // No layers need commit. | 3470 // No layers need commit. |
| 3467 break; | 3471 break; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3478 case 8: | 3482 case 8: |
| 3479 grandchild_->RemoveFromParent(); | 3483 grandchild_->RemoveFromParent(); |
| 3480 // No layers need commit. | 3484 // No layers need commit. |
| 3481 break; | 3485 break; |
| 3482 case 9: | 3486 case 9: |
| 3483 child_->AddChild(grandchild_); | 3487 child_->AddChild(grandchild_); |
| 3484 // Layers added to the tree get committed. | 3488 // Layers added to the tree get committed. |
| 3485 ++expected_push_properties_grandchild_; | 3489 ++expected_push_properties_grandchild_; |
| 3486 break; | 3490 break; |
| 3487 case 10: | 3491 case 10: |
| 3488 layer_tree()->SetViewportSize(gfx::Size(20, 20)); | 3492 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); |
| 3489 // No layers need commit. | 3493 // No layers need commit. |
| 3490 break; | 3494 break; |
| 3491 case 11: | 3495 case 11: |
| 3492 layer_tree()->SetPageScaleFactorAndLimits(1.f, 0.8f, 1.1f); | 3496 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.8f, 1.1f); |
| 3493 // No layers need commit. | 3497 // No layers need commit. |
| 3494 break; | 3498 break; |
| 3495 case 12: | 3499 case 12: |
| 3496 child_->MakePushProperties(); | 3500 child_->MakePushProperties(); |
| 3497 // The modified layer needs commit | 3501 // The modified layer needs commit |
| 3498 ++expected_push_properties_child_; | 3502 ++expected_push_properties_child_; |
| 3499 ++expected_push_properties_grandchild_; | 3503 ++expected_push_properties_grandchild_; |
| 3500 break; | 3504 break; |
| 3501 case 13: | 3505 case 13: |
| 3502 child2_->MakePushProperties(); | 3506 child2_->MakePushProperties(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3521 child_->SetNeedsDisplay(); | 3525 child_->SetNeedsDisplay(); |
| 3522 ++expected_push_properties_child_; | 3526 ++expected_push_properties_child_; |
| 3523 layer_tree_host()->SetNeedsCommit(); | 3527 layer_tree_host()->SetNeedsCommit(); |
| 3524 break; | 3528 break; |
| 3525 case 17: | 3529 case 17: |
| 3526 EndTest(); | 3530 EndTest(); |
| 3527 break; | 3531 break; |
| 3528 } | 3532 } |
| 3529 | 3533 |
| 3530 // The leaf layer always pushes. | 3534 // The leaf layer always pushes. |
| 3531 if (leaf_always_pushing_layer_->GetLayerTree()) | 3535 if (leaf_always_pushing_layer_->layer_tree_host()) |
| 3532 ++expected_push_properties_leaf_layer_; | 3536 ++expected_push_properties_leaf_layer_; |
| 3533 } | 3537 } |
| 3534 | 3538 |
| 3535 void AfterTest() override {} | 3539 void AfterTest() override {} |
| 3536 | 3540 |
| 3537 int num_commits_; | 3541 int num_commits_; |
| 3538 FakeContentLayerClient client_; | 3542 FakeContentLayerClient client_; |
| 3539 scoped_refptr<PushPropertiesCountingLayer> root_; | 3543 scoped_refptr<PushPropertiesCountingLayer> root_; |
| 3540 scoped_refptr<PushPropertiesCountingLayer> child_; | 3544 scoped_refptr<PushPropertiesCountingLayer> child_; |
| 3541 scoped_refptr<PushPropertiesCountingLayer> child2_; | 3545 scoped_refptr<PushPropertiesCountingLayer> child2_; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3757 root_ = Layer::Create(); | 3761 root_ = Layer::Create(); |
| 3758 root_->SetBounds(gfx::Size(1, 1)); | 3762 root_->SetBounds(gfx::Size(1, 1)); |
| 3759 | 3763 |
| 3760 bool paint_scrollbar = true; | 3764 bool paint_scrollbar = true; |
| 3761 bool has_thumb = false; | 3765 bool has_thumb = false; |
| 3762 scrollbar_layer_ = FakePaintedScrollbarLayer::Create( | 3766 scrollbar_layer_ = FakePaintedScrollbarLayer::Create( |
| 3763 paint_scrollbar, has_thumb, root_->id()); | 3767 paint_scrollbar, has_thumb, root_->id()); |
| 3764 | 3768 |
| 3765 root_->AddChild(scrollbar_layer_); | 3769 root_->AddChild(scrollbar_layer_); |
| 3766 | 3770 |
| 3767 layer_tree()->SetRootLayer(root_); | 3771 layer_tree_host()->SetRootLayer(root_); |
| 3768 LayerTreeHostTest::SetupTree(); | 3772 LayerTreeHostTest::SetupTree(); |
| 3769 } | 3773 } |
| 3770 | 3774 |
| 3771 void DidCommitAndDrawFrame() override { | 3775 void DidCommitAndDrawFrame() override { |
| 3772 switch (layer_tree_host()->SourceFrameNumber()) { | 3776 switch (layer_tree_host()->SourceFrameNumber()) { |
| 3773 case 0: | 3777 case 0: |
| 3774 break; | 3778 break; |
| 3775 case 1: { | 3779 case 1: { |
| 3776 // During update, the ignore_set_needs_commit_ bit is set to true to | 3780 // During update, the ignore_set_needs_commit_ bit is set to true to |
| 3777 // avoid causing a second commit to be scheduled. If a property change | 3781 // avoid causing a second commit to be scheduled. If a property change |
| 3778 // is made during this, however, it needs to be pushed in the upcoming | 3782 // is made during this, however, it needs to be pushed in the upcoming |
| 3779 // commit. | 3783 // commit. |
| 3780 std::unique_ptr<base::AutoReset<bool>> ignore = | 3784 std::unique_ptr<base::AutoReset<bool>> ignore = |
| 3781 scrollbar_layer_->IgnoreSetNeedsCommit(); | 3785 scrollbar_layer_->IgnoreSetNeedsCommit(); |
| 3782 | 3786 |
| 3783 scrollbar_layer_->SetBounds(gfx::Size(30, 30)); | 3787 scrollbar_layer_->SetBounds(gfx::Size(30, 30)); |
| 3784 | 3788 |
| 3785 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3789 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3786 scrollbar_layer_.get())); | 3790 scrollbar_layer_.get())); |
| 3787 layer_tree_host()->SetNeedsCommit(); | 3791 layer_tree_host()->SetNeedsCommit(); |
| 3788 | 3792 |
| 3789 scrollbar_layer_->reset_push_properties_count(); | 3793 scrollbar_layer_->reset_push_properties_count(); |
| 3790 EXPECT_EQ(0u, scrollbar_layer_->push_properties_count()); | 3794 EXPECT_EQ(0u, scrollbar_layer_->push_properties_count()); |
| 3791 break; | 3795 break; |
| 3792 } | 3796 } |
| 3793 case 2: | 3797 case 2: |
| 3794 EXPECT_EQ(1u, scrollbar_layer_->push_properties_count()); | 3798 EXPECT_EQ(1u, scrollbar_layer_->push_properties_count()); |
| 3795 EndTest(); | 3799 EndTest(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 3807 | 3811 |
| 3808 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { | 3812 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { |
| 3809 protected: | 3813 protected: |
| 3810 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 3814 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 3811 | 3815 |
| 3812 void SetupTree() override { | 3816 void SetupTree() override { |
| 3813 root_ = PushPropertiesCountingLayer::Create(); | 3817 root_ = PushPropertiesCountingLayer::Create(); |
| 3814 child_ = PushPropertiesCountingLayer::Create(); | 3818 child_ = PushPropertiesCountingLayer::Create(); |
| 3815 root_->AddChild(child_); | 3819 root_->AddChild(child_); |
| 3816 | 3820 |
| 3817 layer_tree()->SetRootLayer(root_); | 3821 layer_tree_host()->SetRootLayer(root_); |
| 3818 LayerTreeHostTest::SetupTree(); | 3822 LayerTreeHostTest::SetupTree(); |
| 3819 } | 3823 } |
| 3820 | 3824 |
| 3821 void DidCommitAndDrawFrame() override { | 3825 void DidCommitAndDrawFrame() override { |
| 3822 switch (layer_tree_host()->SourceFrameNumber()) { | 3826 switch (layer_tree_host()->SourceFrameNumber()) { |
| 3823 case 0: | 3827 case 0: |
| 3824 break; | 3828 break; |
| 3825 case 1: { | 3829 case 1: { |
| 3826 // During update, the ignore_set_needs_commit_ bit is set to true to | 3830 // During update, the ignore_set_needs_commit_ bit is set to true to |
| 3827 // avoid causing a second commit to be scheduled. If a property change | 3831 // avoid causing a second commit to be scheduled. If a property change |
| 3828 // is made during this, however, it needs to be pushed in the upcoming | 3832 // is made during this, however, it needs to be pushed in the upcoming |
| 3829 // commit. | 3833 // commit. |
| 3830 EXPECT_FALSE( | 3834 EXPECT_FALSE( |
| 3831 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3835 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3832 EXPECT_FALSE( | 3836 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3833 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3837 child_.get())); |
| 3834 EXPECT_EQ(0, root_->NumDescendantsThatDrawContent()); | 3838 EXPECT_EQ(0, root_->NumDescendantsThatDrawContent()); |
| 3835 root_->reset_push_properties_count(); | 3839 root_->reset_push_properties_count(); |
| 3836 child_->reset_push_properties_count(); | 3840 child_->reset_push_properties_count(); |
| 3837 child_->SetIsDrawable(true); | 3841 child_->SetIsDrawable(true); |
| 3838 EXPECT_EQ(1, root_->NumDescendantsThatDrawContent()); | 3842 EXPECT_EQ(1, root_->NumDescendantsThatDrawContent()); |
| 3839 EXPECT_EQ(0u, root_->push_properties_count()); | 3843 EXPECT_EQ(0u, root_->push_properties_count()); |
| 3840 EXPECT_EQ(0u, child_->push_properties_count()); | 3844 EXPECT_EQ(0u, child_->push_properties_count()); |
| 3841 EXPECT_TRUE( | 3845 EXPECT_TRUE( |
| 3842 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3846 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3843 EXPECT_TRUE( | 3847 EXPECT_TRUE( |
| 3844 | 3848 |
| 3845 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3849 layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3850 child_.get())); |
| 3846 break; | 3851 break; |
| 3847 } | 3852 } |
| 3848 case 2: | 3853 case 2: |
| 3849 EXPECT_EQ(1u, root_->push_properties_count()); | 3854 EXPECT_EQ(1u, root_->push_properties_count()); |
| 3850 EXPECT_EQ(1u, child_->push_properties_count()); | 3855 EXPECT_EQ(1u, child_->push_properties_count()); |
| 3851 EXPECT_FALSE( | 3856 EXPECT_FALSE( |
| 3852 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3857 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3853 EXPECT_FALSE( | 3858 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3854 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3859 child_.get())); |
| 3855 EndTest(); | 3860 EndTest(); |
| 3856 break; | 3861 break; |
| 3857 } | 3862 } |
| 3858 } | 3863 } |
| 3859 | 3864 |
| 3860 void AfterTest() override {} | 3865 void AfterTest() override {} |
| 3861 | 3866 |
| 3862 scoped_refptr<PushPropertiesCountingLayer> root_; | 3867 scoped_refptr<PushPropertiesCountingLayer> root_; |
| 3863 scoped_refptr<PushPropertiesCountingLayer> child_; | 3868 scoped_refptr<PushPropertiesCountingLayer> child_; |
| 3864 }; | 3869 }; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3910 }; | 3915 }; |
| 3911 | 3916 |
| 3912 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush | 3917 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush |
| 3913 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3918 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3914 protected: | 3919 protected: |
| 3915 void DidCommitAndDrawFrame() override { | 3920 void DidCommitAndDrawFrame() override { |
| 3916 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; | 3921 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; |
| 3917 switch (last_source_frame_number) { | 3922 switch (last_source_frame_number) { |
| 3918 case 0: | 3923 case 0: |
| 3919 // All layers will need push properties as we set their layer tree host | 3924 // All layers will need push properties as we set their layer tree host |
| 3920 layer_tree()->SetRootLayer(root_); | 3925 layer_tree_host()->SetRootLayer(root_); |
| 3921 EXPECT_TRUE( | 3926 EXPECT_TRUE( |
| 3922 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3927 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3923 EXPECT_TRUE( | 3928 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3924 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3929 child_.get())); |
| 3925 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3930 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3926 grandchild1_.get())); | 3931 grandchild1_.get())); |
| 3927 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3932 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3928 grandchild2_.get())); | 3933 grandchild2_.get())); |
| 3929 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3934 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3930 grandchild3_.get())); | 3935 grandchild3_.get())); |
| 3931 break; | 3936 break; |
| 3932 case 1: | 3937 case 1: |
| 3933 EndTest(); | 3938 EndTest(); |
| 3934 break; | 3939 break; |
| 3935 } | 3940 } |
| 3936 } | 3941 } |
| 3937 }; | 3942 }; |
| 3938 | 3943 |
| 3939 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); | 3944 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); |
| 3940 | 3945 |
| 3941 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion | 3946 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion |
| 3942 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3947 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3943 protected: | 3948 protected: |
| 3944 void DidCommitAndDrawFrame() override { | 3949 void DidCommitAndDrawFrame() override { |
| 3945 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; | 3950 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; |
| 3946 switch (last_source_frame_number) { | 3951 switch (last_source_frame_number) { |
| 3947 case 0: | 3952 case 0: |
| 3948 layer_tree()->SetRootLayer(root_); | 3953 layer_tree_host()->SetRootLayer(root_); |
| 3949 break; | 3954 break; |
| 3950 case 1: | 3955 case 1: |
| 3951 EXPECT_FALSE( | 3956 EXPECT_FALSE( |
| 3952 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3957 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3953 EXPECT_FALSE( | 3958 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3954 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3959 child_.get())); |
| 3955 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3960 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3956 grandchild1_.get())); | 3961 grandchild1_.get())); |
| 3957 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3962 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3958 grandchild2_.get())); | 3963 grandchild2_.get())); |
| 3959 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3964 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3960 grandchild3_.get())); | 3965 grandchild3_.get())); |
| 3961 | 3966 |
| 3962 grandchild1_->RemoveFromParent(); | 3967 grandchild1_->RemoveFromParent(); |
| 3963 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 3968 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3964 | 3969 |
| 3965 EXPECT_FALSE( | 3970 EXPECT_FALSE( |
| 3966 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3971 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3967 EXPECT_FALSE( | 3972 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3968 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3973 child_.get())); |
| 3969 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3974 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3970 grandchild2_.get())); | 3975 grandchild2_.get())); |
| 3971 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3976 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3972 grandchild3_.get())); | 3977 grandchild3_.get())); |
| 3973 | 3978 |
| 3974 child_->AddChild(grandchild1_); | 3979 child_->AddChild(grandchild1_); |
| 3975 | 3980 |
| 3976 EXPECT_FALSE( | 3981 EXPECT_FALSE( |
| 3977 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3982 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3978 EXPECT_FALSE( | 3983 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3979 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3984 child_.get())); |
| 3980 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3985 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3981 grandchild1_.get())); | 3986 grandchild1_.get())); |
| 3982 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3987 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3983 grandchild2_.get())); | 3988 grandchild2_.get())); |
| 3984 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3989 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3985 grandchild3_.get())); | 3990 grandchild3_.get())); |
| 3986 | 3991 |
| 3987 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 3992 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3988 | 3993 |
| 3989 EXPECT_FALSE( | 3994 EXPECT_FALSE( |
| 3990 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3995 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3991 EXPECT_FALSE( | 3996 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3992 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3997 child_.get())); |
| 3993 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3998 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3994 grandchild1_.get())); | 3999 grandchild1_.get())); |
| 3995 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 4000 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3996 grandchild2_.get())); | 4001 grandchild2_.get())); |
| 3997 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 4002 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3998 grandchild3_.get())); | 4003 grandchild3_.get())); |
| 3999 | 4004 |
| 4000 // grandchild2_ will still need a push properties. | 4005 // grandchild2_ will still need a push properties. |
| 4001 grandchild1_->RemoveFromParent(); | 4006 grandchild1_->RemoveFromParent(); |
| 4002 | 4007 |
| 4003 EXPECT_FALSE( | 4008 EXPECT_FALSE( |
| 4004 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 4009 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4005 EXPECT_FALSE( | 4010 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4006 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 4011 child_.get())); |
| 4007 | 4012 |
| 4008 // grandchild3_ does not need a push properties, so recursing should | 4013 // grandchild3_ does not need a push properties, so recursing should |
| 4009 // no longer be needed. | 4014 // no longer be needed. |
| 4010 grandchild2_->RemoveFromParent(); | 4015 grandchild2_->RemoveFromParent(); |
| 4011 | 4016 |
| 4012 EXPECT_FALSE( | 4017 EXPECT_FALSE( |
| 4013 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 4018 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4014 EXPECT_FALSE( | 4019 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4015 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 4020 child_.get())); |
| 4016 EndTest(); | 4021 EndTest(); |
| 4017 break; | 4022 break; |
| 4018 } | 4023 } |
| 4019 } | 4024 } |
| 4020 }; | 4025 }; |
| 4021 | 4026 |
| 4022 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); | 4027 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); |
| 4023 | 4028 |
| 4024 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence | 4029 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence |
| 4025 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 4030 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 4026 protected: | 4031 protected: |
| 4027 void DidCommitAndDrawFrame() override { | 4032 void DidCommitAndDrawFrame() override { |
| 4028 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | |
| 4029 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; | 4033 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; |
| 4030 switch (last_source_frame_number) { | 4034 switch (last_source_frame_number) { |
| 4031 case 0: | 4035 case 0: |
| 4032 layer_tree->SetRootLayer(root_); | 4036 layer_tree_host()->SetRootLayer(root_); |
| 4033 grandchild1_->set_persist_needs_push_properties(true); | 4037 grandchild1_->set_persist_needs_push_properties(true); |
| 4034 grandchild2_->set_persist_needs_push_properties(true); | 4038 grandchild2_->set_persist_needs_push_properties(true); |
| 4035 break; | 4039 break; |
| 4036 case 1: | 4040 case 1: |
| 4037 EXPECT_FALSE( | 4041 EXPECT_FALSE( |
| 4038 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4042 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4039 EXPECT_FALSE( | 4043 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4040 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4044 child_.get())); |
| 4041 EXPECT_TRUE( | 4045 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4042 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | 4046 grandchild1_.get())); |
| 4043 EXPECT_TRUE( | 4047 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4044 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | 4048 grandchild2_.get())); |
| 4045 EXPECT_FALSE( | 4049 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4046 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); | 4050 grandchild3_.get())); |
| 4047 | 4051 |
| 4048 // grandchild2_ will still need a push properties. | 4052 // grandchild2_ will still need a push properties. |
| 4049 grandchild1_->RemoveFromParent(); | 4053 grandchild1_->RemoveFromParent(); |
| 4050 | 4054 |
| 4051 EXPECT_FALSE( | 4055 EXPECT_FALSE( |
| 4052 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4056 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4053 EXPECT_FALSE( | 4057 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4054 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4058 child_.get())); |
| 4055 | 4059 |
| 4056 // grandchild3_ does not need a push properties, so recursing should | 4060 // grandchild3_ does not need a push properties, so recursing should |
| 4057 // no longer be needed. | 4061 // no longer be needed. |
| 4058 grandchild2_->RemoveFromParent(); | 4062 grandchild2_->RemoveFromParent(); |
| 4059 | 4063 |
| 4060 EXPECT_FALSE( | 4064 EXPECT_FALSE( |
| 4061 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4065 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4062 EXPECT_FALSE( | 4066 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4063 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4067 child_.get())); |
| 4064 EndTest(); | 4068 EndTest(); |
| 4065 break; | 4069 break; |
| 4066 } | 4070 } |
| 4067 } | 4071 } |
| 4068 }; | 4072 }; |
| 4069 | 4073 |
| 4070 MULTI_THREAD_TEST_F( | 4074 MULTI_THREAD_TEST_F( |
| 4071 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); | 4075 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); |
| 4072 | 4076 |
| 4073 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree | 4077 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree |
| 4074 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 4078 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 4075 protected: | 4079 protected: |
| 4076 void DidCommitAndDrawFrame() override { | 4080 void DidCommitAndDrawFrame() override { |
| 4077 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | |
| 4078 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; | 4081 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; |
| 4079 switch (last_source_frame_number) { | 4082 switch (last_source_frame_number) { |
| 4080 case 0: | 4083 case 0: |
| 4081 layer_tree->SetRootLayer(root_); | 4084 layer_tree_host()->SetRootLayer(root_); |
| 4082 break; | 4085 break; |
| 4083 case 1: | 4086 case 1: |
| 4084 EXPECT_FALSE( | 4087 EXPECT_FALSE( |
| 4085 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4088 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4086 EXPECT_FALSE( | 4089 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4087 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4090 child_.get())); |
| 4088 EXPECT_FALSE( | 4091 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4089 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | 4092 grandchild1_.get())); |
| 4090 EXPECT_FALSE( | 4093 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4091 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | 4094 grandchild2_.get())); |
| 4092 EXPECT_FALSE( | 4095 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4093 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); | 4096 grandchild3_.get())); |
| 4094 | 4097 |
| 4095 // Change grandchildren while their parent is not in the tree. | 4098 // Change grandchildren while their parent is not in the tree. |
| 4096 child_->RemoveFromParent(); | 4099 child_->RemoveFromParent(); |
| 4097 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 4100 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 4098 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 4101 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 4099 root_->AddChild(child_); | 4102 root_->AddChild(child_); |
| 4100 | 4103 |
| 4101 EXPECT_FALSE( | 4104 EXPECT_FALSE( |
| 4102 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4105 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4103 EXPECT_TRUE( | 4106 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4104 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4107 child_.get())); |
| 4105 EXPECT_TRUE( | 4108 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4106 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | 4109 grandchild1_.get())); |
| 4107 EXPECT_TRUE( | 4110 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4108 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | 4111 grandchild2_.get())); |
| 4109 EXPECT_TRUE( | 4112 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4110 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); | 4113 grandchild3_.get())); |
| 4111 | 4114 |
| 4112 grandchild1_->RemoveFromParent(); | 4115 grandchild1_->RemoveFromParent(); |
| 4113 | 4116 |
| 4114 EXPECT_FALSE( | 4117 EXPECT_FALSE( |
| 4115 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4118 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4116 EXPECT_TRUE( | 4119 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4117 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4120 child_.get())); |
| 4118 | 4121 |
| 4119 grandchild2_->RemoveFromParent(); | 4122 grandchild2_->RemoveFromParent(); |
| 4120 | 4123 |
| 4121 EXPECT_FALSE( | 4124 EXPECT_FALSE( |
| 4122 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4125 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4123 EXPECT_TRUE( | 4126 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4124 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4127 child_.get())); |
| 4125 | 4128 |
| 4126 grandchild3_->RemoveFromParent(); | 4129 grandchild3_->RemoveFromParent(); |
| 4127 | 4130 |
| 4128 EXPECT_FALSE( | 4131 EXPECT_FALSE( |
| 4129 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4132 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4130 EXPECT_TRUE( | 4133 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4131 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4134 child_.get())); |
| 4132 | 4135 |
| 4133 EndTest(); | 4136 EndTest(); |
| 4134 break; | 4137 break; |
| 4135 } | 4138 } |
| 4136 } | 4139 } |
| 4137 }; | 4140 }; |
| 4138 | 4141 |
| 4139 MULTI_THREAD_TEST_F( | 4142 MULTI_THREAD_TEST_F( |
| 4140 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); | 4143 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); |
| 4141 | 4144 |
| 4142 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild | 4145 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild |
| 4143 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 4146 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 4144 protected: | 4147 protected: |
| 4145 void DidCommitAndDrawFrame() override { | 4148 void DidCommitAndDrawFrame() override { |
| 4146 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | |
| 4147 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; | 4149 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; |
| 4148 switch (last_source_frame_number) { | 4150 switch (last_source_frame_number) { |
| 4149 case 0: | 4151 case 0: |
| 4150 layer_tree->SetRootLayer(root_); | 4152 layer_tree_host()->SetRootLayer(root_); |
| 4151 break; | 4153 break; |
| 4152 case 1: | 4154 case 1: |
| 4153 EXPECT_FALSE( | 4155 EXPECT_FALSE( |
| 4154 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4156 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4155 EXPECT_FALSE( | 4157 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4156 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4158 child_.get())); |
| 4157 EXPECT_FALSE( | 4159 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4158 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | 4160 grandchild1_.get())); |
| 4159 EXPECT_FALSE( | 4161 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4160 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | 4162 grandchild2_.get())); |
| 4161 EXPECT_FALSE( | 4163 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4162 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); | 4164 grandchild3_.get())); |
| 4163 | 4165 |
| 4164 child_->SetPosition(gfx::PointF(1.f, 1.f)); | 4166 child_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 4165 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 4167 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 4166 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 4168 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 4167 | 4169 |
| 4168 EXPECT_FALSE( | 4170 EXPECT_FALSE( |
| 4169 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4171 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4170 EXPECT_TRUE( | 4172 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4171 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4173 child_.get())); |
| 4172 EXPECT_TRUE( | 4174 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4173 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | 4175 grandchild1_.get())); |
| 4174 EXPECT_TRUE( | 4176 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4175 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | 4177 grandchild2_.get())); |
| 4176 EXPECT_FALSE( | 4178 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4177 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); | 4179 grandchild3_.get())); |
| 4178 | 4180 |
| 4179 grandchild1_->RemoveFromParent(); | 4181 grandchild1_->RemoveFromParent(); |
| 4180 | 4182 |
| 4181 EXPECT_FALSE( | 4183 EXPECT_FALSE( |
| 4182 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4184 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4183 EXPECT_TRUE( | 4185 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4184 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4186 child_.get())); |
| 4185 | 4187 |
| 4186 grandchild2_->RemoveFromParent(); | 4188 grandchild2_->RemoveFromParent(); |
| 4187 | 4189 |
| 4188 EXPECT_FALSE( | 4190 EXPECT_FALSE( |
| 4189 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4191 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4190 EXPECT_TRUE( | 4192 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4191 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4193 child_.get())); |
| 4192 | 4194 |
| 4193 child_->RemoveFromParent(); | 4195 child_->RemoveFromParent(); |
| 4194 | 4196 |
| 4195 EXPECT_FALSE( | 4197 EXPECT_FALSE( |
| 4196 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4198 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4197 | 4199 |
| 4198 EndTest(); | 4200 EndTest(); |
| 4199 break; | 4201 break; |
| 4200 } | 4202 } |
| 4201 } | 4203 } |
| 4202 }; | 4204 }; |
| 4203 | 4205 |
| 4204 MULTI_THREAD_TEST_F( | 4206 MULTI_THREAD_TEST_F( |
| 4205 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); | 4207 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); |
| 4206 | 4208 |
| 4207 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent | 4209 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent |
| 4208 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 4210 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 4209 protected: | 4211 protected: |
| 4210 void DidCommitAndDrawFrame() override { | 4212 void DidCommitAndDrawFrame() override { |
| 4211 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | |
| 4212 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; | 4213 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; |
| 4213 switch (last_source_frame_number) { | 4214 switch (last_source_frame_number) { |
| 4214 case 0: | 4215 case 0: |
| 4215 layer_tree->SetRootLayer(root_); | 4216 layer_tree_host()->SetRootLayer(root_); |
| 4216 break; | 4217 break; |
| 4217 case 1: | 4218 case 1: |
| 4218 EXPECT_FALSE( | 4219 EXPECT_FALSE( |
| 4219 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4220 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4220 EXPECT_FALSE( | 4221 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4221 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4222 child_.get())); |
| 4222 EXPECT_FALSE( | 4223 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4223 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | 4224 grandchild1_.get())); |
| 4224 EXPECT_FALSE( | 4225 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4225 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | 4226 grandchild2_.get())); |
| 4226 EXPECT_FALSE( | 4227 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4227 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); | 4228 grandchild3_.get())); |
| 4228 | 4229 |
| 4229 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 4230 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 4230 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 4231 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 4231 child_->SetPosition(gfx::PointF(1.f, 1.f)); | 4232 child_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 4232 | 4233 |
| 4233 EXPECT_FALSE( | 4234 EXPECT_FALSE( |
| 4234 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4235 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4235 EXPECT_TRUE( | 4236 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4236 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4237 child_.get())); |
| 4237 EXPECT_TRUE( | 4238 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4238 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | 4239 grandchild1_.get())); |
| 4239 EXPECT_TRUE( | 4240 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4240 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | 4241 grandchild2_.get())); |
| 4241 EXPECT_FALSE( | 4242 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4242 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); | 4243 grandchild3_.get())); |
| 4243 | 4244 |
| 4244 grandchild1_->RemoveFromParent(); | 4245 grandchild1_->RemoveFromParent(); |
| 4245 | 4246 |
| 4246 EXPECT_FALSE( | 4247 EXPECT_FALSE( |
| 4247 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4248 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4248 EXPECT_TRUE( | 4249 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4249 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4250 child_.get())); |
| 4250 | 4251 |
| 4251 grandchild2_->RemoveFromParent(); | 4252 grandchild2_->RemoveFromParent(); |
| 4252 | 4253 |
| 4253 EXPECT_FALSE( | 4254 EXPECT_FALSE( |
| 4254 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4255 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4255 EXPECT_TRUE( | 4256 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4256 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4257 child_.get())); |
| 4257 | 4258 |
| 4258 child_->RemoveFromParent(); | 4259 child_->RemoveFromParent(); |
| 4259 | 4260 |
| 4260 EXPECT_FALSE( | 4261 EXPECT_FALSE( |
| 4261 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4262 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4262 | 4263 |
| 4263 EndTest(); | 4264 EndTest(); |
| 4264 break; | 4265 break; |
| 4265 } | 4266 } |
| 4266 } | 4267 } |
| 4267 }; | 4268 }; |
| 4268 | 4269 |
| 4269 MULTI_THREAD_TEST_F( | 4270 MULTI_THREAD_TEST_F( |
| 4270 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent); | 4271 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent); |
| 4271 | 4272 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4372 // to the compositor thread, even though no resources are updated in | 4373 // to the compositor thread, even though no resources are updated in |
| 4373 // response to that invalidation. | 4374 // response to that invalidation. |
| 4374 class LayerTreeHostTestVideoLayerInvalidate : public LayerInvalidateCausesDraw { | 4375 class LayerTreeHostTestVideoLayerInvalidate : public LayerInvalidateCausesDraw { |
| 4375 public: | 4376 public: |
| 4376 void SetupTree() override { | 4377 void SetupTree() override { |
| 4377 LayerTreeHostTest::SetupTree(); | 4378 LayerTreeHostTest::SetupTree(); |
| 4378 scoped_refptr<VideoLayer> video_layer = | 4379 scoped_refptr<VideoLayer> video_layer = |
| 4379 VideoLayer::Create(&provider_, media::VIDEO_ROTATION_0); | 4380 VideoLayer::Create(&provider_, media::VIDEO_ROTATION_0); |
| 4380 video_layer->SetBounds(gfx::Size(10, 10)); | 4381 video_layer->SetBounds(gfx::Size(10, 10)); |
| 4381 video_layer->SetIsDrawable(true); | 4382 video_layer->SetIsDrawable(true); |
| 4382 layer_tree()->root_layer()->AddChild(video_layer); | 4383 layer_tree_host()->root_layer()->AddChild(video_layer); |
| 4383 | 4384 |
| 4384 invalidate_layer_ = video_layer; | 4385 invalidate_layer_ = video_layer; |
| 4385 } | 4386 } |
| 4386 | 4387 |
| 4387 private: | 4388 private: |
| 4388 FakeVideoFrameProvider provider_; | 4389 FakeVideoFrameProvider provider_; |
| 4389 }; | 4390 }; |
| 4390 | 4391 |
| 4391 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate); | 4392 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate); |
| 4392 | 4393 |
| 4393 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { | 4394 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { |
| 4394 protected: | 4395 protected: |
| 4395 void SetupTree() override { | 4396 void SetupTree() override { |
| 4396 root_layer_ = Layer::Create(); | 4397 root_layer_ = Layer::Create(); |
| 4397 root_layer_->SetPosition(gfx::PointF()); | 4398 root_layer_->SetPosition(gfx::PointF()); |
| 4398 root_layer_->SetBounds(gfx::Size(10, 10)); | 4399 root_layer_->SetBounds(gfx::Size(10, 10)); |
| 4399 | 4400 |
| 4400 parent_layer_ = SolidColorLayer::Create(); | 4401 parent_layer_ = SolidColorLayer::Create(); |
| 4401 parent_layer_->SetPosition(gfx::PointF()); | 4402 parent_layer_->SetPosition(gfx::PointF()); |
| 4402 parent_layer_->SetBounds(gfx::Size(10, 10)); | 4403 parent_layer_->SetBounds(gfx::Size(10, 10)); |
| 4403 parent_layer_->SetIsDrawable(true); | 4404 parent_layer_->SetIsDrawable(true); |
| 4404 root_layer_->AddChild(parent_layer_); | 4405 root_layer_->AddChild(parent_layer_); |
| 4405 | 4406 |
| 4406 child_layer_ = SolidColorLayer::Create(); | 4407 child_layer_ = SolidColorLayer::Create(); |
| 4407 child_layer_->SetPosition(gfx::PointF()); | 4408 child_layer_->SetPosition(gfx::PointF()); |
| 4408 child_layer_->SetBounds(gfx::Size(10, 10)); | 4409 child_layer_->SetBounds(gfx::Size(10, 10)); |
| 4409 child_layer_->SetIsDrawable(true); | 4410 child_layer_->SetIsDrawable(true); |
| 4410 parent_layer_->AddChild(child_layer_); | 4411 parent_layer_->AddChild(child_layer_); |
| 4411 | 4412 |
| 4412 layer_tree()->SetRootLayer(root_layer_); | 4413 layer_tree_host()->SetRootLayer(root_layer_); |
| 4413 LayerTreeHostTest::SetupTree(); | 4414 LayerTreeHostTest::SetupTree(); |
| 4414 } | 4415 } |
| 4415 | 4416 |
| 4416 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4417 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 4417 | 4418 |
| 4418 void DidCommitAndDrawFrame() override { | 4419 void DidCommitAndDrawFrame() override { |
| 4419 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | |
| 4420 switch (layer_tree_host()->SourceFrameNumber()) { | 4420 switch (layer_tree_host()->SourceFrameNumber()) { |
| 4421 case 1: | 4421 case 1: |
| 4422 // The layer type used does not need to push properties every frame. | 4422 // The layer type used does not need to push properties every frame. |
| 4423 EXPECT_FALSE( | 4423 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4424 layer_tree->LayerNeedsPushPropertiesForTesting(child_layer_.get())); | 4424 child_layer_.get())); |
| 4425 | 4425 |
| 4426 // Change the bounds of the child layer, but make it skipped | 4426 // Change the bounds of the child layer, but make it skipped |
| 4427 // by CalculateDrawProperties. | 4427 // by CalculateDrawProperties. |
| 4428 parent_layer_->SetOpacity(0.f); | 4428 parent_layer_->SetOpacity(0.f); |
| 4429 child_layer_->SetBounds(gfx::Size(5, 5)); | 4429 child_layer_->SetBounds(gfx::Size(5, 5)); |
| 4430 break; | 4430 break; |
| 4431 case 2: | 4431 case 2: |
| 4432 // The bounds of the child layer were pushed to the impl side. | 4432 // The bounds of the child layer were pushed to the impl side. |
| 4433 EXPECT_FALSE( | 4433 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 4434 layer_tree->LayerNeedsPushPropertiesForTesting(child_layer_.get())); | 4434 child_layer_.get())); |
| 4435 | 4435 |
| 4436 EndTest(); | 4436 EndTest(); |
| 4437 break; | 4437 break; |
| 4438 } | 4438 } |
| 4439 } | 4439 } |
| 4440 | 4440 |
| 4441 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 4441 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
| 4442 LayerImpl* child = impl->active_tree()->LayerById(child_layer_->id()); | 4442 LayerImpl* child = impl->active_tree()->LayerById(child_layer_->id()); |
| 4443 | 4443 |
| 4444 switch (impl->active_tree()->source_frame_number()) { | 4444 switch (impl->active_tree()->source_frame_number()) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4456 }; | 4456 }; |
| 4457 | 4457 |
| 4458 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer); | 4458 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer); |
| 4459 | 4459 |
| 4460 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { | 4460 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { |
| 4461 protected: | 4461 protected: |
| 4462 void SetupTree() override { | 4462 void SetupTree() override { |
| 4463 root_layer_ = FakePictureLayer::Create(&client_); | 4463 root_layer_ = FakePictureLayer::Create(&client_); |
| 4464 root_layer_->SetBounds(gfx::Size(10, 10)); | 4464 root_layer_->SetBounds(gfx::Size(10, 10)); |
| 4465 | 4465 |
| 4466 layer_tree()->SetRootLayer(root_layer_); | 4466 layer_tree_host()->SetRootLayer(root_layer_); |
| 4467 LayerTreeHostTest::SetupTree(); | 4467 LayerTreeHostTest::SetupTree(); |
| 4468 client_.set_bounds(root_layer_->bounds()); | 4468 client_.set_bounds(root_layer_->bounds()); |
| 4469 } | 4469 } |
| 4470 | 4470 |
| 4471 void BeginTest() override { | 4471 void BeginTest() override { |
| 4472 // The viewport is empty, but we still need to update layers on the main | 4472 // The viewport is empty, but we still need to update layers on the main |
| 4473 // thread. | 4473 // thread. |
| 4474 layer_tree()->SetViewportSize(gfx::Size(0, 0)); | 4474 layer_tree_host()->SetViewportSize(gfx::Size(0, 0)); |
| 4475 PostSetNeedsCommitToMainThread(); | 4475 PostSetNeedsCommitToMainThread(); |
| 4476 } | 4476 } |
| 4477 | 4477 |
| 4478 void DidCommit() override { | 4478 void DidCommit() override { |
| 4479 // The layer should be updated even though the viewport is empty, so we | 4479 // The layer should be updated even though the viewport is empty, so we |
| 4480 // are capable of drawing it on the impl tree. | 4480 // are capable of drawing it on the impl tree. |
| 4481 EXPECT_GT(root_layer_->update_count(), 0); | 4481 EXPECT_GT(root_layer_->update_count(), 0); |
| 4482 EndTest(); | 4482 EndTest(); |
| 4483 } | 4483 } |
| 4484 | 4484 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 4515 root_layer_->AddChild(inner_viewport_container_layer); | 4515 root_layer_->AddChild(inner_viewport_container_layer); |
| 4516 inner_viewport_container_layer->AddChild(overscroll_elasticity_layer); | 4516 inner_viewport_container_layer->AddChild(overscroll_elasticity_layer); |
| 4517 overscroll_elasticity_layer->AddChild(page_scale_layer); | 4517 overscroll_elasticity_layer->AddChild(page_scale_layer); |
| 4518 page_scale_layer->AddChild(inner_viewport_scroll_layer); | 4518 page_scale_layer->AddChild(inner_viewport_scroll_layer); |
| 4519 | 4519 |
| 4520 scoped_refptr<Layer> content_layer = FakePictureLayer::Create(&client_); | 4520 scoped_refptr<Layer> content_layer = FakePictureLayer::Create(&client_); |
| 4521 content_layer_id_ = content_layer->id(); | 4521 content_layer_id_ = content_layer->id(); |
| 4522 content_layer->SetBounds(gfx::Size(10, 10)); | 4522 content_layer->SetBounds(gfx::Size(10, 10)); |
| 4523 inner_viewport_scroll_layer->AddChild(content_layer); | 4523 inner_viewport_scroll_layer->AddChild(content_layer); |
| 4524 | 4524 |
| 4525 layer_tree()->SetRootLayer(root_layer_); | 4525 layer_tree_host()->SetRootLayer(root_layer_); |
| 4526 layer_tree()->RegisterViewportLayers(overscroll_elasticity_layer, | 4526 layer_tree_host()->RegisterViewportLayers( |
| 4527 page_scale_layer, | 4527 overscroll_elasticity_layer, page_scale_layer, |
| 4528 inner_viewport_scroll_layer, nullptr); | 4528 inner_viewport_scroll_layer, nullptr); |
| 4529 LayerTreeHostTest::SetupTree(); | 4529 LayerTreeHostTest::SetupTree(); |
| 4530 client_.set_bounds(content_layer->bounds()); | 4530 client_.set_bounds(content_layer->bounds()); |
| 4531 } | 4531 } |
| 4532 | 4532 |
| 4533 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4533 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 4534 | 4534 |
| 4535 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 4535 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
| 4536 if (host_impl->sync_tree()->source_frame_number() == 0) { | 4536 if (host_impl->sync_tree()->source_frame_number() == 0) { |
| 4537 scroll_elasticity_helper_ = host_impl->CreateScrollElasticityHelper(); | 4537 scroll_elasticity_helper_ = host_impl->CreateScrollElasticityHelper(); |
| 4538 } | 4538 } |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4789 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); | 4789 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); |
| 4790 | 4790 |
| 4791 class LayerTreeHostTestKeepSwapPromise : public LayerTreeHostTest { | 4791 class LayerTreeHostTestKeepSwapPromise : public LayerTreeHostTest { |
| 4792 public: | 4792 public: |
| 4793 LayerTreeHostTestKeepSwapPromise() {} | 4793 LayerTreeHostTestKeepSwapPromise() {} |
| 4794 | 4794 |
| 4795 void BeginTest() override { | 4795 void BeginTest() override { |
| 4796 layer_ = SolidColorLayer::Create(); | 4796 layer_ = SolidColorLayer::Create(); |
| 4797 layer_->SetIsDrawable(true); | 4797 layer_->SetIsDrawable(true); |
| 4798 layer_->SetBounds(gfx::Size(10, 10)); | 4798 layer_->SetBounds(gfx::Size(10, 10)); |
| 4799 layer_tree()->SetRootLayer(layer_); | 4799 layer_tree_host()->SetRootLayer(layer_); |
| 4800 gfx::Size bounds(100, 100); | 4800 gfx::Size bounds(100, 100); |
| 4801 layer_tree()->SetViewportSize(bounds); | 4801 layer_tree_host()->SetViewportSize(bounds); |
| 4802 PostSetNeedsCommitToMainThread(); | 4802 PostSetNeedsCommitToMainThread(); |
| 4803 } | 4803 } |
| 4804 | 4804 |
| 4805 void DidCommit() override { | 4805 void DidCommit() override { |
| 4806 MainThreadTaskRunner()->PostTask( | 4806 MainThreadTaskRunner()->PostTask( |
| 4807 FROM_HERE, base::Bind(&LayerTreeHostTestKeepSwapPromise::ChangeFrame, | 4807 FROM_HERE, base::Bind(&LayerTreeHostTestKeepSwapPromise::ChangeFrame, |
| 4808 base::Unretained(this))); | 4808 base::Unretained(this))); |
| 4809 } | 4809 } |
| 4810 | 4810 |
| 4811 void ChangeFrame() { | 4811 void ChangeFrame() { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4884 LayerTreeHostTestKeepSwapPromiseMFBA() {} | 4884 LayerTreeHostTestKeepSwapPromiseMFBA() {} |
| 4885 | 4885 |
| 4886 void InitializeSettings(LayerTreeSettings* settings) override { | 4886 void InitializeSettings(LayerTreeSettings* settings) override { |
| 4887 settings->main_frame_before_activation_enabled = true; | 4887 settings->main_frame_before_activation_enabled = true; |
| 4888 } | 4888 } |
| 4889 | 4889 |
| 4890 void BeginTest() override { | 4890 void BeginTest() override { |
| 4891 layer_ = SolidColorLayer::Create(); | 4891 layer_ = SolidColorLayer::Create(); |
| 4892 layer_->SetIsDrawable(true); | 4892 layer_->SetIsDrawable(true); |
| 4893 layer_->SetBounds(gfx::Size(10, 10)); | 4893 layer_->SetBounds(gfx::Size(10, 10)); |
| 4894 layer_tree()->SetRootLayer(layer_); | 4894 layer_tree_host()->SetRootLayer(layer_); |
| 4895 gfx::Size bounds(100, 100); | 4895 gfx::Size bounds(100, 100); |
| 4896 layer_tree()->SetViewportSize(bounds); | 4896 layer_tree_host()->SetViewportSize(bounds); |
| 4897 PostSetNeedsCommitToMainThread(); | 4897 PostSetNeedsCommitToMainThread(); |
| 4898 } | 4898 } |
| 4899 | 4899 |
| 4900 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { | 4900 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { |
| 4901 // Safe to check frame number here because main thread is blocked. | 4901 // Safe to check frame number here because main thread is blocked. |
| 4902 if (layer_tree_host()->SourceFrameNumber() == 0) { | 4902 if (layer_tree_host()->SourceFrameNumber() == 0) { |
| 4903 host_impl->BlockNotifyReadyToActivateForTesting(true); | 4903 host_impl->BlockNotifyReadyToActivateForTesting(true); |
| 4904 } else { | 4904 } else { |
| 4905 NOTREACHED(); | 4905 NOTREACHED(); |
| 4906 } | 4906 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5118 | 5118 |
| 5119 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor); | 5119 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor); |
| 5120 | 5120 |
| 5121 class LayerTreeHostTestHighResRequiredAfterEvictingUIResources | 5121 class LayerTreeHostTestHighResRequiredAfterEvictingUIResources |
| 5122 : public LayerTreeHostTest { | 5122 : public LayerTreeHostTest { |
| 5123 protected: | 5123 protected: |
| 5124 void SetupTree() override { | 5124 void SetupTree() override { |
| 5125 LayerTreeHostTest::SetupTree(); | 5125 LayerTreeHostTest::SetupTree(); |
| 5126 ui_resource_ = | 5126 ui_resource_ = |
| 5127 FakeScopedUIResource::Create(layer_tree_host()->GetUIResourceManager()); | 5127 FakeScopedUIResource::Create(layer_tree_host()->GetUIResourceManager()); |
| 5128 client_.set_bounds(layer_tree()->root_layer()->bounds()); | 5128 client_.set_bounds(layer_tree_host()->root_layer()->bounds()); |
| 5129 } | 5129 } |
| 5130 | 5130 |
| 5131 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5131 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 5132 | 5132 |
| 5133 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 5133 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
| 5134 host_impl->EvictAllUIResources(); | 5134 host_impl->EvictAllUIResources(); |
| 5135 // Existence of evicted UI resources will trigger NEW_CONTENT_TAKES_PRIORITY | 5135 // Existence of evicted UI resources will trigger NEW_CONTENT_TAKES_PRIORITY |
| 5136 // mode. Active tree should require high-res to draw after entering this | 5136 // mode. Active tree should require high-res to draw after entering this |
| 5137 // mode to ensure that high-res tiles are also required for a pending tree | 5137 // mode to ensure that high-res tiles are also required for a pending tree |
| 5138 // to be activated. | 5138 // to be activated. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5174 std::unique_ptr<FakeRecordingSource> recording_source( | 5174 std::unique_ptr<FakeRecordingSource> recording_source( |
| 5175 new FakeRecordingSource); | 5175 new FakeRecordingSource); |
| 5176 recording_source_ = recording_source.get(); | 5176 recording_source_ = recording_source.get(); |
| 5177 | 5177 |
| 5178 scoped_refptr<FakePictureLayer> layer = | 5178 scoped_refptr<FakePictureLayer> layer = |
| 5179 FakePictureLayer::CreateWithRecordingSource( | 5179 FakePictureLayer::CreateWithRecordingSource( |
| 5180 &layer_client_, std::move(recording_source)); | 5180 &layer_client_, std::move(recording_source)); |
| 5181 layer_ = layer.get(); | 5181 layer_ = layer.get(); |
| 5182 layer->SetBounds(gfx::Size(10, 10)); | 5182 layer->SetBounds(gfx::Size(10, 10)); |
| 5183 layer->SetIsDrawable(true); | 5183 layer->SetIsDrawable(true); |
| 5184 layer_tree()->root_layer()->AddChild(layer); | 5184 layer_tree_host()->root_layer()->AddChild(layer); |
| 5185 layer_client_.set_bounds(layer_->bounds()); | 5185 layer_client_.set_bounds(layer_->bounds()); |
| 5186 } | 5186 } |
| 5187 | 5187 |
| 5188 void BeginTest() override { | 5188 void BeginTest() override { |
| 5189 // Verify default value. | 5189 // Verify default value. |
| 5190 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5190 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| 5191 | 5191 |
| 5192 // Setting gpu rasterization trigger does not enable gpu rasterization. | 5192 // Setting gpu rasterization trigger does not enable gpu rasterization. |
| 5193 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 5193 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
| 5194 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5194 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5228 std::unique_ptr<FakeRecordingSource> recording_source( | 5228 std::unique_ptr<FakeRecordingSource> recording_source( |
| 5229 new FakeRecordingSource); | 5229 new FakeRecordingSource); |
| 5230 recording_source_ = recording_source.get(); | 5230 recording_source_ = recording_source.get(); |
| 5231 | 5231 |
| 5232 scoped_refptr<FakePictureLayer> layer = | 5232 scoped_refptr<FakePictureLayer> layer = |
| 5233 FakePictureLayer::CreateWithRecordingSource( | 5233 FakePictureLayer::CreateWithRecordingSource( |
| 5234 &layer_client_, std::move(recording_source)); | 5234 &layer_client_, std::move(recording_source)); |
| 5235 layer_ = layer.get(); | 5235 layer_ = layer.get(); |
| 5236 layer->SetBounds(gfx::Size()); | 5236 layer->SetBounds(gfx::Size()); |
| 5237 layer->SetIsDrawable(true); | 5237 layer->SetIsDrawable(true); |
| 5238 layer_tree()->root_layer()->AddChild(layer); | 5238 layer_tree_host()->root_layer()->AddChild(layer); |
| 5239 layer_client_.set_bounds(layer->bounds()); | 5239 layer_client_.set_bounds(layer->bounds()); |
| 5240 } | 5240 } |
| 5241 | 5241 |
| 5242 void BeginTest() override { | 5242 void BeginTest() override { |
| 5243 // Setting gpu rasterization trigger does not enable gpu rasterization. | 5243 // Setting gpu rasterization trigger does not enable gpu rasterization. |
| 5244 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 5244 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
| 5245 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5245 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| 5246 | 5246 |
| 5247 PostSetNeedsCommitToMainThread(); | 5247 PostSetNeedsCommitToMainThread(); |
| 5248 } | 5248 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5284 std::unique_ptr<FakeRecordingSource> recording_source( | 5284 std::unique_ptr<FakeRecordingSource> recording_source( |
| 5285 new FakeRecordingSource); | 5285 new FakeRecordingSource); |
| 5286 recording_source_ = recording_source.get(); | 5286 recording_source_ = recording_source.get(); |
| 5287 | 5287 |
| 5288 scoped_refptr<FakePictureLayer> layer = | 5288 scoped_refptr<FakePictureLayer> layer = |
| 5289 FakePictureLayer::CreateWithRecordingSource( | 5289 FakePictureLayer::CreateWithRecordingSource( |
| 5290 &layer_client_, std::move(recording_source)); | 5290 &layer_client_, std::move(recording_source)); |
| 5291 layer_ = layer.get(); | 5291 layer_ = layer.get(); |
| 5292 layer->SetBounds(gfx::Size(10, 10)); | 5292 layer->SetBounds(gfx::Size(10, 10)); |
| 5293 layer->SetIsDrawable(true); | 5293 layer->SetIsDrawable(true); |
| 5294 layer_tree()->root_layer()->AddChild(layer); | 5294 layer_tree_host()->root_layer()->AddChild(layer); |
| 5295 layer_client_.set_bounds(layer_->bounds()); | 5295 layer_client_.set_bounds(layer_->bounds()); |
| 5296 } | 5296 } |
| 5297 | 5297 |
| 5298 void BeginTest() override { | 5298 void BeginTest() override { |
| 5299 // Verify default value. | 5299 // Verify default value. |
| 5300 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5300 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| 5301 | 5301 |
| 5302 // Gpu rasterization trigger is relevant. | 5302 // Gpu rasterization trigger is relevant. |
| 5303 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 5303 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
| 5304 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5304 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5352 std::unique_ptr<FakeRecordingSource> recording_source( | 5352 std::unique_ptr<FakeRecordingSource> recording_source( |
| 5353 new FakeRecordingSource); | 5353 new FakeRecordingSource); |
| 5354 recording_source_ = recording_source.get(); | 5354 recording_source_ = recording_source.get(); |
| 5355 | 5355 |
| 5356 scoped_refptr<FakePictureLayer> layer = | 5356 scoped_refptr<FakePictureLayer> layer = |
| 5357 FakePictureLayer::CreateWithRecordingSource( | 5357 FakePictureLayer::CreateWithRecordingSource( |
| 5358 &layer_client_, std::move(recording_source)); | 5358 &layer_client_, std::move(recording_source)); |
| 5359 layer_ = layer.get(); | 5359 layer_ = layer.get(); |
| 5360 layer->SetBounds(gfx::Size(10, 10)); | 5360 layer->SetBounds(gfx::Size(10, 10)); |
| 5361 layer->SetIsDrawable(true); | 5361 layer->SetIsDrawable(true); |
| 5362 layer_tree()->root_layer()->AddChild(layer); | 5362 layer_tree_host()->root_layer()->AddChild(layer); |
| 5363 layer_client_.set_bounds(layer_->bounds()); | 5363 layer_client_.set_bounds(layer_->bounds()); |
| 5364 } | 5364 } |
| 5365 | 5365 |
| 5366 void BeginTest() override { | 5366 void BeginTest() override { |
| 5367 // Verify default value. | 5367 // Verify default value. |
| 5368 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5368 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| 5369 | 5369 |
| 5370 // Gpu rasterization trigger is relevant. | 5370 // Gpu rasterization trigger is relevant. |
| 5371 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 5371 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
| 5372 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5372 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5435 new FakeRecordingSource); | 5435 new FakeRecordingSource); |
| 5436 recording_source_ = recording_source.get(); | 5436 recording_source_ = recording_source.get(); |
| 5437 | 5437 |
| 5438 scoped_refptr<FakePictureLayer> layer = | 5438 scoped_refptr<FakePictureLayer> layer = |
| 5439 FakePictureLayer::CreateWithRecordingSource( | 5439 FakePictureLayer::CreateWithRecordingSource( |
| 5440 &layer_client_, std::move(recording_source)); | 5440 &layer_client_, std::move(recording_source)); |
| 5441 layer_ = layer.get(); | 5441 layer_ = layer.get(); |
| 5442 | 5442 |
| 5443 layer->SetBounds(gfx::Size(10, 10)); | 5443 layer->SetBounds(gfx::Size(10, 10)); |
| 5444 layer->SetIsDrawable(true); | 5444 layer->SetIsDrawable(true); |
| 5445 layer_tree()->root_layer()->AddChild(layer); | 5445 layer_tree_host()->root_layer()->AddChild(layer); |
| 5446 layer_client_.set_bounds(layer_->bounds()); | 5446 layer_client_.set_bounds(layer_->bounds()); |
| 5447 } | 5447 } |
| 5448 | 5448 |
| 5449 void BeginTest() override { | 5449 void BeginTest() override { |
| 5450 // Verify default value. | 5450 // Verify default value. |
| 5451 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5451 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| 5452 | 5452 |
| 5453 // With gpu rasterization forced, gpu rasterization trigger is irrelevant. | 5453 // With gpu rasterization forced, gpu rasterization trigger is irrelevant. |
| 5454 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 5454 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
| 5455 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5455 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5663 public: | 5663 public: |
| 5664 LayerTreeHostTestRenderSurfaceEffectTreeIndex() = default; | 5664 LayerTreeHostTestRenderSurfaceEffectTreeIndex() = default; |
| 5665 | 5665 |
| 5666 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5666 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 5667 | 5667 |
| 5668 void SetupTree() override { | 5668 void SetupTree() override { |
| 5669 root_ = Layer::Create(); | 5669 root_ = Layer::Create(); |
| 5670 child_ = Layer::Create(); | 5670 child_ = Layer::Create(); |
| 5671 grand_child_ = Layer::Create(); | 5671 grand_child_ = Layer::Create(); |
| 5672 | 5672 |
| 5673 layer_tree()->SetRootLayer(root_); | 5673 layer_tree_host()->SetRootLayer(root_); |
| 5674 root_->AddChild(child_); | 5674 root_->AddChild(child_); |
| 5675 child_->AddChild(grand_child_); | 5675 child_->AddChild(grand_child_); |
| 5676 | 5676 |
| 5677 root_->SetBounds(gfx::Size(50, 50)); | 5677 root_->SetBounds(gfx::Size(50, 50)); |
| 5678 child_->SetBounds(gfx::Size(50, 50)); | 5678 child_->SetBounds(gfx::Size(50, 50)); |
| 5679 grand_child_->SetBounds(gfx::Size(50, 50)); | 5679 grand_child_->SetBounds(gfx::Size(50, 50)); |
| 5680 child_->SetForceRenderSurfaceForTesting(true); | 5680 child_->SetForceRenderSurfaceForTesting(true); |
| 5681 grand_child_->SetForceRenderSurfaceForTesting(true); | 5681 grand_child_->SetForceRenderSurfaceForTesting(true); |
| 5682 | 5682 |
| 5683 LayerTreeHostTest::SetupTree(); | 5683 LayerTreeHostTest::SetupTree(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 5710 grand_child_impl->render_surface()->EffectTreeIndex()); | 5710 grand_child_impl->render_surface()->EffectTreeIndex()); |
| 5711 EndTest(); | 5711 EndTest(); |
| 5712 } | 5712 } |
| 5713 } | 5713 } |
| 5714 | 5714 |
| 5715 void DidCommit() override { | 5715 void DidCommit() override { |
| 5716 switch (layer_tree_host()->SourceFrameNumber()) { | 5716 switch (layer_tree_host()->SourceFrameNumber()) { |
| 5717 case 2: | 5717 case 2: |
| 5718 // Setting an empty viewport causes draws to get skipped, so the active | 5718 // Setting an empty viewport causes draws to get skipped, so the active |
| 5719 // tree won't update draw properties. | 5719 // tree won't update draw properties. |
| 5720 layer_tree()->SetViewportSize(gfx::Size()); | 5720 layer_tree_host()->SetViewportSize(gfx::Size()); |
| 5721 child_->SetForceRenderSurfaceForTesting(false); | 5721 child_->SetForceRenderSurfaceForTesting(false); |
| 5722 break; | 5722 break; |
| 5723 case 3: | 5723 case 3: |
| 5724 layer_tree()->SetViewportSize(root_->bounds()); | 5724 layer_tree_host()->SetViewportSize(root_->bounds()); |
| 5725 } | 5725 } |
| 5726 } | 5726 } |
| 5727 | 5727 |
| 5728 void AfterTest() override {} | 5728 void AfterTest() override {} |
| 5729 | 5729 |
| 5730 private: | 5730 private: |
| 5731 scoped_refptr<Layer> root_; | 5731 scoped_refptr<Layer> root_; |
| 5732 scoped_refptr<Layer> child_; | 5732 scoped_refptr<Layer> child_; |
| 5733 scoped_refptr<Layer> grand_child_; | 5733 scoped_refptr<Layer> grand_child_; |
| 5734 }; | 5734 }; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5776 layer_tree_host()->GetSwapPromiseManager()->QueueSwapPromise( | 5776 layer_tree_host()->GetSwapPromiseManager()->QueueSwapPromise( |
| 5777 std::move(swap_promise1)); | 5777 std::move(swap_promise1)); |
| 5778 layer_tree_host()->SetNeedsCommit(); | 5778 layer_tree_host()->SetNeedsCommit(); |
| 5779 layer_tree_host()->Composite(base::TimeTicks::Now()); | 5779 layer_tree_host()->Composite(base::TimeTicks::Now()); |
| 5780 | 5780 |
| 5781 // Fail to draw (not visible). | 5781 // Fail to draw (not visible). |
| 5782 std::unique_ptr<SwapPromise> swap_promise2( | 5782 std::unique_ptr<SwapPromise> swap_promise2( |
| 5783 new TestSwapPromise(&swap_promise_result_[2])); | 5783 new TestSwapPromise(&swap_promise_result_[2])); |
| 5784 layer_tree_host()->GetSwapPromiseManager()->QueueSwapPromise( | 5784 layer_tree_host()->GetSwapPromiseManager()->QueueSwapPromise( |
| 5785 std::move(swap_promise2)); | 5785 std::move(swap_promise2)); |
| 5786 layer_tree()->SetNeedsDisplayOnAllLayers(); | 5786 layer_tree_host()->SetNeedsDisplayOnAllLayers(); |
| 5787 layer_tree_host()->SetVisible(false); | 5787 layer_tree_host()->SetVisible(false); |
| 5788 layer_tree_host()->Composite(base::TimeTicks::Now()); | 5788 layer_tree_host()->Composite(base::TimeTicks::Now()); |
| 5789 | 5789 |
| 5790 EndTest(); | 5790 EndTest(); |
| 5791 } | 5791 } |
| 5792 | 5792 |
| 5793 void DidCommit() override { | 5793 void DidCommit() override { |
| 5794 commit_count_++; | 5794 commit_count_++; |
| 5795 ASSERT_LE(commit_count_, 3); | 5795 ASSERT_LE(commit_count_, 3); |
| 5796 } | 5796 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5850 | 5850 |
| 5851 // Make sure page scale and top control deltas are applied to the client even | 5851 // Make sure page scale and top control deltas are applied to the client even |
| 5852 // when the LayerTreeHost doesn't have a root layer. | 5852 // when the LayerTreeHost doesn't have a root layer. |
| 5853 class LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer | 5853 class LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer |
| 5854 : public LayerTreeHostTest { | 5854 : public LayerTreeHostTest { |
| 5855 public: | 5855 public: |
| 5856 LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer() | 5856 LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer() |
| 5857 : deltas_sent_to_client_(false) {} | 5857 : deltas_sent_to_client_(false) {} |
| 5858 | 5858 |
| 5859 void BeginTest() override { | 5859 void BeginTest() override { |
| 5860 layer_tree()->SetRootLayer(nullptr); | 5860 layer_tree_host()->SetRootLayer(nullptr); |
| 5861 info_.page_scale_delta = 3.14f; | 5861 info_.page_scale_delta = 3.14f; |
| 5862 info_.top_controls_delta = 2.73f; | 5862 info_.top_controls_delta = 2.73f; |
| 5863 | 5863 |
| 5864 PostSetNeedsCommitToMainThread(); | 5864 PostSetNeedsCommitToMainThread(); |
| 5865 } | 5865 } |
| 5866 | 5866 |
| 5867 void BeginMainFrame(const BeginFrameArgs& args) override { | 5867 void BeginMainFrame(const BeginFrameArgs& args) override { |
| 5868 EXPECT_EQ(nullptr, layer_tree()->root_layer()); | 5868 EXPECT_EQ(nullptr, layer_tree_host()->root_layer()); |
| 5869 | 5869 |
| 5870 layer_tree_host()->ApplyScrollAndScale(&info_); | 5870 layer_tree_host()->ApplyScrollAndScale(&info_); |
| 5871 EndTest(); | 5871 EndTest(); |
| 5872 } | 5872 } |
| 5873 | 5873 |
| 5874 void ApplyViewportDeltas(const gfx::Vector2dF& inner, | 5874 void ApplyViewportDeltas(const gfx::Vector2dF& inner, |
| 5875 const gfx::Vector2dF& outer, | 5875 const gfx::Vector2dF& outer, |
| 5876 const gfx::Vector2dF& elastic_overscroll_delta, | 5876 const gfx::Vector2dF& elastic_overscroll_delta, |
| 5877 float scale_delta, | 5877 float scale_delta, |
| 5878 float top_controls_delta) override { | 5878 float top_controls_delta) override { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5916 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); | 5916 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); |
| 5917 scoped_refptr<FakePictureLayer> layer = | 5917 scoped_refptr<FakePictureLayer> layer = |
| 5918 FakePictureLayer::CreateWithRecordingSource(&client_, | 5918 FakePictureLayer::CreateWithRecordingSource(&client_, |
| 5919 std::move(recording)); | 5919 std::move(recording)); |
| 5920 layer->SetBounds(gfx::Size(500, 500)); | 5920 layer->SetBounds(gfx::Size(500, 500)); |
| 5921 layer->SetContentsOpaque(true); | 5921 layer->SetContentsOpaque(true); |
| 5922 // Avoid LCD text on the layer so we don't cause extra commits when we | 5922 // Avoid LCD text on the layer so we don't cause extra commits when we |
| 5923 // pinch. | 5923 // pinch. |
| 5924 pinch->AddChild(layer); | 5924 pinch->AddChild(layer); |
| 5925 | 5925 |
| 5926 layer_tree()->RegisterViewportLayers(NULL, page_scale_layer, pinch, | 5926 layer_tree_host()->RegisterViewportLayers(NULL, page_scale_layer, pinch, |
| 5927 nullptr); | 5927 nullptr); |
| 5928 layer_tree()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); | 5928 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); |
| 5929 layer_tree()->SetRootLayer(root_clip); | 5929 layer_tree_host()->SetRootLayer(root_clip); |
| 5930 LayerTreeHostTest::SetupTree(); | 5930 LayerTreeHostTest::SetupTree(); |
| 5931 client_.set_bounds(root_clip->bounds()); | 5931 client_.set_bounds(root_clip->bounds()); |
| 5932 } | 5932 } |
| 5933 | 5933 |
| 5934 // Returns the delta scale of all quads in the frame's root pass from their | 5934 // Returns the delta scale of all quads in the frame's root pass from their |
| 5935 // ideal, or 0 if they are not all the same. | 5935 // ideal, or 0 if they are not all the same. |
| 5936 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { | 5936 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { |
| 5937 if (frame_data->has_no_damage) | 5937 if (frame_data->has_no_damage) |
| 5938 return 0.f; | 5938 return 0.f; |
| 5939 float frame_scale = 0.f; | 5939 float frame_scale = 0.f; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6118 client_.set_bounds(root->bounds()); | 6118 client_.set_bounds(root->bounds()); |
| 6119 | 6119 |
| 6120 std::unique_ptr<FakeRecordingSource> recording(new FakeRecordingSource); | 6120 std::unique_ptr<FakeRecordingSource> recording(new FakeRecordingSource); |
| 6121 scoped_refptr<FakePictureLayer> layer = | 6121 scoped_refptr<FakePictureLayer> layer = |
| 6122 FakePictureLayer::CreateWithRecordingSource(&client_, | 6122 FakePictureLayer::CreateWithRecordingSource(&client_, |
| 6123 std::move(recording)); | 6123 std::move(recording)); |
| 6124 layer->SetBounds(gfx::Size(500, 500)); | 6124 layer->SetBounds(gfx::Size(500, 500)); |
| 6125 layer->SetContentsOpaque(true); | 6125 layer->SetContentsOpaque(true); |
| 6126 root->AddChild(layer); | 6126 root->AddChild(layer); |
| 6127 | 6127 |
| 6128 layer_tree()->SetRootLayer(root); | 6128 layer_tree_host()->SetRootLayer(root); |
| 6129 LayerTreeHostTest::SetupTree(); | 6129 LayerTreeHostTest::SetupTree(); |
| 6130 client_.set_bounds(root->bounds()); | 6130 client_.set_bounds(root->bounds()); |
| 6131 } | 6131 } |
| 6132 | 6132 |
| 6133 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6133 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 6134 | 6134 |
| 6135 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6135 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 6136 LayerTreeHostImpl::FrameData* frame_data, | 6136 LayerTreeHostImpl::FrameData* frame_data, |
| 6137 DrawResult draw_result) override { | 6137 DrawResult draw_result) override { |
| 6138 EXPECT_NE(0u, host_impl->resource_provider()->num_resources()); | 6138 EXPECT_NE(0u, host_impl->resource_provider()->num_resources()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 6159 client_.set_fill_with_nonsolid_color(true); | 6159 client_.set_fill_with_nonsolid_color(true); |
| 6160 | 6160 |
| 6161 std::unique_ptr<FakeRecordingSource> recording(new FakeRecordingSource); | 6161 std::unique_ptr<FakeRecordingSource> recording(new FakeRecordingSource); |
| 6162 scoped_refptr<FakePictureLayer> root = | 6162 scoped_refptr<FakePictureLayer> root = |
| 6163 FakePictureLayer::CreateWithRecordingSource(&client_, | 6163 FakePictureLayer::CreateWithRecordingSource(&client_, |
| 6164 std::move(recording)); | 6164 std::move(recording)); |
| 6165 root->SetBounds(gfx::Size(10000, 10000)); | 6165 root->SetBounds(gfx::Size(10000, 10000)); |
| 6166 client_.set_bounds(root->bounds()); | 6166 client_.set_bounds(root->bounds()); |
| 6167 root->SetContentsOpaque(true); | 6167 root->SetContentsOpaque(true); |
| 6168 | 6168 |
| 6169 layer_tree()->SetRootLayer(root); | 6169 layer_tree_host()->SetRootLayer(root); |
| 6170 LayerTreeHostTest::SetupTree(); | 6170 LayerTreeHostTest::SetupTree(); |
| 6171 layer_tree()->SetViewportSize(viewport_size_); | 6171 layer_tree_host()->SetViewportSize(viewport_size_); |
| 6172 client_.set_bounds(root->bounds()); | 6172 client_.set_bounds(root->bounds()); |
| 6173 } | 6173 } |
| 6174 | 6174 |
| 6175 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6175 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 6176 | 6176 |
| 6177 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6177 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 6178 LayerTreeHostImpl::FrameData* frame_data, | 6178 LayerTreeHostImpl::FrameData* frame_data, |
| 6179 DrawResult draw_result) override { | 6179 DrawResult draw_result) override { |
| 6180 EXPECT_EQ(10u, host_impl->resource_provider()->num_resources()); | 6180 EXPECT_EQ(10u, host_impl->resource_provider()->num_resources()); |
| 6181 EndTest(); | 6181 EndTest(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6219 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); | 6219 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); |
| 6220 scoped_refptr<FakePictureLayer> layer = | 6220 scoped_refptr<FakePictureLayer> layer = |
| 6221 FakePictureLayer::CreateWithRecordingSource(&client_, | 6221 FakePictureLayer::CreateWithRecordingSource(&client_, |
| 6222 std::move(recording)); | 6222 std::move(recording)); |
| 6223 layer->SetBounds(gfx::Size(500, 500)); | 6223 layer->SetBounds(gfx::Size(500, 500)); |
| 6224 layer->SetContentsOpaque(true); | 6224 layer->SetContentsOpaque(true); |
| 6225 // Avoid LCD text on the layer so we don't cause extra commits when we | 6225 // Avoid LCD text on the layer so we don't cause extra commits when we |
| 6226 // pinch. | 6226 // pinch. |
| 6227 pinch->AddChild(layer); | 6227 pinch->AddChild(layer); |
| 6228 | 6228 |
| 6229 layer_tree()->RegisterViewportLayers(NULL, page_scale_layer, pinch, | 6229 layer_tree_host()->RegisterViewportLayers(NULL, page_scale_layer, pinch, |
| 6230 nullptr); | 6230 nullptr); |
| 6231 layer_tree()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); | 6231 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); |
| 6232 layer_tree()->SetRootLayer(root_clip); | 6232 layer_tree_host()->SetRootLayer(root_clip); |
| 6233 LayerTreeHostTest::SetupTree(); | 6233 LayerTreeHostTest::SetupTree(); |
| 6234 client_.set_bounds(root_clip->bounds()); | 6234 client_.set_bounds(root_clip->bounds()); |
| 6235 } | 6235 } |
| 6236 | 6236 |
| 6237 // Returns the delta scale of all quads in the frame's root pass from their | 6237 // Returns the delta scale of all quads in the frame's root pass from their |
| 6238 // ideal, or 0 if they are not all the same. | 6238 // ideal, or 0 if they are not all the same. |
| 6239 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { | 6239 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { |
| 6240 if (frame_data->has_no_damage) | 6240 if (frame_data->has_no_damage) |
| 6241 return 0.f; | 6241 return 0.f; |
| 6242 float frame_scale = 0.f; | 6242 float frame_scale = 0.f; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6376 : notify_ready_to_activate_count_(0u), | 6376 : notify_ready_to_activate_count_(0u), |
| 6377 scheduled_prepare_tiles_count_(0) {} | 6377 scheduled_prepare_tiles_count_(0) {} |
| 6378 | 6378 |
| 6379 void SetupTree() override { | 6379 void SetupTree() override { |
| 6380 client_.set_fill_with_nonsolid_color(true); | 6380 client_.set_fill_with_nonsolid_color(true); |
| 6381 scoped_refptr<FakePictureLayer> root_layer = | 6381 scoped_refptr<FakePictureLayer> root_layer = |
| 6382 FakePictureLayer::Create(&client_); | 6382 FakePictureLayer::Create(&client_); |
| 6383 root_layer->SetBounds(gfx::Size(1500, 1500)); | 6383 root_layer->SetBounds(gfx::Size(1500, 1500)); |
| 6384 root_layer->SetIsDrawable(true); | 6384 root_layer->SetIsDrawable(true); |
| 6385 | 6385 |
| 6386 layer_tree()->SetRootLayer(root_layer); | 6386 layer_tree_host()->SetRootLayer(root_layer); |
| 6387 LayerTreeHostTest::SetupTree(); | 6387 LayerTreeHostTest::SetupTree(); |
| 6388 client_.set_bounds(root_layer->bounds()); | 6388 client_.set_bounds(root_layer->bounds()); |
| 6389 } | 6389 } |
| 6390 | 6390 |
| 6391 void BeginTest() override { | 6391 void BeginTest() override { |
| 6392 layer_tree()->SetViewportSize(gfx::Size(16, 16)); | 6392 layer_tree_host()->SetViewportSize(gfx::Size(16, 16)); |
| 6393 PostSetNeedsCommitToMainThread(); | 6393 PostSetNeedsCommitToMainThread(); |
| 6394 } | 6394 } |
| 6395 | 6395 |
| 6396 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, | 6396 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, |
| 6397 bool success) override { | 6397 bool success) override { |
| 6398 ASSERT_TRUE(success); | 6398 ASSERT_TRUE(success); |
| 6399 host_impl->tile_manager()->SetScheduledRasterTaskLimitForTesting(1); | 6399 host_impl->tile_manager()->SetScheduledRasterTaskLimitForTesting(1); |
| 6400 } | 6400 } |
| 6401 | 6401 |
| 6402 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { | 6402 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 6432 LayerTreeHostTestActivationCausesPrepareTiles() | 6432 LayerTreeHostTestActivationCausesPrepareTiles() |
| 6433 : scheduled_prepare_tiles_count_(0) {} | 6433 : scheduled_prepare_tiles_count_(0) {} |
| 6434 | 6434 |
| 6435 void SetupTree() override { | 6435 void SetupTree() override { |
| 6436 client_.set_fill_with_nonsolid_color(true); | 6436 client_.set_fill_with_nonsolid_color(true); |
| 6437 scoped_refptr<FakePictureLayer> root_layer = | 6437 scoped_refptr<FakePictureLayer> root_layer = |
| 6438 FakePictureLayer::Create(&client_); | 6438 FakePictureLayer::Create(&client_); |
| 6439 root_layer->SetBounds(gfx::Size(150, 150)); | 6439 root_layer->SetBounds(gfx::Size(150, 150)); |
| 6440 root_layer->SetIsDrawable(true); | 6440 root_layer->SetIsDrawable(true); |
| 6441 | 6441 |
| 6442 layer_tree()->SetRootLayer(root_layer); | 6442 layer_tree_host()->SetRootLayer(root_layer); |
| 6443 LayerTreeHostTest::SetupTree(); | 6443 LayerTreeHostTest::SetupTree(); |
| 6444 client_.set_bounds(root_layer->bounds()); | 6444 client_.set_bounds(root_layer->bounds()); |
| 6445 } | 6445 } |
| 6446 | 6446 |
| 6447 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6447 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 6448 | 6448 |
| 6449 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { | 6449 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { |
| 6450 // Ensure we've already activated. | 6450 // Ensure we've already activated. |
| 6451 EXPECT_FALSE(impl->pending_tree()); | 6451 EXPECT_FALSE(impl->pending_tree()); |
| 6452 | 6452 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6510 }; | 6510 }; |
| 6511 | 6511 |
| 6512 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); | 6512 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); |
| 6513 | 6513 |
| 6514 class LayerTreeHostTestUpdateCopyRequests : public LayerTreeHostTest { | 6514 class LayerTreeHostTestUpdateCopyRequests : public LayerTreeHostTest { |
| 6515 protected: | 6515 protected: |
| 6516 void SetupTree() override { | 6516 void SetupTree() override { |
| 6517 root = Layer::Create(); | 6517 root = Layer::Create(); |
| 6518 child = Layer::Create(); | 6518 child = Layer::Create(); |
| 6519 root->AddChild(child); | 6519 root->AddChild(child); |
| 6520 layer_tree()->SetRootLayer(root); | 6520 layer_tree_host()->SetRootLayer(root); |
| 6521 LayerTreeHostTest::SetupTree(); | 6521 LayerTreeHostTest::SetupTree(); |
| 6522 } | 6522 } |
| 6523 | 6523 |
| 6524 static void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} | 6524 static void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} |
| 6525 | 6525 |
| 6526 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6526 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 6527 | 6527 |
| 6528 void WillCommit() override { | 6528 void WillCommit() override { |
| 6529 switch (layer_tree_host()->SourceFrameNumber()) { | 6529 switch (layer_tree_host()->SourceFrameNumber()) { |
| 6530 case 1: | 6530 case 1: |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6605 clipping_origin.OffsetFromOrigin()); | 6605 clipping_origin.OffsetFromOrigin()); |
| 6606 | 6606 |
| 6607 gfx::Size child_size(50, 50); | 6607 gfx::Size child_size(50, 50); |
| 6608 content_child_layer->SetBounds(child_size); | 6608 content_child_layer->SetBounds(child_size); |
| 6609 content_child_layer->SetPosition(gfx::PointF(20.f, 0.f)); | 6609 content_child_layer->SetPosition(gfx::PointF(20.f, 0.f)); |
| 6610 | 6610 |
| 6611 gfx::Size mask_size(100, 100); | 6611 gfx::Size mask_size(100, 100); |
| 6612 mask_layer->SetBounds(mask_size); | 6612 mask_layer->SetBounds(mask_size); |
| 6613 mask_layer->SetIsMask(true); | 6613 mask_layer->SetIsMask(true); |
| 6614 | 6614 |
| 6615 layer_tree()->SetRootLayer(root); | 6615 layer_tree_host()->SetRootLayer(root); |
| 6616 LayerTreeTest::SetupTree(); | 6616 LayerTreeTest::SetupTree(); |
| 6617 client_.set_bounds(root->bounds()); | 6617 client_.set_bounds(root->bounds()); |
| 6618 } | 6618 } |
| 6619 | 6619 |
| 6620 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6620 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 6621 | 6621 |
| 6622 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6622 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 6623 LayerTreeHostImpl::FrameData* frame_data, | 6623 LayerTreeHostImpl::FrameData* frame_data, |
| 6624 DrawResult draw_result) override { | 6624 DrawResult draw_result) override { |
| 6625 EXPECT_EQ(2u, frame_data->render_passes.size()); | 6625 EXPECT_EQ(2u, frame_data->render_passes.size()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6690 scaling_layer->SetBounds(scaling_layer_size); | 6690 scaling_layer->SetBounds(scaling_layer_size); |
| 6691 gfx::Transform scale; | 6691 gfx::Transform scale; |
| 6692 scale.Scale(2.f, 2.f); | 6692 scale.Scale(2.f, 2.f); |
| 6693 scaling_layer->SetTransform(scale); | 6693 scaling_layer->SetTransform(scale); |
| 6694 | 6694 |
| 6695 content_layer->SetBounds(scaling_layer_size); | 6695 content_layer->SetBounds(scaling_layer_size); |
| 6696 | 6696 |
| 6697 mask_layer->SetBounds(scaling_layer_size); | 6697 mask_layer->SetBounds(scaling_layer_size); |
| 6698 mask_layer->SetIsMask(true); | 6698 mask_layer->SetIsMask(true); |
| 6699 | 6699 |
| 6700 layer_tree()->SetRootLayer(root); | 6700 layer_tree_host()->SetRootLayer(root); |
| 6701 LayerTreeTest::SetupTree(); | 6701 LayerTreeTest::SetupTree(); |
| 6702 client_.set_bounds(root->bounds()); | 6702 client_.set_bounds(root->bounds()); |
| 6703 } | 6703 } |
| 6704 | 6704 |
| 6705 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6705 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 6706 | 6706 |
| 6707 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6707 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 6708 LayerTreeHostImpl::FrameData* frame_data, | 6708 LayerTreeHostImpl::FrameData* frame_data, |
| 6709 DrawResult draw_result) override { | 6709 DrawResult draw_result) override { |
| 6710 EXPECT_EQ(2u, frame_data->render_passes.size()); | 6710 EXPECT_EQ(2u, frame_data->render_passes.size()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 6740 EndTest(); | 6740 EndTest(); |
| 6741 break; | 6741 break; |
| 6742 } | 6742 } |
| 6743 return draw_result; | 6743 return draw_result; |
| 6744 } | 6744 } |
| 6745 | 6745 |
| 6746 void DidCommit() override { | 6746 void DidCommit() override { |
| 6747 switch (layer_tree_host()->SourceFrameNumber()) { | 6747 switch (layer_tree_host()->SourceFrameNumber()) { |
| 6748 case 1: | 6748 case 1: |
| 6749 gfx::Size double_root_size(200, 200); | 6749 gfx::Size double_root_size(200, 200); |
| 6750 layer_tree()->SetViewportSize(double_root_size); | 6750 layer_tree_host()->SetViewportSize(double_root_size); |
| 6751 layer_tree()->SetDeviceScaleFactor(2.f); | 6751 layer_tree_host()->SetDeviceScaleFactor(2.f); |
| 6752 break; | 6752 break; |
| 6753 } | 6753 } |
| 6754 } | 6754 } |
| 6755 | 6755 |
| 6756 void AfterTest() override {} | 6756 void AfterTest() override {} |
| 6757 | 6757 |
| 6758 FakeContentLayerClient client_; | 6758 FakeContentLayerClient client_; |
| 6759 }; | 6759 }; |
| 6760 | 6760 |
| 6761 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling); | 6761 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 6779 gfx::Size root_size(100, 100); | 6779 gfx::Size root_size(100, 100); |
| 6780 root->SetBounds(root_size); | 6780 root->SetBounds(root_size); |
| 6781 | 6781 |
| 6782 gfx::Size layer_size(50, 50); | 6782 gfx::Size layer_size(50, 50); |
| 6783 content_layer->SetBounds(layer_size); | 6783 content_layer->SetBounds(layer_size); |
| 6784 | 6784 |
| 6785 gfx::Size mask_size(100, 100); | 6785 gfx::Size mask_size(100, 100); |
| 6786 mask_layer->SetBounds(mask_size); | 6786 mask_layer->SetBounds(mask_size); |
| 6787 mask_layer->SetIsMask(true); | 6787 mask_layer->SetIsMask(true); |
| 6788 | 6788 |
| 6789 layer_tree()->SetRootLayer(root); | 6789 layer_tree_host()->SetRootLayer(root); |
| 6790 LayerTreeTest::SetupTree(); | 6790 LayerTreeTest::SetupTree(); |
| 6791 client_.set_bounds(root->bounds()); | 6791 client_.set_bounds(root->bounds()); |
| 6792 } | 6792 } |
| 6793 | 6793 |
| 6794 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6794 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 6795 | 6795 |
| 6796 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6796 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 6797 LayerTreeHostImpl::FrameData* frame_data, | 6797 LayerTreeHostImpl::FrameData* frame_data, |
| 6798 DrawResult draw_result) override { | 6798 DrawResult draw_result) override { |
| 6799 EXPECT_EQ(2u, frame_data->render_passes.size()); | 6799 EXPECT_EQ(2u, frame_data->render_passes.size()); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 6828 EndTest(); | 6828 EndTest(); |
| 6829 break; | 6829 break; |
| 6830 } | 6830 } |
| 6831 return draw_result; | 6831 return draw_result; |
| 6832 } | 6832 } |
| 6833 | 6833 |
| 6834 void DidCommit() override { | 6834 void DidCommit() override { |
| 6835 switch (layer_tree_host()->SourceFrameNumber()) { | 6835 switch (layer_tree_host()->SourceFrameNumber()) { |
| 6836 case 1: | 6836 case 1: |
| 6837 gfx::Size double_root_size(200, 200); | 6837 gfx::Size double_root_size(200, 200); |
| 6838 layer_tree()->SetViewportSize(double_root_size); | 6838 layer_tree_host()->SetViewportSize(double_root_size); |
| 6839 layer_tree()->SetDeviceScaleFactor(2.f); | 6839 layer_tree_host()->SetDeviceScaleFactor(2.f); |
| 6840 break; | 6840 break; |
| 6841 } | 6841 } |
| 6842 } | 6842 } |
| 6843 | 6843 |
| 6844 void AfterTest() override {} | 6844 void AfterTest() override {} |
| 6845 | 6845 |
| 6846 FakeContentLayerClient client_; | 6846 FakeContentLayerClient client_; |
| 6847 }; | 6847 }; |
| 6848 | 6848 |
| 6849 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds); | 6849 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 6868 scoped_refptr<Layer> post_page_scale = Layer::Create(); | 6868 scoped_refptr<Layer> post_page_scale = Layer::Create(); |
| 6869 | 6869 |
| 6870 root->AddChild(pre_page_scale); | 6870 root->AddChild(pre_page_scale); |
| 6871 root->AddChild(page_scale); | 6871 root->AddChild(page_scale); |
| 6872 root->AddChild(post_page_scale); | 6872 root->AddChild(post_page_scale); |
| 6873 | 6873 |
| 6874 page_scale->AddChild(page_scale_child1); | 6874 page_scale->AddChild(page_scale_child1); |
| 6875 page_scale->AddChild(page_scale_child2); | 6875 page_scale->AddChild(page_scale_child2); |
| 6876 page_scale_child1->AddChild(page_scale_grandchild); | 6876 page_scale_child1->AddChild(page_scale_grandchild); |
| 6877 | 6877 |
| 6878 layer_tree()->SetRootLayer(root); | 6878 layer_tree_host()->SetRootLayer(root); |
| 6879 LayerTreeTest::SetupTree(); | 6879 LayerTreeTest::SetupTree(); |
| 6880 | 6880 |
| 6881 scoped_refptr<Layer> overscroll_elasticity_layer = nullptr; | 6881 scoped_refptr<Layer> overscroll_elasticity_layer = nullptr; |
| 6882 scoped_refptr<Layer> inner_viewport_scroll_layer = nullptr; | 6882 scoped_refptr<Layer> inner_viewport_scroll_layer = nullptr; |
| 6883 scoped_refptr<Layer> outer_viewport_scroll_layer = nullptr; | 6883 scoped_refptr<Layer> outer_viewport_scroll_layer = nullptr; |
| 6884 layer_tree()->RegisterViewportLayers( | 6884 layer_tree_host()->RegisterViewportLayers( |
| 6885 overscroll_elasticity_layer, page_scale, inner_viewport_scroll_layer, | 6885 overscroll_elasticity_layer, page_scale, inner_viewport_scroll_layer, |
| 6886 outer_viewport_scroll_layer); | 6886 outer_viewport_scroll_layer); |
| 6887 | 6887 |
| 6888 affected_by_page_scale_.push_back(page_scale->id()); | 6888 affected_by_page_scale_.push_back(page_scale->id()); |
| 6889 affected_by_page_scale_.push_back(page_scale_child1->id()); | 6889 affected_by_page_scale_.push_back(page_scale_child1->id()); |
| 6890 affected_by_page_scale_.push_back(page_scale_child2->id()); | 6890 affected_by_page_scale_.push_back(page_scale_child2->id()); |
| 6891 affected_by_page_scale_.push_back(page_scale_grandchild->id()); | 6891 affected_by_page_scale_.push_back(page_scale_grandchild->id()); |
| 6892 | 6892 |
| 6893 not_affected_by_page_scale_.push_back(root->id()); | 6893 not_affected_by_page_scale_.push_back(root->id()); |
| 6894 not_affected_by_page_scale_.push_back(pre_page_scale->id()); | 6894 not_affected_by_page_scale_.push_back(pre_page_scale->id()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6933 void AfterTest() override {} | 6933 void AfterTest() override {} |
| 6934 }; | 6934 }; |
| 6935 | 6935 |
| 6936 MULTI_THREAD_TEST_F(LayerTreeHostTestDestroyWhileInitializingOutputSurface); | 6936 MULTI_THREAD_TEST_F(LayerTreeHostTestDestroyWhileInitializingOutputSurface); |
| 6937 | 6937 |
| 6938 // Makes sure that painted_device_scale_factor is propagated to the | 6938 // Makes sure that painted_device_scale_factor is propagated to the |
| 6939 // frame's metadata. | 6939 // frame's metadata. |
| 6940 class LayerTreeHostTestPaintedDeviceScaleFactor : public LayerTreeHostTest { | 6940 class LayerTreeHostTestPaintedDeviceScaleFactor : public LayerTreeHostTest { |
| 6941 protected: | 6941 protected: |
| 6942 void BeginTest() override { | 6942 void BeginTest() override { |
| 6943 layer_tree()->SetPaintedDeviceScaleFactor(2.0f); | 6943 layer_tree_host()->SetPaintedDeviceScaleFactor(2.0f); |
| 6944 EXPECT_EQ(1.0f, layer_tree()->device_scale_factor()); | 6944 EXPECT_EQ(1.0f, layer_tree_host()->device_scale_factor()); |
| 6945 PostSetNeedsCommitToMainThread(); | 6945 PostSetNeedsCommitToMainThread(); |
| 6946 } | 6946 } |
| 6947 | 6947 |
| 6948 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6948 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 6949 LayerTreeHostImpl::FrameData* frame_data, | 6949 LayerTreeHostImpl::FrameData* frame_data, |
| 6950 DrawResult draw_result) override { | 6950 DrawResult draw_result) override { |
| 6951 EXPECT_EQ(DRAW_SUCCESS, draw_result); | 6951 EXPECT_EQ(DRAW_SUCCESS, draw_result); |
| 6952 EXPECT_EQ(2.0f, host_impl->active_tree()->painted_device_scale_factor()); | 6952 EXPECT_EQ(2.0f, host_impl->active_tree()->painted_device_scale_factor()); |
| 6953 EXPECT_EQ(1.0f, host_impl->active_tree()->device_scale_factor()); | 6953 EXPECT_EQ(1.0f, host_impl->active_tree()->device_scale_factor()); |
| 6954 return draw_result; | 6954 return draw_result; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6998 recording->SetGenerateDiscardableImagesMetadata(true); | 6998 recording->SetGenerateDiscardableImagesMetadata(true); |
| 6999 recording->Rerecord(); | 6999 recording->Rerecord(); |
| 7000 | 7000 |
| 7001 scoped_refptr<FakePictureLayer> root = | 7001 scoped_refptr<FakePictureLayer> root = |
| 7002 FakePictureLayer::CreateWithRecordingSource(&client_, | 7002 FakePictureLayer::CreateWithRecordingSource(&client_, |
| 7003 std::move(recording)); | 7003 std::move(recording)); |
| 7004 root->SetBounds(gfx::Size(10000, 10000)); | 7004 root->SetBounds(gfx::Size(10000, 10000)); |
| 7005 client_.set_bounds(root->bounds()); | 7005 client_.set_bounds(root->bounds()); |
| 7006 root->SetContentsOpaque(true); | 7006 root->SetContentsOpaque(true); |
| 7007 | 7007 |
| 7008 layer_tree()->SetRootLayer(root); | 7008 layer_tree_host()->SetRootLayer(root); |
| 7009 LayerTreeHostTest::SetupTree(); | 7009 LayerTreeHostTest::SetupTree(); |
| 7010 layer_tree()->SetViewportSize(viewport_size_); | 7010 layer_tree_host()->SetViewportSize(viewport_size_); |
| 7011 client_.set_bounds(root->bounds()); | 7011 client_.set_bounds(root->bounds()); |
| 7012 } | 7012 } |
| 7013 | 7013 |
| 7014 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, | 7014 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, |
| 7015 bool success) override { | 7015 bool success) override { |
| 7016 // Check that our large_image_size_ is greater than max texture size. We do | 7016 // Check that our large_image_size_ is greater than max texture size. We do |
| 7017 // this here to ensure that our otuput surface exists. | 7017 // this here to ensure that our otuput surface exists. |
| 7018 | 7018 |
| 7019 // Retrieve max texture size from Skia. | 7019 // Retrieve max texture size from Skia. |
| 7020 ContextProvider* context_provider = | 7020 ContextProvider* context_provider = |
| (...skipping 18 matching lines...) Expand all Loading... |
| 7039 FakeContentLayerClient client_; | 7039 FakeContentLayerClient client_; |
| 7040 const gfx::Size viewport_size_; | 7040 const gfx::Size viewport_size_; |
| 7041 const gfx::Size large_image_size_; | 7041 const gfx::Size large_image_size_; |
| 7042 }; | 7042 }; |
| 7043 | 7043 |
| 7044 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage); | 7044 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage); |
| 7045 | 7045 |
| 7046 class LayerTreeHostTestSubmitFrameMetadata : public LayerTreeHostTest { | 7046 class LayerTreeHostTestSubmitFrameMetadata : public LayerTreeHostTest { |
| 7047 protected: | 7047 protected: |
| 7048 void BeginTest() override { | 7048 void BeginTest() override { |
| 7049 layer_tree()->SetPageScaleFactorAndLimits(1.f, 0.5f, 4.f); | 7049 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 4.f); |
| 7050 PostSetNeedsCommitToMainThread(); | 7050 PostSetNeedsCommitToMainThread(); |
| 7051 } | 7051 } |
| 7052 | 7052 |
| 7053 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 7053 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 7054 LayerTreeHostImpl::FrameData* frame_data, | 7054 LayerTreeHostImpl::FrameData* frame_data, |
| 7055 DrawResult draw_result) override { | 7055 DrawResult draw_result) override { |
| 7056 EXPECT_EQ(DRAW_SUCCESS, draw_result); | 7056 EXPECT_EQ(DRAW_SUCCESS, draw_result); |
| 7057 EXPECT_EQ(0, num_swaps_); | 7057 EXPECT_EQ(0, num_swaps_); |
| 7058 drawn_viewport_ = host_impl->DeviceViewport(); | 7058 drawn_viewport_ = host_impl->DeviceViewport(); |
| 7059 return draw_result; | 7059 return draw_result; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7117 EndTest(); | 7117 EndTest(); |
| 7118 } | 7118 } |
| 7119 | 7119 |
| 7120 void AfterTest() override {} | 7120 void AfterTest() override {} |
| 7121 }; | 7121 }; |
| 7122 | 7122 |
| 7123 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); | 7123 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); |
| 7124 | 7124 |
| 7125 } // namespace | 7125 } // namespace |
| 7126 } // namespace cc | 7126 } // namespace cc |
| OLD | NEW |