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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 class LayerTreeHostTestReadyToActivateNonEmpty | 260 class LayerTreeHostTestReadyToActivateNonEmpty |
261 : public LayerTreeHostTestReadyToActivateEmpty { | 261 : public LayerTreeHostTestReadyToActivateEmpty { |
262 public: | 262 public: |
263 void SetupTree() override { | 263 void SetupTree() override { |
264 client_.set_fill_with_nonsolid_color(true); | 264 client_.set_fill_with_nonsolid_color(true); |
265 scoped_refptr<FakePictureLayer> root_layer = | 265 scoped_refptr<FakePictureLayer> root_layer = |
266 FakePictureLayer::Create(&client_); | 266 FakePictureLayer::Create(&client_); |
267 root_layer->SetBounds(gfx::Size(1024, 1024)); | 267 root_layer->SetBounds(gfx::Size(1024, 1024)); |
268 root_layer->SetIsDrawable(true); | 268 root_layer->SetIsDrawable(true); |
269 | 269 |
270 layer_tree_host()->SetRootLayer(root_layer); | 270 layer_tree()->SetRootLayer(root_layer); |
271 LayerTreeHostTest::SetupTree(); | 271 LayerTreeHostTest::SetupTree(); |
272 client_.set_bounds(root_layer->bounds()); | 272 client_.set_bounds(root_layer->bounds()); |
273 } | 273 } |
274 | 274 |
275 void AfterTest() override { | 275 void AfterTest() override { |
276 EXPECT_TRUE(did_notify_ready_to_activate_); | 276 EXPECT_TRUE(did_notify_ready_to_activate_); |
277 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); | 277 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); |
278 EXPECT_LE(size_t(1), required_for_activation_count_); | 278 EXPECT_LE(size_t(1), required_for_activation_count_); |
279 } | 279 } |
280 | 280 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 class LayerTreeHostTestReadyToDrawNonEmpty | 331 class LayerTreeHostTestReadyToDrawNonEmpty |
332 : public LayerTreeHostTestReadyToDrawEmpty { | 332 : public LayerTreeHostTestReadyToDrawEmpty { |
333 public: | 333 public: |
334 void SetupTree() override { | 334 void SetupTree() override { |
335 client_.set_fill_with_nonsolid_color(true); | 335 client_.set_fill_with_nonsolid_color(true); |
336 scoped_refptr<FakePictureLayer> root_layer = | 336 scoped_refptr<FakePictureLayer> root_layer = |
337 FakePictureLayer::Create(&client_); | 337 FakePictureLayer::Create(&client_); |
338 root_layer->SetBounds(gfx::Size(1024, 1024)); | 338 root_layer->SetBounds(gfx::Size(1024, 1024)); |
339 root_layer->SetIsDrawable(true); | 339 root_layer->SetIsDrawable(true); |
340 | 340 |
341 layer_tree_host()->SetRootLayer(root_layer); | 341 layer_tree()->SetRootLayer(root_layer); |
342 LayerTreeHostTest::SetupTree(); | 342 LayerTreeHostTest::SetupTree(); |
343 client_.set_bounds(root_layer->bounds()); | 343 client_.set_bounds(root_layer->bounds()); |
344 } | 344 } |
345 | 345 |
346 void AfterTest() override { | 346 void AfterTest() override { |
347 EXPECT_TRUE(did_notify_ready_to_draw_); | 347 EXPECT_TRUE(did_notify_ready_to_draw_); |
348 EXPECT_TRUE(all_tiles_required_for_draw_are_ready_to_draw_); | 348 EXPECT_TRUE(all_tiles_required_for_draw_are_ready_to_draw_); |
349 EXPECT_LE(size_t(1), required_for_draw_count_); | 349 EXPECT_LE(size_t(1), required_for_draw_count_); |
350 } | 350 } |
351 | 351 |
(...skipping 18 matching lines...) Expand all Loading... |
370 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 370 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
371 | 371 |
372 void SetupTree() override { | 372 void SetupTree() override { |
373 client_.set_fill_with_nonsolid_color(true); | 373 client_.set_fill_with_nonsolid_color(true); |
374 scoped_refptr<FakePictureLayer> root_layer = | 374 scoped_refptr<FakePictureLayer> root_layer = |
375 FakePictureLayer::Create(&client_); | 375 FakePictureLayer::Create(&client_); |
376 root_layer->SetBounds(gfx::Size(1024, 1024)); | 376 root_layer->SetBounds(gfx::Size(1024, 1024)); |
377 client_.set_bounds(root_layer->bounds()); | 377 client_.set_bounds(root_layer->bounds()); |
378 root_layer->SetIsDrawable(true); | 378 root_layer->SetIsDrawable(true); |
379 | 379 |
380 layer_tree_host()->SetRootLayer(root_layer); | 380 layer_tree()->SetRootLayer(root_layer); |
381 LayerTreeHostTest::SetupTree(); | 381 LayerTreeHostTest::SetupTree(); |
382 } | 382 } |
383 | 383 |
384 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 384 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
385 if (!toggled_visibility_) { | 385 if (!toggled_visibility_) { |
386 { | 386 { |
387 DebugScopedSetMainThread main(task_runner_provider()); | 387 DebugScopedSetMainThread main(task_runner_provider()); |
388 layer_tree_host()->SetVisible(false); | 388 layer_tree_host()->SetVisible(false); |
389 } | 389 } |
390 toggled_visibility_ = true; | 390 toggled_visibility_ = true; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 }; | 608 }; |
609 | 609 |
610 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit2); | 610 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit2); |
611 | 611 |
612 // Verify that we pass property values in PushPropertiesTo. | 612 // Verify that we pass property values in PushPropertiesTo. |
613 class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest { | 613 class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest { |
614 protected: | 614 protected: |
615 void SetupTree() override { | 615 void SetupTree() override { |
616 scoped_refptr<Layer> root = Layer::Create(); | 616 scoped_refptr<Layer> root = Layer::Create(); |
617 root->SetBounds(gfx::Size(10, 10)); | 617 root->SetBounds(gfx::Size(10, 10)); |
618 layer_tree_host()->SetRootLayer(root); | 618 layer_tree()->SetRootLayer(root); |
619 LayerTreeHostTest::SetupTree(); | 619 LayerTreeHostTest::SetupTree(); |
620 } | 620 } |
621 | 621 |
622 enum Properties { | 622 enum Properties { |
623 STARTUP, | 623 STARTUP, |
624 BOUNDS, | 624 BOUNDS, |
625 HIDE_LAYER_AND_SUBTREE, | 625 HIDE_LAYER_AND_SUBTREE, |
626 DRAWS_CONTENT, | 626 DRAWS_CONTENT, |
627 DONE, | 627 DONE, |
628 }; | 628 }; |
629 | 629 |
630 void BeginTest() override { | 630 void BeginTest() override { |
631 index_ = STARTUP; | 631 index_ = STARTUP; |
632 PostSetNeedsCommitToMainThread(); | 632 PostSetNeedsCommitToMainThread(); |
633 } | 633 } |
634 | 634 |
635 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 635 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
636 VerifyAfterValues(impl->active_tree()->root_layer_for_testing()); | 636 VerifyAfterValues(impl->active_tree()->root_layer_for_testing()); |
637 } | 637 } |
638 | 638 |
639 void DidCommitAndDrawFrame() override { | 639 void DidCommitAndDrawFrame() override { |
640 SetBeforeValues(layer_tree_host()->root_layer()); | 640 SetBeforeValues(layer_tree()->root_layer()); |
641 VerifyBeforeValues(layer_tree_host()->root_layer()); | 641 VerifyBeforeValues(layer_tree()->root_layer()); |
642 | 642 |
643 ++index_; | 643 ++index_; |
644 if (index_ == DONE) { | 644 if (index_ == DONE) { |
645 EndTest(); | 645 EndTest(); |
646 return; | 646 return; |
647 } | 647 } |
648 | 648 |
649 SetAfterValues(layer_tree_host()->root_layer()); | 649 SetAfterValues(layer_tree()->root_layer()); |
650 } | 650 } |
651 | 651 |
652 void AfterTest() override {} | 652 void AfterTest() override {} |
653 | 653 |
654 void VerifyBeforeValues(Layer* layer) { | 654 void VerifyBeforeValues(Layer* layer) { |
655 EXPECT_EQ(gfx::Size(10, 10).ToString(), layer->bounds().ToString()); | 655 EXPECT_EQ(gfx::Size(10, 10).ToString(), layer->bounds().ToString()); |
656 EXPECT_FALSE(layer->hide_layer_and_subtree()); | 656 EXPECT_FALSE(layer->hide_layer_and_subtree()); |
657 EXPECT_FALSE(layer->DrawsContent()); | 657 EXPECT_FALSE(layer->DrawsContent()); |
658 } | 658 } |
659 | 659 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 }; | 703 }; |
704 | 704 |
705 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); | 705 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); |
706 | 706 |
707 class LayerTreeHostTestPushNodeOwnerToNodeIdMap : public LayerTreeHostTest { | 707 class LayerTreeHostTestPushNodeOwnerToNodeIdMap : public LayerTreeHostTest { |
708 protected: | 708 protected: |
709 void SetupTree() override { | 709 void SetupTree() override { |
710 root_ = Layer::Create(); | 710 root_ = Layer::Create(); |
711 child_ = Layer::Create(); | 711 child_ = Layer::Create(); |
712 root_->AddChild(child_); | 712 root_->AddChild(child_); |
713 layer_tree_host()->SetRootLayer(root_); | 713 layer_tree()->SetRootLayer(root_); |
714 LayerTreeHostTest::SetupTree(); | 714 LayerTreeHostTest::SetupTree(); |
715 } | 715 } |
716 | 716 |
717 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 717 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
718 | 718 |
719 void DidCommit() override { | 719 void DidCommit() override { |
720 switch (layer_tree_host()->source_frame_number()) { | 720 switch (layer_tree_host()->source_frame_number()) { |
721 case 1: | 721 case 1: |
722 // child_ should create transform, effect, clip node. | 722 // child_ should create transform, effect, clip node. |
723 child_->SetForceRenderSurfaceForTesting(true); | 723 child_->SetForceRenderSurfaceForTesting(true); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 scoped_refptr<Layer> root_; | 823 scoped_refptr<Layer> root_; |
824 scoped_refptr<Layer> child_; | 824 scoped_refptr<Layer> child_; |
825 }; | 825 }; |
826 | 826 |
827 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushNodeOwnerToNodeIdMap); | 827 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushNodeOwnerToNodeIdMap); |
828 | 828 |
829 class LayerTreeHostTestDamageWithReplica : public LayerTreeHostTest { | 829 class LayerTreeHostTestDamageWithReplica : public LayerTreeHostTest { |
830 protected: | 830 protected: |
831 void SetupTree() override { | 831 void SetupTree() override { |
832 scoped_refptr<Layer> root = Layer::Create(); | 832 scoped_refptr<Layer> root = Layer::Create(); |
833 layer_tree_host()->SetRootLayer(root); | 833 layer_tree()->SetRootLayer(root); |
834 LayerTreeHostTest::SetupTree(); | 834 LayerTreeHostTest::SetupTree(); |
835 } | 835 } |
836 | 836 |
837 void BeginTest() override { | 837 void BeginTest() override { |
838 index_ = 0; | 838 index_ = 0; |
839 PostSetNeedsCommitToMainThread(); | 839 PostSetNeedsCommitToMainThread(); |
840 } | 840 } |
841 | 841 |
842 void DidCommit() override { | 842 void DidCommit() override { |
843 switch (layer_tree_host()->source_frame_number()) { | 843 switch (layer_tree_host()->source_frame_number()) { |
844 case 0: | 844 case 0: |
845 break; | 845 break; |
846 case 1: | 846 case 1: |
847 scoped_refptr<Layer> replica_layer = Layer::Create(); | 847 scoped_refptr<Layer> replica_layer = Layer::Create(); |
848 layer_tree_host()->root_layer()->SetReplicaLayer(replica_layer.get()); | 848 layer_tree()->root_layer()->SetReplicaLayer(replica_layer.get()); |
849 break; | 849 break; |
850 } | 850 } |
851 } | 851 } |
852 | 852 |
853 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 853 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
854 switch (index_) { | 854 switch (index_) { |
855 case 0: | 855 case 0: |
856 impl->sync_tree()->ResetAllChangeTracking(); | 856 impl->sync_tree()->ResetAllChangeTracking(); |
857 EXPECT_FALSE(impl->sync_tree() | 857 EXPECT_FALSE(impl->sync_tree() |
858 ->root_layer_for_testing() | 858 ->root_layer_for_testing() |
(...skipping 19 matching lines...) Expand all Loading... |
878 | 878 |
879 // Verify damage status of property trees is preserved after commit. | 879 // Verify damage status of property trees is preserved after commit. |
880 class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest { | 880 class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest { |
881 protected: | 881 protected: |
882 void SetupTree() override { | 882 void SetupTree() override { |
883 root_ = Layer::Create(); | 883 root_ = Layer::Create(); |
884 child_ = Layer::Create(); | 884 child_ = Layer::Create(); |
885 // This is to force the child to create a transform and effect node. | 885 // This is to force the child to create a transform and effect node. |
886 child_->SetForceRenderSurfaceForTesting(true); | 886 child_->SetForceRenderSurfaceForTesting(true); |
887 root_->AddChild(child_); | 887 root_->AddChild(child_); |
888 layer_tree_host()->SetRootLayer(root_); | 888 layer_tree()->SetRootLayer(root_); |
889 LayerTreeHostTest::SetupTree(); | 889 LayerTreeHostTest::SetupTree(); |
890 } | 890 } |
891 | 891 |
892 enum Animations { | 892 enum Animations { |
893 OPACITY, | 893 OPACITY, |
894 TRANSFORM, | 894 TRANSFORM, |
895 FILTER, | 895 FILTER, |
896 END, | 896 END, |
897 }; | 897 }; |
898 | 898 |
899 void BeginTest() override { | 899 void BeginTest() override { |
900 index_ = OPACITY; | 900 index_ = OPACITY; |
901 PostSetNeedsCommitToMainThread(); | 901 PostSetNeedsCommitToMainThread(); |
902 } | 902 } |
903 | 903 |
904 void DidCommit() override { | 904 void DidCommit() override { |
905 switch (layer_tree_host()->source_frame_number()) { | 905 switch (layer_tree_host()->source_frame_number()) { |
906 case 2: | 906 case 2: |
907 // We rebuild property trees for this case to test the code path of | 907 // We rebuild property trees for this case to test the code path of |
908 // damage status synchronization when property trees are different. | 908 // damage status synchronization when property trees are different. |
909 layer_tree_host()->property_trees()->needs_rebuild = true; | 909 layer_tree()->property_trees()->needs_rebuild = true; |
910 break; | 910 break; |
911 default: | 911 default: |
912 EXPECT_FALSE(layer_tree_host()->property_trees()->needs_rebuild); | 912 EXPECT_FALSE(layer_tree()->property_trees()->needs_rebuild); |
913 } | 913 } |
914 } | 914 } |
915 | 915 |
916 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 916 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
917 gfx::Transform transform; | 917 gfx::Transform transform; |
918 FilterOperations filters; | 918 FilterOperations filters; |
919 switch (static_cast<Animations>(index_)) { | 919 switch (static_cast<Animations>(index_)) { |
920 case OPACITY: | 920 case OPACITY: |
921 index_++; | 921 index_++; |
922 impl->active_tree()->ResetAllChangeTracking(); | 922 impl->active_tree()->ResetAllChangeTracking(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 scoped_refptr<Layer> root_; | 976 scoped_refptr<Layer> root_; |
977 scoped_refptr<Layer> child_; | 977 scoped_refptr<Layer> child_; |
978 }; | 978 }; |
979 | 979 |
980 SINGLE_THREAD_TEST_F(LayerTreeHostTestPropertyTreesChangedSync); | 980 SINGLE_THREAD_TEST_F(LayerTreeHostTestPropertyTreesChangedSync); |
981 | 981 |
982 class LayerTreeHostTestEffectTreeSync : public LayerTreeHostTest { | 982 class LayerTreeHostTestEffectTreeSync : public LayerTreeHostTest { |
983 protected: | 983 protected: |
984 void SetupTree() override { | 984 void SetupTree() override { |
985 root_ = Layer::Create(); | 985 root_ = Layer::Create(); |
986 layer_tree_host()->SetRootLayer(root_); | 986 layer_tree()->SetRootLayer(root_); |
987 blur_filter_.Append(FilterOperation::CreateBlurFilter(0.5f)); | 987 blur_filter_.Append(FilterOperation::CreateBlurFilter(0.5f)); |
988 brightness_filter_.Append(FilterOperation::CreateBrightnessFilter(0.25f)); | 988 brightness_filter_.Append(FilterOperation::CreateBrightnessFilter(0.25f)); |
989 sepia_filter_.Append(FilterOperation::CreateSepiaFilter(0.75f)); | 989 sepia_filter_.Append(FilterOperation::CreateSepiaFilter(0.75f)); |
990 LayerTreeHostTest::SetupTree(); | 990 LayerTreeHostTest::SetupTree(); |
991 } | 991 } |
992 | 992 |
993 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 993 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
994 | 994 |
995 void DidCommit() override { | 995 void DidCommit() override { |
996 EffectTree& effect_tree = layer_tree_host()->property_trees()->effect_tree; | 996 EffectTree& effect_tree = layer_tree()->property_trees()->effect_tree; |
997 EffectNode* node = effect_tree.Node(root_->effect_tree_index()); | 997 EffectNode* node = effect_tree.Node(root_->effect_tree_index()); |
998 switch (layer_tree_host()->source_frame_number()) { | 998 switch (layer_tree_host()->source_frame_number()) { |
999 case 1: | 999 case 1: |
1000 node->opacity = 0.5f; | 1000 node->opacity = 0.5f; |
1001 node->is_currently_animating_opacity = true; | 1001 node->is_currently_animating_opacity = true; |
1002 break; | 1002 break; |
1003 case 2: | 1003 case 2: |
1004 node->is_currently_animating_opacity = true; | 1004 node->is_currently_animating_opacity = true; |
1005 break; | 1005 break; |
1006 case 3: | 1006 case 3: |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 FilterOperations brightness_filter_; | 1084 FilterOperations brightness_filter_; |
1085 FilterOperations sepia_filter_; | 1085 FilterOperations sepia_filter_; |
1086 }; | 1086 }; |
1087 | 1087 |
1088 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestEffectTreeSync); | 1088 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestEffectTreeSync); |
1089 | 1089 |
1090 class LayerTreeHostTestTransformTreeSync : public LayerTreeHostTest { | 1090 class LayerTreeHostTestTransformTreeSync : public LayerTreeHostTest { |
1091 protected: | 1091 protected: |
1092 void SetupTree() override { | 1092 void SetupTree() override { |
1093 root_ = Layer::Create(); | 1093 root_ = Layer::Create(); |
1094 layer_tree_host()->SetRootLayer(root_); | 1094 layer_tree()->SetRootLayer(root_); |
1095 LayerTreeHostTest::SetupTree(); | 1095 LayerTreeHostTest::SetupTree(); |
1096 } | 1096 } |
1097 | 1097 |
1098 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1098 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1099 | 1099 |
1100 void DidCommit() override { | 1100 void DidCommit() override { |
1101 TransformTree& transform_tree = | 1101 TransformTree& transform_tree = |
1102 layer_tree_host()->property_trees()->transform_tree; | 1102 layer_tree()->property_trees()->transform_tree; |
1103 TransformNode* node = transform_tree.Node(root_->transform_tree_index()); | 1103 TransformNode* node = transform_tree.Node(root_->transform_tree_index()); |
1104 gfx::Transform rotate10; | 1104 gfx::Transform rotate10; |
1105 rotate10.Rotate(10.f); | 1105 rotate10.Rotate(10.f); |
1106 switch (layer_tree_host()->source_frame_number()) { | 1106 switch (layer_tree_host()->source_frame_number()) { |
1107 case 1: | 1107 case 1: |
1108 node->local = rotate10; | 1108 node->local = rotate10; |
1109 node->is_currently_animating = true; | 1109 node->is_currently_animating = true; |
1110 break; | 1110 break; |
1111 case 2: | 1111 case 2: |
1112 node->is_currently_animating = true; | 1112 node->is_currently_animating = true; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 root_->SetBounds(gfx::Size(50, 50)); | 1176 root_->SetBounds(gfx::Size(50, 50)); |
1177 | 1177 |
1178 // Make sure child and grand_child have transform nodes. | 1178 // Make sure child and grand_child have transform nodes. |
1179 gfx::Transform rotation; | 1179 gfx::Transform rotation; |
1180 rotation.RotateAboutZAxis(45.0); | 1180 rotation.RotateAboutZAxis(45.0); |
1181 child_->SetTransform(rotation); | 1181 child_->SetTransform(rotation); |
1182 grand_child_->SetTransform(rotation); | 1182 grand_child_->SetTransform(rotation); |
1183 | 1183 |
1184 root_->AddChild(child_); | 1184 root_->AddChild(child_); |
1185 child_->AddChild(grand_child_); | 1185 child_->AddChild(grand_child_); |
1186 layer_tree_host()->SetRootLayer(root_); | 1186 layer_tree()->SetRootLayer(root_); |
1187 LayerTreeHostTest::SetupTree(); | 1187 LayerTreeHostTest::SetupTree(); |
1188 } | 1188 } |
1189 | 1189 |
1190 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1190 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1191 | 1191 |
1192 void DidCommit() override { | 1192 void DidCommit() override { |
1193 if (layer_tree_host()->source_frame_number() == 1) { | 1193 if (layer_tree_host()->source_frame_number() == 1) { |
1194 gfx::Transform scale; | 1194 gfx::Transform scale; |
1195 scale.Scale(2.0, 2.0); | 1195 scale.Scale(2.0, 2.0); |
1196 LayerInternalsForTest(child_.get()).OnTransformAnimated(scale); | 1196 LayerInternalsForTest(child_.get()).OnTransformAnimated(scale); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 class LayerTreeHostTestSwitchMaskLayer : public LayerTreeHostTest { | 1243 class LayerTreeHostTestSwitchMaskLayer : public LayerTreeHostTest { |
1244 protected: | 1244 protected: |
1245 void SetupTree() override { | 1245 void SetupTree() override { |
1246 scoped_refptr<Layer> root = Layer::Create(); | 1246 scoped_refptr<Layer> root = Layer::Create(); |
1247 root->SetBounds(gfx::Size(10, 10)); | 1247 root->SetBounds(gfx::Size(10, 10)); |
1248 scoped_refptr<Layer> child = Layer::Create(); | 1248 scoped_refptr<Layer> child = Layer::Create(); |
1249 mask_layer = Layer::Create(); | 1249 mask_layer = Layer::Create(); |
1250 mask_layer->SetBounds(gfx::Size(10, 10)); | 1250 mask_layer->SetBounds(gfx::Size(10, 10)); |
1251 child->SetMaskLayer(mask_layer.get()); | 1251 child->SetMaskLayer(mask_layer.get()); |
1252 root->AddChild(std::move(child)); | 1252 root->AddChild(std::move(child)); |
1253 layer_tree_host()->SetRootLayer(root); | 1253 layer_tree()->SetRootLayer(root); |
1254 LayerTreeHostTest::SetupTree(); | 1254 LayerTreeHostTest::SetupTree(); |
1255 } | 1255 } |
1256 | 1256 |
1257 void BeginTest() override { | 1257 void BeginTest() override { |
1258 index_ = 0; | 1258 index_ = 0; |
1259 PostSetNeedsCommitToMainThread(); | 1259 PostSetNeedsCommitToMainThread(); |
1260 } | 1260 } |
1261 | 1261 |
1262 void DidCommit() override { | 1262 void DidCommit() override { |
1263 switch (layer_tree_host()->source_frame_number()) { | 1263 switch (layer_tree_host()->source_frame_number()) { |
1264 case 1: | 1264 case 1: |
1265 // Root and mask layer should have the same source frame number as they | 1265 // Root and mask layer should have the same source frame number as they |
1266 // will be in the layer update list but the child is not as it has empty | 1266 // will be in the layer update list but the child is not as it has empty |
1267 // bounds. | 1267 // bounds. |
1268 EXPECT_EQ(mask_layer->paint_properties().source_frame_number, | 1268 EXPECT_EQ( |
1269 layer_tree_host() | 1269 mask_layer->paint_properties().source_frame_number, |
1270 ->root_layer() | 1270 layer_tree()->root_layer()->paint_properties().source_frame_number); |
1271 ->paint_properties() | |
1272 .source_frame_number); | |
1273 EXPECT_NE(mask_layer->paint_properties().source_frame_number, | 1271 EXPECT_NE(mask_layer->paint_properties().source_frame_number, |
1274 layer_tree_host() | 1272 layer_tree() |
1275 ->root_layer() | 1273 ->root_layer() |
1276 ->child_at(0) | 1274 ->child_at(0) |
1277 ->paint_properties() | 1275 ->paint_properties() |
1278 .source_frame_number); | 1276 .source_frame_number); |
1279 layer_tree_host()->root_layer()->RemoveAllChildren(); | 1277 layer_tree()->root_layer()->RemoveAllChildren(); |
1280 layer_tree_host()->root_layer()->SetMaskLayer(mask_layer.get()); | 1278 layer_tree()->root_layer()->SetMaskLayer(mask_layer.get()); |
1281 break; | 1279 break; |
1282 } | 1280 } |
1283 } | 1281 } |
1284 | 1282 |
1285 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 1283 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
1286 switch (index_) { | 1284 switch (index_) { |
1287 case 0: | 1285 case 0: |
1288 index_++; | 1286 index_++; |
1289 EXPECT_FALSE(impl->sync_tree() | 1287 EXPECT_FALSE(impl->sync_tree() |
1290 ->root_layer_for_testing() | 1288 ->root_layer_for_testing() |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 // must contain invalid_rect. | 1347 // must contain invalid_rect. |
1350 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { | 1348 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { |
1351 public: | 1349 public: |
1352 LayerTreeHostTestSetNeedsRedrawRect() | 1350 LayerTreeHostTestSetNeedsRedrawRect() |
1353 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} | 1351 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} |
1354 | 1352 |
1355 void BeginTest() override { | 1353 void BeginTest() override { |
1356 root_layer_ = FakePictureLayer::Create(&client_); | 1354 root_layer_ = FakePictureLayer::Create(&client_); |
1357 root_layer_->SetIsDrawable(true); | 1355 root_layer_->SetIsDrawable(true); |
1358 root_layer_->SetBounds(bounds_); | 1356 root_layer_->SetBounds(bounds_); |
1359 layer_tree_host()->SetRootLayer(root_layer_); | 1357 layer_tree()->SetRootLayer(root_layer_); |
1360 layer_tree_host()->SetViewportSize(bounds_); | 1358 layer_tree()->SetViewportSize(bounds_); |
1361 PostSetNeedsCommitToMainThread(); | 1359 PostSetNeedsCommitToMainThread(); |
1362 client_.set_bounds(root_layer_->bounds()); | 1360 client_.set_bounds(root_layer_->bounds()); |
1363 } | 1361 } |
1364 | 1362 |
1365 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 1363 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
1366 LayerTreeHostImpl::FrameData* frame_data, | 1364 LayerTreeHostImpl::FrameData* frame_data, |
1367 DrawResult draw_result) override { | 1365 DrawResult draw_result) override { |
1368 EXPECT_EQ(DRAW_SUCCESS, draw_result); | 1366 EXPECT_EQ(DRAW_SUCCESS, draw_result); |
1369 | 1367 |
1370 gfx::Rect root_damage_rect; | 1368 gfx::Rect root_damage_rect; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 void BeginTest() override { | 1411 void BeginTest() override { |
1414 client_.set_fill_with_nonsolid_color(true); | 1412 client_.set_fill_with_nonsolid_color(true); |
1415 root_layer_ = FakePictureLayer::Create(&client_); | 1413 root_layer_ = FakePictureLayer::Create(&client_); |
1416 root_layer_->SetIsDrawable(true); | 1414 root_layer_->SetIsDrawable(true); |
1417 gfx::Transform transform; | 1415 gfx::Transform transform; |
1418 // Translate the layer out of the viewport to force it to not update its | 1416 // Translate the layer out of the viewport to force it to not update its |
1419 // tile size via PushProperties. | 1417 // tile size via PushProperties. |
1420 transform.Translate(10000.0, 10000.0); | 1418 transform.Translate(10000.0, 10000.0); |
1421 root_layer_->SetTransform(transform); | 1419 root_layer_->SetTransform(transform); |
1422 root_layer_->SetBounds(bounds_); | 1420 root_layer_->SetBounds(bounds_); |
1423 layer_tree_host()->SetRootLayer(root_layer_); | 1421 layer_tree()->SetRootLayer(root_layer_); |
1424 layer_tree_host()->SetViewportSize(bounds_); | 1422 layer_tree()->SetViewportSize(bounds_); |
1425 | 1423 |
1426 PostSetNeedsCommitToMainThread(); | 1424 PostSetNeedsCommitToMainThread(); |
1427 client_.set_bounds(root_layer_->bounds()); | 1425 client_.set_bounds(root_layer_->bounds()); |
1428 } | 1426 } |
1429 | 1427 |
1430 void InitializeSettings(LayerTreeSettings* settings) override { | 1428 void InitializeSettings(LayerTreeSettings* settings) override { |
1431 settings->gpu_rasterization_enabled = true; | 1429 settings->gpu_rasterization_enabled = true; |
1432 settings->gpu_rasterization_forced = true; | 1430 settings->gpu_rasterization_forced = true; |
1433 } | 1431 } |
1434 | 1432 |
(...skipping 23 matching lines...) Expand all Loading... |
1458 EXPECT_EQ( | 1456 EXPECT_EQ( |
1459 pending_tiling->TilingDataForTesting().max_texture_size().width(), | 1457 pending_tiling->TilingDataForTesting().max_texture_size().width(), |
1460 active_tiling->TilingDataForTesting().max_texture_size().width()); | 1458 active_tiling->TilingDataForTesting().max_texture_size().width()); |
1461 EndTest(); | 1459 EndTest(); |
1462 } | 1460 } |
1463 } | 1461 } |
1464 | 1462 |
1465 void DidCommitAndDrawFrame() override { | 1463 void DidCommitAndDrawFrame() override { |
1466 // On the second commit, resize the viewport. | 1464 // On the second commit, resize the viewport. |
1467 if (num_draws_ == 1) { | 1465 if (num_draws_ == 1) { |
1468 layer_tree_host()->SetViewportSize(gfx::Size(400, 64)); | 1466 layer_tree()->SetViewportSize(gfx::Size(400, 64)); |
1469 } | 1467 } |
1470 } | 1468 } |
1471 | 1469 |
1472 void AfterTest() override {} | 1470 void AfterTest() override {} |
1473 | 1471 |
1474 private: | 1472 private: |
1475 int num_draws_; | 1473 int num_draws_; |
1476 const gfx::Size bounds_; | 1474 const gfx::Size bounds_; |
1477 const gfx::Rect invalid_rect_; | 1475 const gfx::Rect invalid_rect_; |
1478 FakeContentLayerClient client_; | 1476 FakeContentLayerClient client_; |
(...skipping 12 matching lines...) Expand all Loading... |
1491 } | 1489 } |
1492 | 1490 |
1493 void SetupTree() override { | 1491 void SetupTree() override { |
1494 root_layer_ = Layer::Create(); | 1492 root_layer_ = Layer::Create(); |
1495 root_layer_->SetBounds(gfx::Size(10, 20)); | 1493 root_layer_->SetBounds(gfx::Size(10, 20)); |
1496 | 1494 |
1497 scaled_layer_ = FakePictureLayer::Create(&client_); | 1495 scaled_layer_ = FakePictureLayer::Create(&client_); |
1498 scaled_layer_->SetBounds(gfx::Size(1, 1)); | 1496 scaled_layer_->SetBounds(gfx::Size(1, 1)); |
1499 root_layer_->AddChild(scaled_layer_); | 1497 root_layer_->AddChild(scaled_layer_); |
1500 | 1498 |
1501 layer_tree_host()->SetRootLayer(root_layer_); | 1499 layer_tree()->SetRootLayer(root_layer_); |
1502 LayerTreeHostTest::SetupTree(); | 1500 LayerTreeHostTest::SetupTree(); |
1503 client_.set_bounds(root_layer_->bounds()); | 1501 client_.set_bounds(root_layer_->bounds()); |
1504 } | 1502 } |
1505 | 1503 |
1506 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1504 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1507 | 1505 |
1508 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 1506 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
1509 if (host_impl->active_tree()->source_frame_number() == 1) | 1507 if (host_impl->active_tree()->source_frame_number() == 1) |
1510 EndTest(); | 1508 EndTest(); |
1511 } | 1509 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1547 | 1545 |
1548 bool paint_scrollbar = true; | 1546 bool paint_scrollbar = true; |
1549 bool has_thumb = false; | 1547 bool has_thumb = false; |
1550 scrollbar_ = FakePaintedScrollbarLayer::Create(paint_scrollbar, has_thumb, | 1548 scrollbar_ = FakePaintedScrollbarLayer::Create(paint_scrollbar, has_thumb, |
1551 root_layer_->id()); | 1549 root_layer_->id()); |
1552 scrollbar_->SetPosition(gfx::PointF(0.f, 10.f)); | 1550 scrollbar_->SetPosition(gfx::PointF(0.f, 10.f)); |
1553 scrollbar_->SetBounds(gfx::Size(10, 10)); | 1551 scrollbar_->SetBounds(gfx::Size(10, 10)); |
1554 | 1552 |
1555 root_layer_->AddChild(scrollbar_); | 1553 root_layer_->AddChild(scrollbar_); |
1556 | 1554 |
1557 layer_tree_host()->SetRootLayer(root_layer_); | 1555 layer_tree()->SetRootLayer(root_layer_); |
1558 LayerTreeHostTest::SetupTree(); | 1556 LayerTreeHostTest::SetupTree(); |
1559 client_.set_bounds(root_layer_->bounds()); | 1557 client_.set_bounds(root_layer_->bounds()); |
1560 } | 1558 } |
1561 | 1559 |
1562 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1560 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1563 | 1561 |
1564 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 1562 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
1565 if (host_impl->active_tree()->source_frame_number() == 1) | 1563 if (host_impl->active_tree()->source_frame_number() == 1) |
1566 EndTest(); | 1564 EndTest(); |
1567 } | 1565 } |
1568 | 1566 |
1569 void DidCommit() override { | 1567 void DidCommit() override { |
1570 switch (layer_tree_host()->source_frame_number()) { | 1568 switch (layer_tree_host()->source_frame_number()) { |
1571 case 1: | 1569 case 1: |
1572 // Changing the device scale factor causes a commit. It also changes | 1570 // Changing the device scale factor causes a commit. It also changes |
1573 // the content bounds of |scrollbar_|, which should not generate | 1571 // the content bounds of |scrollbar_|, which should not generate |
1574 // a second commit as a result. | 1572 // a second commit as a result. |
1575 layer_tree_host()->SetDeviceScaleFactor(4.f); | 1573 layer_tree()->SetDeviceScaleFactor(4.f); |
1576 break; | 1574 break; |
1577 default: | 1575 default: |
1578 // No extra commits. | 1576 // No extra commits. |
1579 EXPECT_EQ(2, layer_tree_host()->source_frame_number()); | 1577 EXPECT_EQ(2, layer_tree_host()->source_frame_number()); |
1580 break; | 1578 break; |
1581 } | 1579 } |
1582 } | 1580 } |
1583 | 1581 |
1584 void AfterTest() override {} | 1582 void AfterTest() override {} |
1585 | 1583 |
(...skipping 13 matching lines...) Expand all Loading... |
1599 } | 1597 } |
1600 | 1598 |
1601 void SetupTree() override { | 1599 void SetupTree() override { |
1602 root_layer_ = Layer::Create(); | 1600 root_layer_ = Layer::Create(); |
1603 root_layer_->SetBounds(gfx::Size(10, 20)); | 1601 root_layer_->SetBounds(gfx::Size(10, 20)); |
1604 | 1602 |
1605 child_layer_ = FakePictureLayer::Create(&client_); | 1603 child_layer_ = FakePictureLayer::Create(&client_); |
1606 child_layer_->SetBounds(gfx::Size(10, 10)); | 1604 child_layer_->SetBounds(gfx::Size(10, 10)); |
1607 root_layer_->AddChild(child_layer_); | 1605 root_layer_->AddChild(child_layer_); |
1608 | 1606 |
1609 layer_tree_host()->SetRootLayer(root_layer_); | 1607 layer_tree()->SetRootLayer(root_layer_); |
1610 LayerTreeHostTest::SetupTree(); | 1608 LayerTreeHostTest::SetupTree(); |
1611 client_.set_bounds(root_layer_->bounds()); | 1609 client_.set_bounds(root_layer_->bounds()); |
1612 } | 1610 } |
1613 | 1611 |
1614 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1612 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1615 | 1613 |
1616 void DidCommit() override { | 1614 void DidCommit() override { |
1617 if (layer_tree_host()->source_frame_number() == 1) | 1615 if (layer_tree_host()->source_frame_number() == 1) |
1618 layer_tree_host()->SetDeviceScaleFactor(4.f); | 1616 layer_tree()->SetDeviceScaleFactor(4.f); |
1619 } | 1617 } |
1620 | 1618 |
1621 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 1619 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
1622 if (host_impl->sync_tree()->source_frame_number() == 1) { | 1620 if (host_impl->sync_tree()->source_frame_number() == 1) { |
1623 EXPECT_EQ(4.f, host_impl->sync_tree()->device_scale_factor()); | 1621 EXPECT_EQ(4.f, host_impl->sync_tree()->device_scale_factor()); |
1624 if (host_impl->pending_tree()) { | 1622 if (host_impl->pending_tree()) { |
1625 // The active tree's device scale factor shouldn't change until | 1623 // The active tree's device scale factor shouldn't change until |
1626 // activation. | 1624 // activation. |
1627 EXPECT_EQ(1.f, host_impl->active_tree()->device_scale_factor()); | 1625 EXPECT_EQ(1.f, host_impl->active_tree()->device_scale_factor()); |
1628 } | 1626 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1660 | 1658 |
1661 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { | 1659 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { |
1662 public: | 1660 public: |
1663 LayerTreeHostTestSetNextCommitForcesRedraw() | 1661 LayerTreeHostTestSetNextCommitForcesRedraw() |
1664 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} | 1662 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} |
1665 | 1663 |
1666 void BeginTest() override { | 1664 void BeginTest() override { |
1667 root_layer_ = FakePictureLayer::Create(&client_); | 1665 root_layer_ = FakePictureLayer::Create(&client_); |
1668 root_layer_->SetIsDrawable(true); | 1666 root_layer_->SetIsDrawable(true); |
1669 root_layer_->SetBounds(bounds_); | 1667 root_layer_->SetBounds(bounds_); |
1670 layer_tree_host()->SetRootLayer(root_layer_); | 1668 layer_tree()->SetRootLayer(root_layer_); |
1671 layer_tree_host()->SetViewportSize(bounds_); | 1669 layer_tree()->SetViewportSize(bounds_); |
1672 PostSetNeedsCommitToMainThread(); | 1670 PostSetNeedsCommitToMainThread(); |
1673 client_.set_bounds(root_layer_->bounds()); | 1671 client_.set_bounds(root_layer_->bounds()); |
1674 } | 1672 } |
1675 | 1673 |
1676 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 1674 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
1677 if (num_draws_ == 3) | 1675 if (num_draws_ == 3) |
1678 host_impl->SetNeedsRedrawRect(invalid_rect_); | 1676 host_impl->SetNeedsRedrawRect(invalid_rect_); |
1679 } | 1677 } |
1680 | 1678 |
1681 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 1679 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1753 // If we don't set the minimum contents scale, it's harder to verify whether | 1751 // If we don't set the minimum contents scale, it's harder to verify whether |
1754 // the damage we get is correct. For other scale amounts, please see | 1752 // the damage we get is correct. For other scale amounts, please see |
1755 // LayerTreeHostTestDamageWithScale. | 1753 // LayerTreeHostTestDamageWithScale. |
1756 settings->minimum_contents_scale = 1.f; | 1754 settings->minimum_contents_scale = 1.f; |
1757 } | 1755 } |
1758 | 1756 |
1759 void SetupTree() override { | 1757 void SetupTree() override { |
1760 root_layer_ = FakePictureLayer::Create(&client_); | 1758 root_layer_ = FakePictureLayer::Create(&client_); |
1761 root_layer_->SetIsDrawable(true); | 1759 root_layer_->SetIsDrawable(true); |
1762 root_layer_->SetBounds(gfx::Size(50, 50)); | 1760 root_layer_->SetBounds(gfx::Size(50, 50)); |
1763 layer_tree_host()->SetRootLayer(root_layer_); | 1761 layer_tree()->SetRootLayer(root_layer_); |
1764 | 1762 |
1765 // The initially transparent layer has a larger child layer, which is | 1763 // The initially transparent layer has a larger child layer, which is |
1766 // not initially drawn because of the this (parent) layer. | 1764 // not initially drawn because of the this (parent) layer. |
1767 parent_layer_ = FakePictureLayer::Create(&client_); | 1765 parent_layer_ = FakePictureLayer::Create(&client_); |
1768 parent_layer_->SetBounds(gfx::Size(15, 15)); | 1766 parent_layer_->SetBounds(gfx::Size(15, 15)); |
1769 parent_layer_->SetOpacity(0.0f); | 1767 parent_layer_->SetOpacity(0.0f); |
1770 root_layer_->AddChild(parent_layer_); | 1768 root_layer_->AddChild(parent_layer_); |
1771 | 1769 |
1772 child_layer_ = FakePictureLayer::Create(&client_); | 1770 child_layer_ = FakePictureLayer::Create(&client_); |
1773 child_layer_->SetBounds(gfx::Size(25, 25)); | 1771 child_layer_->SetBounds(gfx::Size(25, 25)); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1857 root_layer_->SetBounds(gfx::Size(50, 50)); | 1855 root_layer_->SetBounds(gfx::Size(50, 50)); |
1858 | 1856 |
1859 recording.reset(new FakeRecordingSource); | 1857 recording.reset(new FakeRecordingSource); |
1860 child_layer_ = FakePictureLayer::CreateWithRecordingSource( | 1858 child_layer_ = FakePictureLayer::CreateWithRecordingSource( |
1861 &client_, std::move(recording)); | 1859 &client_, std::move(recording)); |
1862 child_layer_->SetBounds(gfx::Size(25, 25)); | 1860 child_layer_->SetBounds(gfx::Size(25, 25)); |
1863 child_layer_->SetIsDrawable(true); | 1861 child_layer_->SetIsDrawable(true); |
1864 child_layer_->SetContentsOpaque(true); | 1862 child_layer_->SetContentsOpaque(true); |
1865 root_layer_->AddChild(child_layer_); | 1863 root_layer_->AddChild(child_layer_); |
1866 | 1864 |
1867 layer_tree_host()->SetRootLayer(root_layer_); | 1865 layer_tree()->SetRootLayer(root_layer_); |
1868 LayerTreeHostTest::SetupTree(); | 1866 LayerTreeHostTest::SetupTree(); |
1869 client_.set_bounds(root_layer_->bounds()); | 1867 client_.set_bounds(root_layer_->bounds()); |
1870 } | 1868 } |
1871 | 1869 |
1872 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 1870 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
1873 // Force the layer to have a tiling at 1.3f scale. Note that if we simply | 1871 // Force the layer to have a tiling at 1.3f scale. Note that if we simply |
1874 // add tiling, it will be gone by the time we draw because of aggressive | 1872 // add tiling, it will be gone by the time we draw because of aggressive |
1875 // cleanup. AddTilingUntilNextDraw ensures that it remains there during | 1873 // cleanup. AddTilingUntilNextDraw ensures that it remains there during |
1876 // damage calculation. | 1874 // damage calculation. |
1877 FakePictureLayerImpl* child_layer_impl = static_cast<FakePictureLayerImpl*>( | 1875 FakePictureLayerImpl* child_layer_impl = static_cast<FakePictureLayerImpl*>( |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1947 | 1945 |
1948 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDamageWithScale); | 1946 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDamageWithScale); |
1949 | 1947 |
1950 // This test verifies that properties on the layer tree host are commited | 1948 // This test verifies that properties on the layer tree host are commited |
1951 // to the impl side. | 1949 // to the impl side. |
1952 class LayerTreeHostTestCommit : public LayerTreeHostTest { | 1950 class LayerTreeHostTestCommit : public LayerTreeHostTest { |
1953 public: | 1951 public: |
1954 LayerTreeHostTestCommit() {} | 1952 LayerTreeHostTestCommit() {} |
1955 | 1953 |
1956 void BeginTest() override { | 1954 void BeginTest() override { |
1957 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); | 1955 layer_tree()->SetViewportSize(gfx::Size(20, 20)); |
1958 layer_tree_host()->set_background_color(SK_ColorGRAY); | 1956 layer_tree()->set_background_color(SK_ColorGRAY); |
1959 layer_tree_host()->SetEventListenerProperties( | 1957 layer_tree()->SetEventListenerProperties(EventListenerClass::kMouseWheel, |
1960 EventListenerClass::kMouseWheel, EventListenerProperties::kPassive); | 1958 EventListenerProperties::kPassive); |
1961 layer_tree_host()->SetEventListenerProperties( | 1959 layer_tree()->SetEventListenerProperties( |
1962 EventListenerClass::kTouchStartOrMove, | 1960 EventListenerClass::kTouchStartOrMove, |
1963 EventListenerProperties::kBlocking); | 1961 EventListenerProperties::kBlocking); |
1964 layer_tree_host()->SetEventListenerProperties( | 1962 layer_tree()->SetEventListenerProperties( |
1965 EventListenerClass::kTouchEndOrCancel, | 1963 EventListenerClass::kTouchEndOrCancel, |
1966 EventListenerProperties::kBlockingAndPassive); | 1964 EventListenerProperties::kBlockingAndPassive); |
1967 layer_tree_host()->SetHaveScrollEventHandlers(true); | 1965 layer_tree()->SetHaveScrollEventHandlers(true); |
1968 | 1966 |
1969 PostSetNeedsCommitToMainThread(); | 1967 PostSetNeedsCommitToMainThread(); |
1970 } | 1968 } |
1971 | 1969 |
1972 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 1970 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
1973 EXPECT_EQ(gfx::Size(20, 20), impl->DrawViewportSize()); | 1971 EXPECT_EQ(gfx::Size(20, 20), impl->DrawViewportSize()); |
1974 EXPECT_EQ(SK_ColorGRAY, impl->active_tree()->background_color()); | 1972 EXPECT_EQ(SK_ColorGRAY, impl->active_tree()->background_color()); |
1975 EXPECT_EQ(EventListenerProperties::kPassive, | 1973 EXPECT_EQ(EventListenerProperties::kPassive, |
1976 impl->active_tree()->event_listener_properties( | 1974 impl->active_tree()->event_listener_properties( |
1977 EventListenerClass::kMouseWheel)); | 1975 EventListenerClass::kMouseWheel)); |
(...skipping 16 matching lines...) Expand all Loading... |
1994 // This test verifies that LayerTreeHostImpl's current frame time gets | 1992 // This test verifies that LayerTreeHostImpl's current frame time gets |
1995 // updated in consecutive frames when it doesn't draw due to tree | 1993 // updated in consecutive frames when it doesn't draw due to tree |
1996 // activation failure. | 1994 // activation failure. |
1997 class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails | 1995 class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails |
1998 : public LayerTreeHostTest { | 1996 : public LayerTreeHostTest { |
1999 public: | 1997 public: |
2000 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails() | 1998 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails() |
2001 : frame_count_with_pending_tree_(0) {} | 1999 : frame_count_with_pending_tree_(0) {} |
2002 | 2000 |
2003 void BeginTest() override { | 2001 void BeginTest() override { |
2004 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); | 2002 layer_tree()->SetViewportSize(gfx::Size(20, 20)); |
2005 layer_tree_host()->set_background_color(SK_ColorGRAY); | 2003 layer_tree()->set_background_color(SK_ColorGRAY); |
2006 | 2004 |
2007 PostSetNeedsCommitToMainThread(); | 2005 PostSetNeedsCommitToMainThread(); |
2008 } | 2006 } |
2009 | 2007 |
2010 void BeginCommitOnThread(LayerTreeHostImpl* impl) override { | 2008 void BeginCommitOnThread(LayerTreeHostImpl* impl) override { |
2011 EXPECT_EQ(frame_count_with_pending_tree_, 0); | 2009 EXPECT_EQ(frame_count_with_pending_tree_, 0); |
2012 impl->BlockNotifyReadyToActivateForTesting(true); | 2010 impl->BlockNotifyReadyToActivateForTesting(true); |
2013 } | 2011 } |
2014 | 2012 |
2015 void WillBeginImplFrameOnThread(LayerTreeHostImpl* impl, | 2013 void WillBeginImplFrameOnThread(LayerTreeHostImpl* impl, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2048 MULTI_THREAD_BLOCKNOTIFY_TEST_F( | 2046 MULTI_THREAD_BLOCKNOTIFY_TEST_F( |
2049 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); | 2047 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); |
2050 | 2048 |
2051 // This test verifies that LayerTreeHostImpl's current frame time gets | 2049 // This test verifies that LayerTreeHostImpl's current frame time gets |
2052 // updated in consecutive frames when it draws in each frame. | 2050 // updated in consecutive frames when it draws in each frame. |
2053 class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest { | 2051 class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest { |
2054 public: | 2052 public: |
2055 LayerTreeHostTestFrameTimeUpdatesAfterDraw() : frame_(0) {} | 2053 LayerTreeHostTestFrameTimeUpdatesAfterDraw() : frame_(0) {} |
2056 | 2054 |
2057 void BeginTest() override { | 2055 void BeginTest() override { |
2058 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); | 2056 layer_tree()->SetViewportSize(gfx::Size(20, 20)); |
2059 layer_tree_host()->set_background_color(SK_ColorGRAY); | 2057 layer_tree()->set_background_color(SK_ColorGRAY); |
2060 | 2058 |
2061 PostSetNeedsCommitToMainThread(); | 2059 PostSetNeedsCommitToMainThread(); |
2062 } | 2060 } |
2063 | 2061 |
2064 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 2062 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
2065 frame_++; | 2063 frame_++; |
2066 if (frame_ == 1) { | 2064 if (frame_ == 1) { |
2067 first_frame_time_ = impl->CurrentBeginFrameArgs().frame_time; | 2065 first_frame_time_ = impl->CurrentBeginFrameArgs().frame_time; |
2068 impl->SetNeedsRedraw(); | 2066 impl->SetNeedsRedraw(); |
2069 | 2067 |
(...skipping 29 matching lines...) Expand all Loading... |
2099 | 2097 |
2100 // Verifies that StartPageScaleAnimation events propagate correctly | 2098 // Verifies that StartPageScaleAnimation events propagate correctly |
2101 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. | 2099 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. |
2102 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { | 2100 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { |
2103 public: | 2101 public: |
2104 LayerTreeHostTestStartPageScaleAnimation() {} | 2102 LayerTreeHostTestStartPageScaleAnimation() {} |
2105 | 2103 |
2106 void SetupTree() override { | 2104 void SetupTree() override { |
2107 LayerTreeHostTest::SetupTree(); | 2105 LayerTreeHostTest::SetupTree(); |
2108 | 2106 |
2109 Layer* root_layer = layer_tree_host()->root_layer(); | 2107 Layer* root_layer = layer_tree()->root_layer(); |
2110 | 2108 |
2111 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(&client_); | 2109 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(&client_); |
2112 layer->set_always_update_resources(true); | 2110 layer->set_always_update_resources(true); |
2113 scroll_layer_ = layer; | 2111 scroll_layer_ = layer; |
2114 | 2112 |
2115 scroll_layer_->SetBounds(gfx::Size(2 * root_layer->bounds().width(), | 2113 scroll_layer_->SetBounds(gfx::Size(2 * root_layer->bounds().width(), |
2116 2 * root_layer->bounds().height())); | 2114 2 * root_layer->bounds().height())); |
2117 scroll_layer_->SetScrollOffset(gfx::ScrollOffset()); | 2115 scroll_layer_->SetScrollOffset(gfx::ScrollOffset()); |
2118 | 2116 |
2119 CreateVirtualViewportLayers(root_layer, scroll_layer_, root_layer->bounds(), | 2117 CreateVirtualViewportLayers(root_layer, scroll_layer_, root_layer->bounds(), |
2120 root_layer->bounds(), layer_tree_host()); | 2118 root_layer->bounds(), layer_tree_host()); |
2121 | 2119 |
2122 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); | 2120 layer_tree()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); |
2123 client_.set_bounds(root_layer->bounds()); | 2121 client_.set_bounds(root_layer->bounds()); |
2124 } | 2122 } |
2125 | 2123 |
2126 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2124 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
2127 | 2125 |
2128 void ApplyViewportDeltas(const gfx::Vector2dF& scroll_delta, | 2126 void ApplyViewportDeltas(const gfx::Vector2dF& scroll_delta, |
2129 const gfx::Vector2dF&, | 2127 const gfx::Vector2dF&, |
2130 const gfx::Vector2dF& elastic_overscroll_delta, | 2128 const gfx::Vector2dF& elastic_overscroll_delta, |
2131 float scale, | 2129 float scale, |
2132 float) override { | 2130 float) override { |
2133 gfx::ScrollOffset offset = scroll_layer_->scroll_offset(); | 2131 gfx::ScrollOffset offset = scroll_layer_->scroll_offset(); |
2134 scroll_layer_->SetScrollOffset(ScrollOffsetWithDelta(offset, scroll_delta)); | 2132 scroll_layer_->SetScrollOffset(ScrollOffsetWithDelta(offset, scroll_delta)); |
2135 layer_tree_host()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f); | 2133 layer_tree()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f); |
2136 } | 2134 } |
2137 | 2135 |
2138 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 2136 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
2139 // We get one commit before the first draw, and the animation doesn't happen | 2137 // We get one commit before the first draw, and the animation doesn't happen |
2140 // until the second draw. | 2138 // until the second draw. |
2141 switch (impl->active_tree()->source_frame_number()) { | 2139 switch (impl->active_tree()->source_frame_number()) { |
2142 case 0: | 2140 case 0: |
2143 EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor()); | 2141 EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor()); |
2144 // We'll start an animation when we get back to the main thread. | 2142 // We'll start an animation when we get back to the main thread. |
2145 break; | 2143 break; |
2146 case 1: | 2144 case 1: |
2147 EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor()); | 2145 EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor()); |
2148 break; | 2146 break; |
2149 case 2: | 2147 case 2: |
2150 EXPECT_EQ(1.25f, impl->active_tree()->current_page_scale_factor()); | 2148 EXPECT_EQ(1.25f, impl->active_tree()->current_page_scale_factor()); |
2151 EndTest(); | 2149 EndTest(); |
2152 break; | 2150 break; |
2153 case 3: | 2151 case 3: |
2154 break; | 2152 break; |
2155 default: | 2153 default: |
2156 NOTREACHED(); | 2154 NOTREACHED(); |
2157 } | 2155 } |
2158 } | 2156 } |
2159 | 2157 |
2160 void DidCommitAndDrawFrame() override { | 2158 void DidCommitAndDrawFrame() override { |
2161 switch (layer_tree_host()->source_frame_number()) { | 2159 switch (layer_tree_host()->source_frame_number()) { |
2162 case 1: | 2160 case 1: |
2163 layer_tree_host()->StartPageScaleAnimation(gfx::Vector2d(), false, | 2161 layer_tree()->StartPageScaleAnimation(gfx::Vector2d(), false, 1.25f, |
2164 1.25f, base::TimeDelta()); | 2162 base::TimeDelta()); |
2165 break; | 2163 break; |
2166 } | 2164 } |
2167 } | 2165 } |
2168 | 2166 |
2169 void AfterTest() override {} | 2167 void AfterTest() override {} |
2170 | 2168 |
2171 FakeContentLayerClient client_; | 2169 FakeContentLayerClient client_; |
2172 scoped_refptr<Layer> scroll_layer_; | 2170 scoped_refptr<Layer> scroll_layer_; |
2173 }; | 2171 }; |
2174 | 2172 |
(...skipping 30 matching lines...) Expand all Loading... |
2205 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers | 2203 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers |
2206 : public LayerTreeHostTest { | 2204 : public LayerTreeHostTest { |
2207 public: | 2205 public: |
2208 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {} | 2206 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {} |
2209 | 2207 |
2210 void BeginTest() override { | 2208 void BeginTest() override { |
2211 client_.set_fill_with_nonsolid_color(true); | 2209 client_.set_fill_with_nonsolid_color(true); |
2212 root_layer_ = FakePictureLayer::Create(&client_); | 2210 root_layer_ = FakePictureLayer::Create(&client_); |
2213 child_layer_ = FakePictureLayer::Create(&client_); | 2211 child_layer_ = FakePictureLayer::Create(&client_); |
2214 | 2212 |
2215 layer_tree_host()->SetViewportSize(gfx::Size(60, 60)); | 2213 layer_tree()->SetViewportSize(gfx::Size(60, 60)); |
2216 layer_tree_host()->SetDeviceScaleFactor(1.5); | 2214 layer_tree()->SetDeviceScaleFactor(1.5); |
2217 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size()); | 2215 EXPECT_EQ(gfx::Size(60, 60), layer_tree()->device_viewport_size()); |
2218 | 2216 |
2219 root_layer_->AddChild(child_layer_); | 2217 root_layer_->AddChild(child_layer_); |
2220 | 2218 |
2221 root_layer_->SetIsDrawable(true); | 2219 root_layer_->SetIsDrawable(true); |
2222 root_layer_->SetBounds(gfx::Size(30, 30)); | 2220 root_layer_->SetBounds(gfx::Size(30, 30)); |
2223 | 2221 |
2224 child_layer_->SetIsDrawable(true); | 2222 child_layer_->SetIsDrawable(true); |
2225 child_layer_->SetPosition(gfx::PointF(2.f, 2.f)); | 2223 child_layer_->SetPosition(gfx::PointF(2.f, 2.f)); |
2226 child_layer_->SetBounds(gfx::Size(10, 10)); | 2224 child_layer_->SetBounds(gfx::Size(10, 10)); |
2227 client_.set_bounds(gfx::Size(10, 10)); | 2225 client_.set_bounds(gfx::Size(10, 10)); |
2228 | 2226 |
2229 layer_tree_host()->SetRootLayer(root_layer_); | 2227 layer_tree()->SetRootLayer(root_layer_); |
2230 | 2228 |
2231 PostSetNeedsCommitToMainThread(); | 2229 PostSetNeedsCommitToMainThread(); |
2232 client_.set_bounds(root_layer_->bounds()); | 2230 client_.set_bounds(root_layer_->bounds()); |
2233 } | 2231 } |
2234 | 2232 |
2235 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 2233 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
2236 // Should only do one commit. | 2234 // Should only do one commit. |
2237 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); | 2235 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); |
2238 // Device scale factor should come over to impl. | 2236 // Device scale factor should come over to impl. |
2239 EXPECT_NEAR(impl->active_tree()->device_scale_factor(), 1.5f, 0.00001f); | 2237 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... |
2303 }; | 2301 }; |
2304 | 2302 |
2305 MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers); | 2303 MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers); |
2306 | 2304 |
2307 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { | 2305 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { |
2308 public: | 2306 public: |
2309 LayerTreeHostTestContinuousInvalidate() | 2307 LayerTreeHostTestContinuousInvalidate() |
2310 : num_commit_complete_(0), num_draw_layers_(0) {} | 2308 : num_commit_complete_(0), num_draw_layers_(0) {} |
2311 | 2309 |
2312 void BeginTest() override { | 2310 void BeginTest() override { |
2313 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); | 2311 layer_tree()->SetViewportSize(gfx::Size(10, 10)); |
2314 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); | 2312 layer_tree()->root_layer()->SetBounds(gfx::Size(10, 10)); |
2315 | 2313 |
2316 layer_ = FakePictureLayer::Create(&client_); | 2314 layer_ = FakePictureLayer::Create(&client_); |
2317 layer_->SetBounds(gfx::Size(10, 10)); | 2315 layer_->SetBounds(gfx::Size(10, 10)); |
2318 layer_->SetPosition(gfx::PointF(0.f, 0.f)); | 2316 layer_->SetPosition(gfx::PointF(0.f, 0.f)); |
2319 layer_->SetIsDrawable(true); | 2317 layer_->SetIsDrawable(true); |
2320 layer_tree_host()->root_layer()->AddChild(layer_); | 2318 layer_tree()->root_layer()->AddChild(layer_); |
2321 | 2319 |
2322 PostSetNeedsCommitToMainThread(); | 2320 PostSetNeedsCommitToMainThread(); |
2323 client_.set_bounds(layer_->bounds()); | 2321 client_.set_bounds(layer_->bounds()); |
2324 } | 2322 } |
2325 | 2323 |
2326 void DidCommitAndDrawFrame() override { | 2324 void DidCommitAndDrawFrame() override { |
2327 if (num_draw_layers_ == 2) | 2325 if (num_draw_layers_ == 2) |
2328 return; | 2326 return; |
2329 layer_->SetNeedsDisplay(); | 2327 layer_->SetNeedsDisplay(); |
2330 } | 2328 } |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2486 public: | 2484 public: |
2487 void SetupTree() override { | 2485 void SetupTree() override { |
2488 num_tiles_rastered_ = 0; | 2486 num_tiles_rastered_ = 0; |
2489 | 2487 |
2490 scoped_refptr<Layer> root_layer = PictureLayer::Create(&client_); | 2488 scoped_refptr<Layer> root_layer = PictureLayer::Create(&client_); |
2491 client_.set_fill_with_nonsolid_color(true); | 2489 client_.set_fill_with_nonsolid_color(true); |
2492 root_layer->SetIsDrawable(true); | 2490 root_layer->SetIsDrawable(true); |
2493 root_layer->SetBounds(gfx::Size(10, 10)); | 2491 root_layer->SetBounds(gfx::Size(10, 10)); |
2494 root_layer->SetContentsOpaque(true); | 2492 root_layer->SetContentsOpaque(true); |
2495 | 2493 |
2496 layer_tree_host()->SetRootLayer(root_layer); | 2494 layer_tree()->SetRootLayer(root_layer); |
2497 | 2495 |
2498 // The expectations are based on the assumption that the default | 2496 // The expectations are based on the assumption that the default |
2499 // LCD settings are: | 2497 // LCD settings are: |
2500 EXPECT_TRUE(layer_tree_host()->settings().can_use_lcd_text); | 2498 EXPECT_TRUE(layer_tree_host()->settings().can_use_lcd_text); |
2501 | 2499 |
2502 LayerTreeHostTest::SetupTree(); | 2500 LayerTreeHostTest::SetupTree(); |
2503 client_.set_bounds(root_layer->bounds()); | 2501 client_.set_bounds(root_layer->bounds()); |
2504 } | 2502 } |
2505 | 2503 |
2506 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2504 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
2507 | 2505 |
2508 void DidCommitAndDrawFrame() override { | 2506 void DidCommitAndDrawFrame() override { |
2509 switch (layer_tree_host()->source_frame_number()) { | 2507 switch (layer_tree_host()->source_frame_number()) { |
2510 case 1: | 2508 case 1: |
2511 PostSetNeedsCommitToMainThread(); | 2509 PostSetNeedsCommitToMainThread(); |
2512 break; | 2510 break; |
2513 case 2: | 2511 case 2: |
2514 // Change layer opacity that should trigger lcd change. | 2512 // Change layer opacity that should trigger lcd change. |
2515 layer_tree_host()->root_layer()->SetOpacity(.5f); | 2513 layer_tree()->root_layer()->SetOpacity(.5f); |
2516 break; | 2514 break; |
2517 case 3: | 2515 case 3: |
2518 // Change layer opacity that should not trigger lcd change. | 2516 // Change layer opacity that should not trigger lcd change. |
2519 layer_tree_host()->root_layer()->SetOpacity(1.f); | 2517 layer_tree()->root_layer()->SetOpacity(1.f); |
2520 break; | 2518 break; |
2521 case 4: | 2519 case 4: |
2522 EndTest(); | 2520 EndTest(); |
2523 break; | 2521 break; |
2524 } | 2522 } |
2525 } | 2523 } |
2526 | 2524 |
2527 void NotifyTileStateChangedOnThread(LayerTreeHostImpl* host_impl, | 2525 void NotifyTileStateChangedOnThread(LayerTreeHostImpl* host_impl, |
2528 const Tile* tile) override { | 2526 const Tile* tile) override { |
2529 ++num_tiles_rastered_; | 2527 ++num_tiles_rastered_; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2734 | 2732 |
2735 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation | 2733 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation |
2736 : public LayerTreeHostTest { | 2734 : public LayerTreeHostTest { |
2737 protected: | 2735 protected: |
2738 void SetupTree() override { | 2736 void SetupTree() override { |
2739 LayerTreeHostTest::SetupTree(); | 2737 LayerTreeHostTest::SetupTree(); |
2740 | 2738 |
2741 scoped_refptr<Layer> layer = PictureLayer::Create(&client_); | 2739 scoped_refptr<Layer> layer = PictureLayer::Create(&client_); |
2742 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); | 2740 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); |
2743 layer->SetBounds(gfx::Size(10, 10)); | 2741 layer->SetBounds(gfx::Size(10, 10)); |
2744 layer_tree_host()->root_layer()->AddChild(layer); | 2742 layer_tree()->root_layer()->AddChild(layer); |
2745 client_.set_bounds(layer->bounds()); | 2743 client_.set_bounds(layer->bounds()); |
2746 } | 2744 } |
2747 | 2745 |
2748 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2746 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
2749 | 2747 |
2750 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 2748 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
2751 EndTest(); | 2749 EndTest(); |
2752 } | 2750 } |
2753 | 2751 |
2754 void AfterTest() override {} | 2752 void AfterTest() override {} |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2821 parent_layer_->SetIsDrawable(true); | 2819 parent_layer_->SetIsDrawable(true); |
2822 parent_layer_->SetBounds(gfx::Size(50, 50)); | 2820 parent_layer_->SetBounds(gfx::Size(50, 50)); |
2823 parent_layer_->SetForceRenderSurfaceForTesting(true); | 2821 parent_layer_->SetForceRenderSurfaceForTesting(true); |
2824 | 2822 |
2825 child_layer_ = FakePictureLayer::Create(&client_); | 2823 child_layer_ = FakePictureLayer::Create(&client_); |
2826 child_layer_->SetIsDrawable(true); | 2824 child_layer_->SetIsDrawable(true); |
2827 child_layer_->SetBounds(gfx::Size(50, 50)); | 2825 child_layer_->SetBounds(gfx::Size(50, 50)); |
2828 | 2826 |
2829 root_layer_->AddChild(parent_layer_); | 2827 root_layer_->AddChild(parent_layer_); |
2830 parent_layer_->AddChild(child_layer_); | 2828 parent_layer_->AddChild(child_layer_); |
2831 layer_tree_host()->SetRootLayer(root_layer_); | 2829 layer_tree()->SetRootLayer(root_layer_); |
2832 | 2830 |
2833 LayerTreeHostTest::SetupTree(); | 2831 LayerTreeHostTest::SetupTree(); |
2834 client_.set_bounds(root_layer_->bounds()); | 2832 client_.set_bounds(root_layer_->bounds()); |
2835 } | 2833 } |
2836 | 2834 |
2837 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface( | 2835 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface( |
2838 scoped_refptr<ContextProvider> compositor_context_provider, | 2836 scoped_refptr<ContextProvider> compositor_context_provider, |
2839 scoped_refptr<ContextProvider> worker_context_provider) override { | 2837 scoped_refptr<ContextProvider> worker_context_provider) override { |
2840 auto on_draw_callback = | 2838 auto on_draw_callback = |
2841 base::Bind(&LayerTreeHostTestResourcelessSoftwareDraw::CallOnDraw, | 2839 base::Bind(&LayerTreeHostTestResourcelessSoftwareDraw::CallOnDraw, |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3164 } | 3162 } |
3165 | 3163 |
3166 if (other_root_->layer_tree_host()) { | 3164 if (other_root_->layer_tree_host()) { |
3167 EXPECT_FALSE( | 3165 EXPECT_FALSE( |
3168 other_root_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( | 3166 other_root_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( |
3169 other_root_.get())); | 3167 other_root_.get())); |
3170 } | 3168 } |
3171 | 3169 |
3172 switch (num_commits_) { | 3170 switch (num_commits_) { |
3173 case 1: | 3171 case 1: |
3174 layer_tree_host()->SetRootLayer(root_); | 3172 layer_tree()->SetRootLayer(root_); |
3175 // Layers added to the tree get committed. | 3173 // Layers added to the tree get committed. |
3176 ++expected_push_properties_root_; | 3174 ++expected_push_properties_root_; |
3177 ++expected_push_properties_child_; | 3175 ++expected_push_properties_child_; |
3178 ++expected_push_properties_grandchild_; | 3176 ++expected_push_properties_grandchild_; |
3179 ++expected_push_properties_child2_; | 3177 ++expected_push_properties_child2_; |
3180 break; | 3178 break; |
3181 case 2: | 3179 case 2: |
3182 layer_tree_host()->SetNeedsCommit(); | 3180 layer_tree_host()->SetNeedsCommit(); |
3183 // No layers need commit. | 3181 // No layers need commit. |
3184 break; | 3182 break; |
3185 case 3: | 3183 case 3: |
3186 layer_tree_host()->SetRootLayer(other_root_); | 3184 layer_tree()->SetRootLayer(other_root_); |
3187 // Layers added to the tree get committed. | 3185 // Layers added to the tree get committed. |
3188 ++expected_push_properties_other_root_; | 3186 ++expected_push_properties_other_root_; |
3189 break; | 3187 break; |
3190 case 4: | 3188 case 4: |
3191 layer_tree_host()->SetRootLayer(root_); | 3189 layer_tree()->SetRootLayer(root_); |
3192 // Layers added to the tree get committed. | 3190 // Layers added to the tree get committed. |
3193 ++expected_push_properties_root_; | 3191 ++expected_push_properties_root_; |
3194 ++expected_push_properties_child_; | 3192 ++expected_push_properties_child_; |
3195 ++expected_push_properties_grandchild_; | 3193 ++expected_push_properties_grandchild_; |
3196 ++expected_push_properties_child2_; | 3194 ++expected_push_properties_child2_; |
3197 break; | 3195 break; |
3198 case 5: | 3196 case 5: |
3199 layer_tree_host()->SetNeedsCommit(); | 3197 layer_tree_host()->SetNeedsCommit(); |
3200 // No layers need commit. | 3198 // No layers need commit. |
3201 break; | 3199 break; |
(...skipping 10 matching lines...) Expand all Loading... |
3212 case 8: | 3210 case 8: |
3213 grandchild_->RemoveFromParent(); | 3211 grandchild_->RemoveFromParent(); |
3214 // No layers need commit. | 3212 // No layers need commit. |
3215 break; | 3213 break; |
3216 case 9: | 3214 case 9: |
3217 child_->AddChild(grandchild_); | 3215 child_->AddChild(grandchild_); |
3218 // Layers added to the tree get committed. | 3216 // Layers added to the tree get committed. |
3219 ++expected_push_properties_grandchild_; | 3217 ++expected_push_properties_grandchild_; |
3220 break; | 3218 break; |
3221 case 10: | 3219 case 10: |
3222 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); | 3220 layer_tree()->SetViewportSize(gfx::Size(20, 20)); |
3223 // No layers need commit. | 3221 // No layers need commit. |
3224 break; | 3222 break; |
3225 case 11: | 3223 case 11: |
3226 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.8f, 1.1f); | 3224 layer_tree()->SetPageScaleFactorAndLimits(1.f, 0.8f, 1.1f); |
3227 // No layers need commit. | 3225 // No layers need commit. |
3228 break; | 3226 break; |
3229 case 12: | 3227 case 12: |
3230 child_->MakePushProperties(); | 3228 child_->MakePushProperties(); |
3231 // The modified layer needs commit | 3229 // The modified layer needs commit |
3232 ++expected_push_properties_child_; | 3230 ++expected_push_properties_child_; |
3233 ++expected_push_properties_grandchild_; | 3231 ++expected_push_properties_grandchild_; |
3234 break; | 3232 break; |
3235 case 13: | 3233 case 13: |
3236 child2_->MakePushProperties(); | 3234 child2_->MakePushProperties(); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3492 root_ = Layer::Create(); | 3490 root_ = Layer::Create(); |
3493 root_->SetBounds(gfx::Size(1, 1)); | 3491 root_->SetBounds(gfx::Size(1, 1)); |
3494 | 3492 |
3495 bool paint_scrollbar = true; | 3493 bool paint_scrollbar = true; |
3496 bool has_thumb = false; | 3494 bool has_thumb = false; |
3497 scrollbar_layer_ = FakePaintedScrollbarLayer::Create( | 3495 scrollbar_layer_ = FakePaintedScrollbarLayer::Create( |
3498 paint_scrollbar, has_thumb, root_->id()); | 3496 paint_scrollbar, has_thumb, root_->id()); |
3499 | 3497 |
3500 root_->AddChild(scrollbar_layer_); | 3498 root_->AddChild(scrollbar_layer_); |
3501 | 3499 |
3502 layer_tree_host()->SetRootLayer(root_); | 3500 layer_tree()->SetRootLayer(root_); |
3503 LayerTreeHostTest::SetupTree(); | 3501 LayerTreeHostTest::SetupTree(); |
3504 } | 3502 } |
3505 | 3503 |
3506 void DidCommitAndDrawFrame() override { | 3504 void DidCommitAndDrawFrame() override { |
3507 switch (layer_tree_host()->source_frame_number()) { | 3505 switch (layer_tree_host()->source_frame_number()) { |
3508 case 0: | 3506 case 0: |
3509 break; | 3507 break; |
3510 case 1: { | 3508 case 1: { |
3511 // During update, the ignore_set_needs_commit_ bit is set to true to | 3509 // During update, the ignore_set_needs_commit_ bit is set to true to |
3512 // avoid causing a second commit to be scheduled. If a property change | 3510 // avoid causing a second commit to be scheduled. If a property change |
3513 // is made during this, however, it needs to be pushed in the upcoming | 3511 // is made during this, however, it needs to be pushed in the upcoming |
3514 // commit. | 3512 // commit. |
3515 std::unique_ptr<base::AutoReset<bool>> ignore = | 3513 std::unique_ptr<base::AutoReset<bool>> ignore = |
3516 scrollbar_layer_->IgnoreSetNeedsCommit(); | 3514 scrollbar_layer_->IgnoreSetNeedsCommit(); |
3517 | 3515 |
3518 scrollbar_layer_->SetBounds(gfx::Size(30, 30)); | 3516 scrollbar_layer_->SetBounds(gfx::Size(30, 30)); |
3519 | 3517 |
3520 EXPECT_TRUE( | 3518 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
3521 layer_tree_host() | 3519 scrollbar_layer_.get())); |
3522 ->GetLayerTree() | |
3523 ->LayerNeedsPushPropertiesForTesting(scrollbar_layer_.get())); | |
3524 layer_tree_host()->SetNeedsCommit(); | 3520 layer_tree_host()->SetNeedsCommit(); |
3525 | 3521 |
3526 scrollbar_layer_->reset_push_properties_count(); | 3522 scrollbar_layer_->reset_push_properties_count(); |
3527 EXPECT_EQ(0u, scrollbar_layer_->push_properties_count()); | 3523 EXPECT_EQ(0u, scrollbar_layer_->push_properties_count()); |
3528 break; | 3524 break; |
3529 } | 3525 } |
3530 case 2: | 3526 case 2: |
3531 EXPECT_EQ(1u, scrollbar_layer_->push_properties_count()); | 3527 EXPECT_EQ(1u, scrollbar_layer_->push_properties_count()); |
3532 EndTest(); | 3528 EndTest(); |
3533 break; | 3529 break; |
(...skipping 10 matching lines...) Expand all Loading... |
3544 | 3540 |
3545 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { | 3541 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { |
3546 protected: | 3542 protected: |
3547 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 3543 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
3548 | 3544 |
3549 void SetupTree() override { | 3545 void SetupTree() override { |
3550 root_ = PushPropertiesCountingLayer::Create(); | 3546 root_ = PushPropertiesCountingLayer::Create(); |
3551 child_ = PushPropertiesCountingLayer::Create(); | 3547 child_ = PushPropertiesCountingLayer::Create(); |
3552 root_->AddChild(child_); | 3548 root_->AddChild(child_); |
3553 | 3549 |
3554 layer_tree_host()->SetRootLayer(root_); | 3550 layer_tree()->SetRootLayer(root_); |
3555 LayerTreeHostTest::SetupTree(); | 3551 LayerTreeHostTest::SetupTree(); |
3556 } | 3552 } |
3557 | 3553 |
3558 void DidCommitAndDrawFrame() override { | 3554 void DidCommitAndDrawFrame() override { |
3559 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | |
3560 switch (layer_tree_host()->source_frame_number()) { | 3555 switch (layer_tree_host()->source_frame_number()) { |
3561 case 0: | 3556 case 0: |
3562 break; | 3557 break; |
3563 case 1: { | 3558 case 1: { |
3564 // During update, the ignore_set_needs_commit_ bit is set to true to | 3559 // During update, the ignore_set_needs_commit_ bit is set to true to |
3565 // avoid causing a second commit to be scheduled. If a property change | 3560 // avoid causing a second commit to be scheduled. If a property change |
3566 // is made during this, however, it needs to be pushed in the upcoming | 3561 // is made during this, however, it needs to be pushed in the upcoming |
3567 // commit. | 3562 // commit. |
3568 EXPECT_FALSE( | 3563 EXPECT_FALSE( |
3569 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 3564 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); |
3570 EXPECT_FALSE( | 3565 EXPECT_FALSE( |
3571 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 3566 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); |
3572 EXPECT_EQ(0, root_->NumDescendantsThatDrawContent()); | 3567 EXPECT_EQ(0, root_->NumDescendantsThatDrawContent()); |
3573 root_->reset_push_properties_count(); | 3568 root_->reset_push_properties_count(); |
3574 child_->reset_push_properties_count(); | 3569 child_->reset_push_properties_count(); |
3575 child_->SetDrawsContent(true); | 3570 child_->SetDrawsContent(true); |
3576 EXPECT_EQ(1, root_->NumDescendantsThatDrawContent()); | 3571 EXPECT_EQ(1, root_->NumDescendantsThatDrawContent()); |
3577 EXPECT_EQ(0u, root_->push_properties_count()); | 3572 EXPECT_EQ(0u, root_->push_properties_count()); |
3578 EXPECT_EQ(0u, child_->push_properties_count()); | 3573 EXPECT_EQ(0u, child_->push_properties_count()); |
3579 EXPECT_TRUE( | 3574 EXPECT_TRUE( |
3580 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 3575 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); |
3581 EXPECT_TRUE( | 3576 EXPECT_TRUE( |
3582 | 3577 |
3583 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 3578 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); |
3584 break; | 3579 break; |
3585 } | 3580 } |
3586 case 2: | 3581 case 2: |
3587 EXPECT_EQ(1u, root_->push_properties_count()); | 3582 EXPECT_EQ(1u, root_->push_properties_count()); |
3588 EXPECT_EQ(1u, child_->push_properties_count()); | 3583 EXPECT_EQ(1u, child_->push_properties_count()); |
3589 EXPECT_FALSE( | 3584 EXPECT_FALSE( |
3590 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 3585 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); |
3591 EXPECT_FALSE( | 3586 EXPECT_FALSE( |
3592 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 3587 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); |
3593 EndTest(); | 3588 EndTest(); |
3594 break; | 3589 break; |
3595 } | 3590 } |
3596 } | 3591 } |
3597 | 3592 |
3598 void AfterTest() override {} | 3593 void AfterTest() override {} |
3599 | 3594 |
3600 scoped_refptr<PushPropertiesCountingLayer> root_; | 3595 scoped_refptr<PushPropertiesCountingLayer> root_; |
3601 scoped_refptr<PushPropertiesCountingLayer> child_; | 3596 scoped_refptr<PushPropertiesCountingLayer> child_; |
3602 }; | 3597 }; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3648 }; | 3643 }; |
3649 | 3644 |
3650 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush | 3645 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush |
3651 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3646 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3652 protected: | 3647 protected: |
3653 void DidCommitAndDrawFrame() override { | 3648 void DidCommitAndDrawFrame() override { |
3654 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3649 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3655 switch (last_source_frame_number) { | 3650 switch (last_source_frame_number) { |
3656 case 0: | 3651 case 0: |
3657 // All layers will need push properties as we set their layer tree host | 3652 // All layers will need push properties as we set their layer tree host |
3658 layer_tree_host()->SetRootLayer(root_); | 3653 layer_tree()->SetRootLayer(root_); |
3659 EXPECT_TRUE(layer_tree_host() | |
3660 ->GetLayerTree() | |
3661 ->LayerNeedsPushPropertiesForTesting(root_.get())); | |
3662 EXPECT_TRUE(layer_tree_host() | |
3663 ->GetLayerTree() | |
3664 ->LayerNeedsPushPropertiesForTesting(child_.get())); | |
3665 EXPECT_TRUE( | 3654 EXPECT_TRUE( |
3666 layer_tree_host() | 3655 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); |
3667 ->GetLayerTree() | |
3668 ->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | |
3669 EXPECT_TRUE( | 3656 EXPECT_TRUE( |
3670 layer_tree_host() | 3657 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); |
3671 ->GetLayerTree() | 3658 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
3672 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | 3659 grandchild1_.get())); |
3673 EXPECT_TRUE( | 3660 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
3674 layer_tree_host() | 3661 grandchild2_.get())); |
3675 ->GetLayerTree() | 3662 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
3676 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); | 3663 grandchild3_.get())); |
3677 break; | 3664 break; |
3678 case 1: | 3665 case 1: |
3679 EndTest(); | 3666 EndTest(); |
3680 break; | 3667 break; |
3681 } | 3668 } |
3682 } | 3669 } |
3683 }; | 3670 }; |
3684 | 3671 |
3685 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); | 3672 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); |
3686 | 3673 |
3687 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion | 3674 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion |
3688 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3675 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3689 protected: | 3676 protected: |
3690 void DidCommitAndDrawFrame() override { | 3677 void DidCommitAndDrawFrame() override { |
3691 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3678 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3692 switch (last_source_frame_number) { | 3679 switch (last_source_frame_number) { |
3693 case 0: | 3680 case 0: |
3694 layer_tree_host()->SetRootLayer(root_); | 3681 layer_tree()->SetRootLayer(root_); |
3695 break; | 3682 break; |
3696 case 1: | 3683 case 1: |
3697 EXPECT_FALSE(layer_tree_host() | |
3698 ->GetLayerTree() | |
3699 ->LayerNeedsPushPropertiesForTesting(root_.get())); | |
3700 EXPECT_FALSE(layer_tree_host() | |
3701 ->GetLayerTree() | |
3702 ->LayerNeedsPushPropertiesForTesting(child_.get())); | |
3703 EXPECT_FALSE( | 3684 EXPECT_FALSE( |
3704 layer_tree_host() | 3685 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); |
3705 ->GetLayerTree() | |
3706 ->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | |
3707 EXPECT_FALSE( | 3686 EXPECT_FALSE( |
3708 layer_tree_host() | 3687 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); |
3709 ->GetLayerTree() | 3688 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
3710 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | 3689 grandchild1_.get())); |
3711 EXPECT_FALSE( | 3690 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
3712 layer_tree_host() | 3691 grandchild2_.get())); |
3713 ->GetLayerTree() | 3692 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
3714 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); | 3693 grandchild3_.get())); |
3715 | 3694 |
3716 grandchild1_->RemoveFromParent(); | 3695 grandchild1_->RemoveFromParent(); |
3717 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 3696 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
3718 | 3697 |
3719 EXPECT_FALSE(layer_tree_host() | |
3720 ->GetLayerTree() | |
3721 ->LayerNeedsPushPropertiesForTesting(root_.get())); | |
3722 EXPECT_FALSE(layer_tree_host() | |
3723 ->GetLayerTree() | |
3724 ->LayerNeedsPushPropertiesForTesting(child_.get())); | |
3725 EXPECT_FALSE( | 3698 EXPECT_FALSE( |
3726 layer_tree_host() | 3699 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); |
3727 ->GetLayerTree() | |
3728 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | |
3729 EXPECT_FALSE( | 3700 EXPECT_FALSE( |
3730 layer_tree_host() | 3701 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); |
3731 ->GetLayerTree() | 3702 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
3732 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); | 3703 grandchild2_.get())); |
| 3704 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
| 3705 grandchild3_.get())); |
3733 | 3706 |
3734 child_->AddChild(grandchild1_); | 3707 child_->AddChild(grandchild1_); |
3735 | 3708 |
3736 EXPECT_FALSE(layer_tree_host() | |
3737 ->GetLayerTree() | |
3738 ->LayerNeedsPushPropertiesForTesting(root_.get())); | |
3739 EXPECT_FALSE(layer_tree_host() | |
3740 ->GetLayerTree() | |
3741 ->LayerNeedsPushPropertiesForTesting(child_.get())); | |
3742 EXPECT_TRUE( | |
3743 layer_tree_host() | |
3744 ->GetLayerTree() | |
3745 ->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | |
3746 EXPECT_FALSE( | 3709 EXPECT_FALSE( |
3747 layer_tree_host() | 3710 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); |
3748 ->GetLayerTree() | |
3749 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | |
3750 EXPECT_FALSE( | 3711 EXPECT_FALSE( |
3751 layer_tree_host() | 3712 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); |
3752 ->GetLayerTree() | 3713 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
3753 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); | 3714 grandchild1_.get())); |
| 3715 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
| 3716 grandchild2_.get())); |
| 3717 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
| 3718 grandchild3_.get())); |
3754 | 3719 |
3755 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 3720 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
3756 | 3721 |
3757 EXPECT_FALSE(layer_tree_host() | |
3758 ->GetLayerTree() | |
3759 ->LayerNeedsPushPropertiesForTesting(root_.get())); | |
3760 EXPECT_FALSE(layer_tree_host() | |
3761 ->GetLayerTree() | |
3762 ->LayerNeedsPushPropertiesForTesting(child_.get())); | |
3763 EXPECT_TRUE( | |
3764 layer_tree_host() | |
3765 ->GetLayerTree() | |
3766 ->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | |
3767 EXPECT_TRUE( | |
3768 layer_tree_host() | |
3769 ->GetLayerTree() | |
3770 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | |
3771 EXPECT_FALSE( | 3722 EXPECT_FALSE( |
3772 layer_tree_host() | 3723 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); |
3773 ->GetLayerTree() | 3724 EXPECT_FALSE( |
3774 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); | 3725 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3726 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
| 3727 grandchild1_.get())); |
| 3728 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
| 3729 grandchild2_.get())); |
| 3730 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
| 3731 grandchild3_.get())); |
3775 | 3732 |
3776 // grandchild2_ will still need a push properties. | 3733 // grandchild2_ will still need a push properties. |
3777 grandchild1_->RemoveFromParent(); | 3734 grandchild1_->RemoveFromParent(); |
3778 | 3735 |
3779 EXPECT_FALSE(layer_tree_host() | 3736 EXPECT_FALSE( |
3780 ->GetLayerTree() | 3737 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); |
3781 ->LayerNeedsPushPropertiesForTesting(root_.get())); | 3738 EXPECT_FALSE( |
3782 EXPECT_FALSE(layer_tree_host() | 3739 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); |
3783 ->GetLayerTree() | |
3784 ->LayerNeedsPushPropertiesForTesting(child_.get())); | |
3785 | 3740 |
3786 // grandchild3_ does not need a push properties, so recursing should | 3741 // grandchild3_ does not need a push properties, so recursing should |
3787 // no longer be needed. | 3742 // no longer be needed. |
3788 grandchild2_->RemoveFromParent(); | 3743 grandchild2_->RemoveFromParent(); |
3789 | 3744 |
3790 EXPECT_FALSE(layer_tree_host() | 3745 EXPECT_FALSE( |
3791 ->GetLayerTree() | 3746 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); |
3792 ->LayerNeedsPushPropertiesForTesting(root_.get())); | 3747 EXPECT_FALSE( |
3793 EXPECT_FALSE(layer_tree_host() | 3748 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); |
3794 ->GetLayerTree() | |
3795 ->LayerNeedsPushPropertiesForTesting(child_.get())); | |
3796 EndTest(); | 3749 EndTest(); |
3797 break; | 3750 break; |
3798 } | 3751 } |
3799 } | 3752 } |
3800 }; | 3753 }; |
3801 | 3754 |
3802 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); | 3755 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); |
3803 | 3756 |
3804 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence | 3757 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence |
3805 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3758 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3806 protected: | 3759 protected: |
3807 void DidCommitAndDrawFrame() override { | 3760 void DidCommitAndDrawFrame() override { |
3808 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 3761 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
3809 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3762 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3810 switch (last_source_frame_number) { | 3763 switch (last_source_frame_number) { |
3811 case 0: | 3764 case 0: |
3812 layer_tree_host()->SetRootLayer(root_); | 3765 layer_tree->SetRootLayer(root_); |
3813 grandchild1_->set_persist_needs_push_properties(true); | 3766 grandchild1_->set_persist_needs_push_properties(true); |
3814 grandchild2_->set_persist_needs_push_properties(true); | 3767 grandchild2_->set_persist_needs_push_properties(true); |
3815 break; | 3768 break; |
3816 case 1: | 3769 case 1: |
3817 EXPECT_FALSE( | 3770 EXPECT_FALSE( |
3818 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 3771 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3819 EXPECT_FALSE( | 3772 EXPECT_FALSE( |
3820 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 3773 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3821 EXPECT_TRUE( | 3774 EXPECT_TRUE( |
3822 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | 3775 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
(...skipping 28 matching lines...) Expand all Loading... |
3851 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); | 3804 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); |
3852 | 3805 |
3853 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree | 3806 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree |
3854 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3807 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3855 protected: | 3808 protected: |
3856 void DidCommitAndDrawFrame() override { | 3809 void DidCommitAndDrawFrame() override { |
3857 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 3810 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
3858 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3811 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3859 switch (last_source_frame_number) { | 3812 switch (last_source_frame_number) { |
3860 case 0: | 3813 case 0: |
3861 layer_tree_host()->SetRootLayer(root_); | 3814 layer_tree->SetRootLayer(root_); |
3862 break; | 3815 break; |
3863 case 1: | 3816 case 1: |
3864 EXPECT_FALSE( | 3817 EXPECT_FALSE( |
3865 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 3818 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3866 EXPECT_FALSE( | 3819 EXPECT_FALSE( |
3867 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 3820 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3868 EXPECT_FALSE( | 3821 EXPECT_FALSE( |
3869 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | 3822 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
3870 EXPECT_FALSE( | 3823 EXPECT_FALSE( |
3871 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | 3824 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3920 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); | 3873 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); |
3921 | 3874 |
3922 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild | 3875 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild |
3923 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3876 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3924 protected: | 3877 protected: |
3925 void DidCommitAndDrawFrame() override { | 3878 void DidCommitAndDrawFrame() override { |
3926 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 3879 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
3927 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3880 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3928 switch (last_source_frame_number) { | 3881 switch (last_source_frame_number) { |
3929 case 0: | 3882 case 0: |
3930 layer_tree_host()->SetRootLayer(root_); | 3883 layer_tree->SetRootLayer(root_); |
3931 break; | 3884 break; |
3932 case 1: | 3885 case 1: |
3933 EXPECT_FALSE( | 3886 EXPECT_FALSE( |
3934 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 3887 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3935 EXPECT_FALSE( | 3888 EXPECT_FALSE( |
3936 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 3889 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3937 EXPECT_FALSE( | 3890 EXPECT_FALSE( |
3938 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | 3891 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
3939 EXPECT_FALSE( | 3892 EXPECT_FALSE( |
3940 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | 3893 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3985 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); | 3938 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); |
3986 | 3939 |
3987 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent | 3940 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent |
3988 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3941 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3989 protected: | 3942 protected: |
3990 void DidCommitAndDrawFrame() override { | 3943 void DidCommitAndDrawFrame() override { |
3991 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 3944 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
3992 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3945 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3993 switch (last_source_frame_number) { | 3946 switch (last_source_frame_number) { |
3994 case 0: | 3947 case 0: |
3995 layer_tree_host()->SetRootLayer(root_); | 3948 layer_tree->SetRootLayer(root_); |
3996 break; | 3949 break; |
3997 case 1: | 3950 case 1: |
3998 EXPECT_FALSE( | 3951 EXPECT_FALSE( |
3999 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 3952 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
4000 EXPECT_FALSE( | 3953 EXPECT_FALSE( |
4001 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 3954 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
4002 EXPECT_FALSE( | 3955 EXPECT_FALSE( |
4003 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | 3956 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
4004 EXPECT_FALSE( | 3957 EXPECT_FALSE( |
4005 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | 3958 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4152 // to the compositor thread, even though no resources are updated in | 4105 // to the compositor thread, even though no resources are updated in |
4153 // response to that invalidation. | 4106 // response to that invalidation. |
4154 class LayerTreeHostTestVideoLayerInvalidate : public LayerInvalidateCausesDraw { | 4107 class LayerTreeHostTestVideoLayerInvalidate : public LayerInvalidateCausesDraw { |
4155 public: | 4108 public: |
4156 void SetupTree() override { | 4109 void SetupTree() override { |
4157 LayerTreeHostTest::SetupTree(); | 4110 LayerTreeHostTest::SetupTree(); |
4158 scoped_refptr<VideoLayer> video_layer = | 4111 scoped_refptr<VideoLayer> video_layer = |
4159 VideoLayer::Create(&provider_, media::VIDEO_ROTATION_0); | 4112 VideoLayer::Create(&provider_, media::VIDEO_ROTATION_0); |
4160 video_layer->SetBounds(gfx::Size(10, 10)); | 4113 video_layer->SetBounds(gfx::Size(10, 10)); |
4161 video_layer->SetIsDrawable(true); | 4114 video_layer->SetIsDrawable(true); |
4162 layer_tree_host()->root_layer()->AddChild(video_layer); | 4115 layer_tree()->root_layer()->AddChild(video_layer); |
4163 | 4116 |
4164 invalidate_layer_ = video_layer; | 4117 invalidate_layer_ = video_layer; |
4165 } | 4118 } |
4166 | 4119 |
4167 private: | 4120 private: |
4168 FakeVideoFrameProvider provider_; | 4121 FakeVideoFrameProvider provider_; |
4169 }; | 4122 }; |
4170 | 4123 |
4171 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate); | 4124 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate); |
4172 | 4125 |
4173 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { | 4126 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { |
4174 protected: | 4127 protected: |
4175 void SetupTree() override { | 4128 void SetupTree() override { |
4176 root_layer_ = Layer::Create(); | 4129 root_layer_ = Layer::Create(); |
4177 root_layer_->SetPosition(gfx::PointF()); | 4130 root_layer_->SetPosition(gfx::PointF()); |
4178 root_layer_->SetBounds(gfx::Size(10, 10)); | 4131 root_layer_->SetBounds(gfx::Size(10, 10)); |
4179 | 4132 |
4180 parent_layer_ = SolidColorLayer::Create(); | 4133 parent_layer_ = SolidColorLayer::Create(); |
4181 parent_layer_->SetPosition(gfx::PointF()); | 4134 parent_layer_->SetPosition(gfx::PointF()); |
4182 parent_layer_->SetBounds(gfx::Size(10, 10)); | 4135 parent_layer_->SetBounds(gfx::Size(10, 10)); |
4183 parent_layer_->SetIsDrawable(true); | 4136 parent_layer_->SetIsDrawable(true); |
4184 root_layer_->AddChild(parent_layer_); | 4137 root_layer_->AddChild(parent_layer_); |
4185 | 4138 |
4186 child_layer_ = SolidColorLayer::Create(); | 4139 child_layer_ = SolidColorLayer::Create(); |
4187 child_layer_->SetPosition(gfx::PointF()); | 4140 child_layer_->SetPosition(gfx::PointF()); |
4188 child_layer_->SetBounds(gfx::Size(10, 10)); | 4141 child_layer_->SetBounds(gfx::Size(10, 10)); |
4189 child_layer_->SetIsDrawable(true); | 4142 child_layer_->SetIsDrawable(true); |
4190 parent_layer_->AddChild(child_layer_); | 4143 parent_layer_->AddChild(child_layer_); |
4191 | 4144 |
4192 layer_tree_host()->SetRootLayer(root_layer_); | 4145 layer_tree()->SetRootLayer(root_layer_); |
4193 LayerTreeHostTest::SetupTree(); | 4146 LayerTreeHostTest::SetupTree(); |
4194 } | 4147 } |
4195 | 4148 |
4196 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4149 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
4197 | 4150 |
4198 void DidCommitAndDrawFrame() override { | 4151 void DidCommitAndDrawFrame() override { |
4199 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 4152 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
4200 switch (layer_tree_host()->source_frame_number()) { | 4153 switch (layer_tree_host()->source_frame_number()) { |
4201 case 1: | 4154 case 1: |
4202 // The layer type used does not need to push properties every frame. | 4155 // The layer type used does not need to push properties every frame. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4236 }; | 4189 }; |
4237 | 4190 |
4238 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer); | 4191 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer); |
4239 | 4192 |
4240 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { | 4193 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { |
4241 protected: | 4194 protected: |
4242 void SetupTree() override { | 4195 void SetupTree() override { |
4243 root_layer_ = FakePictureLayer::Create(&client_); | 4196 root_layer_ = FakePictureLayer::Create(&client_); |
4244 root_layer_->SetBounds(gfx::Size(10, 10)); | 4197 root_layer_->SetBounds(gfx::Size(10, 10)); |
4245 | 4198 |
4246 layer_tree_host()->SetRootLayer(root_layer_); | 4199 layer_tree()->SetRootLayer(root_layer_); |
4247 LayerTreeHostTest::SetupTree(); | 4200 LayerTreeHostTest::SetupTree(); |
4248 client_.set_bounds(root_layer_->bounds()); | 4201 client_.set_bounds(root_layer_->bounds()); |
4249 } | 4202 } |
4250 | 4203 |
4251 void BeginTest() override { | 4204 void BeginTest() override { |
4252 // The viewport is empty, but we still need to update layers on the main | 4205 // The viewport is empty, but we still need to update layers on the main |
4253 // thread. | 4206 // thread. |
4254 layer_tree_host()->SetViewportSize(gfx::Size(0, 0)); | 4207 layer_tree()->SetViewportSize(gfx::Size(0, 0)); |
4255 PostSetNeedsCommitToMainThread(); | 4208 PostSetNeedsCommitToMainThread(); |
4256 } | 4209 } |
4257 | 4210 |
4258 void DidCommit() override { | 4211 void DidCommit() override { |
4259 // The layer should be updated even though the viewport is empty, so we | 4212 // The layer should be updated even though the viewport is empty, so we |
4260 // are capable of drawing it on the impl tree. | 4213 // are capable of drawing it on the impl tree. |
4261 EXPECT_GT(root_layer_->update_count(), 0); | 4214 EXPECT_GT(root_layer_->update_count(), 0); |
4262 EndTest(); | 4215 EndTest(); |
4263 } | 4216 } |
4264 | 4217 |
(...skipping 30 matching lines...) Expand all Loading... |
4295 root_layer_->AddChild(inner_viewport_container_layer); | 4248 root_layer_->AddChild(inner_viewport_container_layer); |
4296 inner_viewport_container_layer->AddChild(overscroll_elasticity_layer); | 4249 inner_viewport_container_layer->AddChild(overscroll_elasticity_layer); |
4297 overscroll_elasticity_layer->AddChild(page_scale_layer); | 4250 overscroll_elasticity_layer->AddChild(page_scale_layer); |
4298 page_scale_layer->AddChild(inner_viewport_scroll_layer); | 4251 page_scale_layer->AddChild(inner_viewport_scroll_layer); |
4299 | 4252 |
4300 scoped_refptr<Layer> content_layer = FakePictureLayer::Create(&client_); | 4253 scoped_refptr<Layer> content_layer = FakePictureLayer::Create(&client_); |
4301 content_layer_id_ = content_layer->id(); | 4254 content_layer_id_ = content_layer->id(); |
4302 content_layer->SetBounds(gfx::Size(10, 10)); | 4255 content_layer->SetBounds(gfx::Size(10, 10)); |
4303 inner_viewport_scroll_layer->AddChild(content_layer); | 4256 inner_viewport_scroll_layer->AddChild(content_layer); |
4304 | 4257 |
4305 layer_tree_host()->SetRootLayer(root_layer_); | 4258 layer_tree()->SetRootLayer(root_layer_); |
4306 layer_tree_host()->RegisterViewportLayers( | 4259 layer_tree()->RegisterViewportLayers(overscroll_elasticity_layer, |
4307 overscroll_elasticity_layer, page_scale_layer, | 4260 page_scale_layer, |
4308 inner_viewport_scroll_layer, nullptr); | 4261 inner_viewport_scroll_layer, nullptr); |
4309 LayerTreeHostTest::SetupTree(); | 4262 LayerTreeHostTest::SetupTree(); |
4310 client_.set_bounds(content_layer->bounds()); | 4263 client_.set_bounds(content_layer->bounds()); |
4311 } | 4264 } |
4312 | 4265 |
4313 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4266 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
4314 | 4267 |
4315 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 4268 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
4316 if (host_impl->sync_tree()->source_frame_number() == 0) { | 4269 if (host_impl->sync_tree()->source_frame_number() == 0) { |
4317 scroll_elasticity_helper_ = host_impl->CreateScrollElasticityHelper(); | 4270 scroll_elasticity_helper_ = host_impl->CreateScrollElasticityHelper(); |
4318 } | 4271 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4390 second_context_provider_.get() ? second_output_surface_memory_limit_ | 4343 second_context_provider_.get() ? second_output_surface_memory_limit_ |
4391 : first_output_surface_memory_limit_, | 4344 : first_output_surface_memory_limit_, |
4392 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, | 4345 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, |
4393 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); | 4346 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); |
4394 return std::move(output_surface); | 4347 return std::move(output_surface); |
4395 } | 4348 } |
4396 | 4349 |
4397 void SetupTree() override { | 4350 void SetupTree() override { |
4398 root_ = FakePictureLayer::Create(&client_); | 4351 root_ = FakePictureLayer::Create(&client_); |
4399 root_->SetBounds(gfx::Size(20, 20)); | 4352 root_->SetBounds(gfx::Size(20, 20)); |
4400 layer_tree_host()->SetRootLayer(root_); | 4353 layer_tree()->SetRootLayer(root_); |
4401 LayerTreeHostTest::SetupTree(); | 4354 LayerTreeHostTest::SetupTree(); |
4402 client_.set_bounds(root_->bounds()); | 4355 client_.set_bounds(root_->bounds()); |
4403 } | 4356 } |
4404 | 4357 |
4405 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4358 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
4406 | 4359 |
4407 void DidCommitAndDrawFrame() override { | 4360 void DidCommitAndDrawFrame() override { |
4408 // Lost context sometimes takes two frames to recreate. The third frame | 4361 // Lost context sometimes takes two frames to recreate. The third frame |
4409 // is sometimes aborted, so wait until the fourth frame to verify that | 4362 // is sometimes aborted, so wait until the fourth frame to verify that |
4410 // the memory has been set, and the fifth frame to end the test. | 4363 // the memory has been set, and the fifth frame to end the test. |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4643 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); | 4596 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); |
4644 | 4597 |
4645 class LayerTreeHostTestKeepSwapPromise : public LayerTreeHostTest { | 4598 class LayerTreeHostTestKeepSwapPromise : public LayerTreeHostTest { |
4646 public: | 4599 public: |
4647 LayerTreeHostTestKeepSwapPromise() {} | 4600 LayerTreeHostTestKeepSwapPromise() {} |
4648 | 4601 |
4649 void BeginTest() override { | 4602 void BeginTest() override { |
4650 layer_ = SolidColorLayer::Create(); | 4603 layer_ = SolidColorLayer::Create(); |
4651 layer_->SetIsDrawable(true); | 4604 layer_->SetIsDrawable(true); |
4652 layer_->SetBounds(gfx::Size(10, 10)); | 4605 layer_->SetBounds(gfx::Size(10, 10)); |
4653 layer_tree_host()->SetRootLayer(layer_); | 4606 layer_tree()->SetRootLayer(layer_); |
4654 gfx::Size bounds(100, 100); | 4607 gfx::Size bounds(100, 100); |
4655 layer_tree_host()->SetViewportSize(bounds); | 4608 layer_tree()->SetViewportSize(bounds); |
4656 PostSetNeedsCommitToMainThread(); | 4609 PostSetNeedsCommitToMainThread(); |
4657 } | 4610 } |
4658 | 4611 |
4659 void DidCommit() override { | 4612 void DidCommit() override { |
4660 MainThreadTaskRunner()->PostTask( | 4613 MainThreadTaskRunner()->PostTask( |
4661 FROM_HERE, base::Bind(&LayerTreeHostTestKeepSwapPromise::ChangeFrame, | 4614 FROM_HERE, base::Bind(&LayerTreeHostTestKeepSwapPromise::ChangeFrame, |
4662 base::Unretained(this))); | 4615 base::Unretained(this))); |
4663 } | 4616 } |
4664 | 4617 |
4665 void ChangeFrame() { | 4618 void ChangeFrame() { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4738 LayerTreeHostTestKeepSwapPromiseMFBA() {} | 4691 LayerTreeHostTestKeepSwapPromiseMFBA() {} |
4739 | 4692 |
4740 void InitializeSettings(LayerTreeSettings* settings) override { | 4693 void InitializeSettings(LayerTreeSettings* settings) override { |
4741 settings->main_frame_before_activation_enabled = true; | 4694 settings->main_frame_before_activation_enabled = true; |
4742 } | 4695 } |
4743 | 4696 |
4744 void BeginTest() override { | 4697 void BeginTest() override { |
4745 layer_ = SolidColorLayer::Create(); | 4698 layer_ = SolidColorLayer::Create(); |
4746 layer_->SetIsDrawable(true); | 4699 layer_->SetIsDrawable(true); |
4747 layer_->SetBounds(gfx::Size(10, 10)); | 4700 layer_->SetBounds(gfx::Size(10, 10)); |
4748 layer_tree_host()->SetRootLayer(layer_); | 4701 layer_tree()->SetRootLayer(layer_); |
4749 gfx::Size bounds(100, 100); | 4702 gfx::Size bounds(100, 100); |
4750 layer_tree_host()->SetViewportSize(bounds); | 4703 layer_tree()->SetViewportSize(bounds); |
4751 PostSetNeedsCommitToMainThread(); | 4704 PostSetNeedsCommitToMainThread(); |
4752 } | 4705 } |
4753 | 4706 |
4754 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { | 4707 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { |
4755 // Safe to check frame number here because main thread is blocked. | 4708 // Safe to check frame number here because main thread is blocked. |
4756 if (layer_tree_host()->source_frame_number() == 0) { | 4709 if (layer_tree_host()->source_frame_number() == 0) { |
4757 host_impl->BlockNotifyReadyToActivateForTesting(true); | 4710 host_impl->BlockNotifyReadyToActivateForTesting(true); |
4758 } else { | 4711 } else { |
4759 NOTREACHED(); | 4712 NOTREACHED(); |
4760 } | 4713 } |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5017 }; | 4970 }; |
5018 | 4971 |
5019 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor); | 4972 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor); |
5020 | 4973 |
5021 class LayerTreeHostTestHighResRequiredAfterEvictingUIResources | 4974 class LayerTreeHostTestHighResRequiredAfterEvictingUIResources |
5022 : public LayerTreeHostTest { | 4975 : public LayerTreeHostTest { |
5023 protected: | 4976 protected: |
5024 void SetupTree() override { | 4977 void SetupTree() override { |
5025 LayerTreeHostTest::SetupTree(); | 4978 LayerTreeHostTest::SetupTree(); |
5026 ui_resource_ = FakeScopedUIResource::Create(layer_tree_host()); | 4979 ui_resource_ = FakeScopedUIResource::Create(layer_tree_host()); |
5027 client_.set_bounds(layer_tree_host()->root_layer()->bounds()); | 4980 client_.set_bounds(layer_tree()->root_layer()->bounds()); |
5028 } | 4981 } |
5029 | 4982 |
5030 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4983 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
5031 | 4984 |
5032 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 4985 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
5033 host_impl->EvictAllUIResources(); | 4986 host_impl->EvictAllUIResources(); |
5034 // Existence of evicted UI resources will trigger NEW_CONTENT_TAKES_PRIORITY | 4987 // Existence of evicted UI resources will trigger NEW_CONTENT_TAKES_PRIORITY |
5035 // mode. Active tree should require high-res to draw after entering this | 4988 // mode. Active tree should require high-res to draw after entering this |
5036 // mode to ensure that high-res tiles are also required for a pending tree | 4989 // mode to ensure that high-res tiles are also required for a pending tree |
5037 // to be activated. | 4990 // to be activated. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5073 std::unique_ptr<FakeRecordingSource> recording_source( | 5026 std::unique_ptr<FakeRecordingSource> recording_source( |
5074 new FakeRecordingSource); | 5027 new FakeRecordingSource); |
5075 recording_source_ = recording_source.get(); | 5028 recording_source_ = recording_source.get(); |
5076 | 5029 |
5077 scoped_refptr<FakePictureLayer> layer = | 5030 scoped_refptr<FakePictureLayer> layer = |
5078 FakePictureLayer::CreateWithRecordingSource( | 5031 FakePictureLayer::CreateWithRecordingSource( |
5079 &layer_client_, std::move(recording_source)); | 5032 &layer_client_, std::move(recording_source)); |
5080 layer_ = layer.get(); | 5033 layer_ = layer.get(); |
5081 layer->SetBounds(gfx::Size(10, 10)); | 5034 layer->SetBounds(gfx::Size(10, 10)); |
5082 layer->SetIsDrawable(true); | 5035 layer->SetIsDrawable(true); |
5083 layer_tree_host()->root_layer()->AddChild(layer); | 5036 layer_tree()->root_layer()->AddChild(layer); |
5084 layer_client_.set_bounds(layer_->bounds()); | 5037 layer_client_.set_bounds(layer_->bounds()); |
5085 } | 5038 } |
5086 | 5039 |
5087 void BeginTest() override { | 5040 void BeginTest() override { |
5088 // Verify default value. | 5041 // Verify default value. |
5089 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5042 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
5090 | 5043 |
5091 // Setting gpu rasterization trigger does not enable gpu rasterization. | 5044 // Setting gpu rasterization trigger does not enable gpu rasterization. |
5092 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 5045 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
5093 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5046 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5127 std::unique_ptr<FakeRecordingSource> recording_source( | 5080 std::unique_ptr<FakeRecordingSource> recording_source( |
5128 new FakeRecordingSource); | 5081 new FakeRecordingSource); |
5129 recording_source_ = recording_source.get(); | 5082 recording_source_ = recording_source.get(); |
5130 | 5083 |
5131 scoped_refptr<FakePictureLayer> layer = | 5084 scoped_refptr<FakePictureLayer> layer = |
5132 FakePictureLayer::CreateWithRecordingSource( | 5085 FakePictureLayer::CreateWithRecordingSource( |
5133 &layer_client_, std::move(recording_source)); | 5086 &layer_client_, std::move(recording_source)); |
5134 layer_ = layer.get(); | 5087 layer_ = layer.get(); |
5135 layer->SetBounds(gfx::Size()); | 5088 layer->SetBounds(gfx::Size()); |
5136 layer->SetIsDrawable(true); | 5089 layer->SetIsDrawable(true); |
5137 layer_tree_host()->root_layer()->AddChild(layer); | 5090 layer_tree()->root_layer()->AddChild(layer); |
5138 layer_client_.set_bounds(layer->bounds()); | 5091 layer_client_.set_bounds(layer->bounds()); |
5139 } | 5092 } |
5140 | 5093 |
5141 void BeginTest() override { | 5094 void BeginTest() override { |
5142 // Setting gpu rasterization trigger does not enable gpu rasterization. | 5095 // Setting gpu rasterization trigger does not enable gpu rasterization. |
5143 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 5096 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
5144 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5097 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
5145 | 5098 |
5146 PostSetNeedsCommitToMainThread(); | 5099 PostSetNeedsCommitToMainThread(); |
5147 } | 5100 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5183 std::unique_ptr<FakeRecordingSource> recording_source( | 5136 std::unique_ptr<FakeRecordingSource> recording_source( |
5184 new FakeRecordingSource); | 5137 new FakeRecordingSource); |
5185 recording_source_ = recording_source.get(); | 5138 recording_source_ = recording_source.get(); |
5186 | 5139 |
5187 scoped_refptr<FakePictureLayer> layer = | 5140 scoped_refptr<FakePictureLayer> layer = |
5188 FakePictureLayer::CreateWithRecordingSource( | 5141 FakePictureLayer::CreateWithRecordingSource( |
5189 &layer_client_, std::move(recording_source)); | 5142 &layer_client_, std::move(recording_source)); |
5190 layer_ = layer.get(); | 5143 layer_ = layer.get(); |
5191 layer->SetBounds(gfx::Size(10, 10)); | 5144 layer->SetBounds(gfx::Size(10, 10)); |
5192 layer->SetIsDrawable(true); | 5145 layer->SetIsDrawable(true); |
5193 layer_tree_host()->root_layer()->AddChild(layer); | 5146 layer_tree()->root_layer()->AddChild(layer); |
5194 layer_client_.set_bounds(layer_->bounds()); | 5147 layer_client_.set_bounds(layer_->bounds()); |
5195 } | 5148 } |
5196 | 5149 |
5197 void BeginTest() override { | 5150 void BeginTest() override { |
5198 // Verify default value. | 5151 // Verify default value. |
5199 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5152 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
5200 | 5153 |
5201 // Gpu rasterization trigger is relevant. | 5154 // Gpu rasterization trigger is relevant. |
5202 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 5155 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
5203 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5156 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5253 std::unique_ptr<FakeRecordingSource> recording_source( | 5206 std::unique_ptr<FakeRecordingSource> recording_source( |
5254 new FakeRecordingSource); | 5207 new FakeRecordingSource); |
5255 recording_source_ = recording_source.get(); | 5208 recording_source_ = recording_source.get(); |
5256 | 5209 |
5257 scoped_refptr<FakePictureLayer> layer = | 5210 scoped_refptr<FakePictureLayer> layer = |
5258 FakePictureLayer::CreateWithRecordingSource( | 5211 FakePictureLayer::CreateWithRecordingSource( |
5259 &layer_client_, std::move(recording_source)); | 5212 &layer_client_, std::move(recording_source)); |
5260 layer_ = layer.get(); | 5213 layer_ = layer.get(); |
5261 layer->SetBounds(gfx::Size(10, 10)); | 5214 layer->SetBounds(gfx::Size(10, 10)); |
5262 layer->SetIsDrawable(true); | 5215 layer->SetIsDrawable(true); |
5263 layer_tree_host()->root_layer()->AddChild(layer); | 5216 layer_tree()->root_layer()->AddChild(layer); |
5264 layer_client_.set_bounds(layer_->bounds()); | 5217 layer_client_.set_bounds(layer_->bounds()); |
5265 } | 5218 } |
5266 | 5219 |
5267 void BeginTest() override { | 5220 void BeginTest() override { |
5268 // Verify default value. | 5221 // Verify default value. |
5269 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5222 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
5270 | 5223 |
5271 // Gpu rasterization trigger is relevant. | 5224 // Gpu rasterization trigger is relevant. |
5272 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 5225 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
5273 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5226 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5336 new FakeRecordingSource); | 5289 new FakeRecordingSource); |
5337 recording_source_ = recording_source.get(); | 5290 recording_source_ = recording_source.get(); |
5338 | 5291 |
5339 scoped_refptr<FakePictureLayer> layer = | 5292 scoped_refptr<FakePictureLayer> layer = |
5340 FakePictureLayer::CreateWithRecordingSource( | 5293 FakePictureLayer::CreateWithRecordingSource( |
5341 &layer_client_, std::move(recording_source)); | 5294 &layer_client_, std::move(recording_source)); |
5342 layer_ = layer.get(); | 5295 layer_ = layer.get(); |
5343 | 5296 |
5344 layer->SetBounds(gfx::Size(10, 10)); | 5297 layer->SetBounds(gfx::Size(10, 10)); |
5345 layer->SetIsDrawable(true); | 5298 layer->SetIsDrawable(true); |
5346 layer_tree_host()->root_layer()->AddChild(layer); | 5299 layer_tree()->root_layer()->AddChild(layer); |
5347 layer_client_.set_bounds(layer_->bounds()); | 5300 layer_client_.set_bounds(layer_->bounds()); |
5348 } | 5301 } |
5349 | 5302 |
5350 void BeginTest() override { | 5303 void BeginTest() override { |
5351 // Verify default value. | 5304 // Verify default value. |
5352 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5305 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
5353 | 5306 |
5354 // With gpu rasterization forced, gpu rasterization trigger is irrelevant. | 5307 // With gpu rasterization forced, gpu rasterization trigger is irrelevant. |
5355 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 5308 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
5356 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5309 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5672 | 5625 |
5673 // Make sure page scale and top control deltas are applied to the client even | 5626 // Make sure page scale and top control deltas are applied to the client even |
5674 // when the LayerTreeHost doesn't have a root layer. | 5627 // when the LayerTreeHost doesn't have a root layer. |
5675 class LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer | 5628 class LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer |
5676 : public LayerTreeHostTest { | 5629 : public LayerTreeHostTest { |
5677 public: | 5630 public: |
5678 LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer() | 5631 LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer() |
5679 : deltas_sent_to_client_(false) {} | 5632 : deltas_sent_to_client_(false) {} |
5680 | 5633 |
5681 void BeginTest() override { | 5634 void BeginTest() override { |
5682 layer_tree_host()->SetRootLayer(nullptr); | 5635 layer_tree()->SetRootLayer(nullptr); |
5683 info_.page_scale_delta = 3.14f; | 5636 info_.page_scale_delta = 3.14f; |
5684 info_.top_controls_delta = 2.73f; | 5637 info_.top_controls_delta = 2.73f; |
5685 | 5638 |
5686 PostSetNeedsCommitToMainThread(); | 5639 PostSetNeedsCommitToMainThread(); |
5687 } | 5640 } |
5688 | 5641 |
5689 void BeginMainFrame(const BeginFrameArgs& args) override { | 5642 void BeginMainFrame(const BeginFrameArgs& args) override { |
5690 EXPECT_EQ(nullptr, layer_tree_host()->root_layer()); | 5643 EXPECT_EQ(nullptr, layer_tree()->root_layer()); |
5691 | 5644 |
5692 layer_tree_host()->ApplyScrollAndScale(&info_); | 5645 layer_tree_host()->ApplyScrollAndScale(&info_); |
5693 EndTest(); | 5646 EndTest(); |
5694 } | 5647 } |
5695 | 5648 |
5696 void ApplyViewportDeltas(const gfx::Vector2dF& inner, | 5649 void ApplyViewportDeltas(const gfx::Vector2dF& inner, |
5697 const gfx::Vector2dF& outer, | 5650 const gfx::Vector2dF& outer, |
5698 const gfx::Vector2dF& elastic_overscroll_delta, | 5651 const gfx::Vector2dF& elastic_overscroll_delta, |
5699 float scale_delta, | 5652 float scale_delta, |
5700 float top_controls_delta) override { | 5653 float top_controls_delta) override { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5738 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); | 5691 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); |
5739 scoped_refptr<FakePictureLayer> layer = | 5692 scoped_refptr<FakePictureLayer> layer = |
5740 FakePictureLayer::CreateWithRecordingSource(&client_, | 5693 FakePictureLayer::CreateWithRecordingSource(&client_, |
5741 std::move(recording)); | 5694 std::move(recording)); |
5742 layer->SetBounds(gfx::Size(500, 500)); | 5695 layer->SetBounds(gfx::Size(500, 500)); |
5743 layer->SetContentsOpaque(true); | 5696 layer->SetContentsOpaque(true); |
5744 // Avoid LCD text on the layer so we don't cause extra commits when we | 5697 // Avoid LCD text on the layer so we don't cause extra commits when we |
5745 // pinch. | 5698 // pinch. |
5746 pinch->AddChild(layer); | 5699 pinch->AddChild(layer); |
5747 | 5700 |
5748 layer_tree_host()->RegisterViewportLayers(NULL, page_scale_layer, pinch, | 5701 layer_tree()->RegisterViewportLayers(NULL, page_scale_layer, pinch, |
5749 nullptr); | 5702 nullptr); |
5750 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); | 5703 layer_tree()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); |
5751 layer_tree_host()->SetRootLayer(root_clip); | 5704 layer_tree()->SetRootLayer(root_clip); |
5752 LayerTreeHostTest::SetupTree(); | 5705 LayerTreeHostTest::SetupTree(); |
5753 client_.set_bounds(root_clip->bounds()); | 5706 client_.set_bounds(root_clip->bounds()); |
5754 } | 5707 } |
5755 | 5708 |
5756 // Returns the delta scale of all quads in the frame's root pass from their | 5709 // Returns the delta scale of all quads in the frame's root pass from their |
5757 // ideal, or 0 if they are not all the same. | 5710 // ideal, or 0 if they are not all the same. |
5758 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { | 5711 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { |
5759 if (frame_data->has_no_damage) | 5712 if (frame_data->has_no_damage) |
5760 return 0.f; | 5713 return 0.f; |
5761 float frame_scale = 0.f; | 5714 float frame_scale = 0.f; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5939 client_.set_bounds(root->bounds()); | 5892 client_.set_bounds(root->bounds()); |
5940 | 5893 |
5941 std::unique_ptr<FakeRecordingSource> recording(new FakeRecordingSource); | 5894 std::unique_ptr<FakeRecordingSource> recording(new FakeRecordingSource); |
5942 scoped_refptr<FakePictureLayer> layer = | 5895 scoped_refptr<FakePictureLayer> layer = |
5943 FakePictureLayer::CreateWithRecordingSource(&client_, | 5896 FakePictureLayer::CreateWithRecordingSource(&client_, |
5944 std::move(recording)); | 5897 std::move(recording)); |
5945 layer->SetBounds(gfx::Size(500, 500)); | 5898 layer->SetBounds(gfx::Size(500, 500)); |
5946 layer->SetContentsOpaque(true); | 5899 layer->SetContentsOpaque(true); |
5947 root->AddChild(layer); | 5900 root->AddChild(layer); |
5948 | 5901 |
5949 layer_tree_host()->SetRootLayer(root); | 5902 layer_tree()->SetRootLayer(root); |
5950 LayerTreeHostTest::SetupTree(); | 5903 LayerTreeHostTest::SetupTree(); |
5951 client_.set_bounds(root->bounds()); | 5904 client_.set_bounds(root->bounds()); |
5952 } | 5905 } |
5953 | 5906 |
5954 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5907 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
5955 | 5908 |
5956 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 5909 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
5957 LayerTreeHostImpl::FrameData* frame_data, | 5910 LayerTreeHostImpl::FrameData* frame_data, |
5958 DrawResult draw_result) override { | 5911 DrawResult draw_result) override { |
5959 EXPECT_NE(0u, host_impl->resource_provider()->num_resources()); | 5912 EXPECT_NE(0u, host_impl->resource_provider()->num_resources()); |
(...skipping 20 matching lines...) Expand all Loading... |
5980 client_.set_fill_with_nonsolid_color(true); | 5933 client_.set_fill_with_nonsolid_color(true); |
5981 | 5934 |
5982 std::unique_ptr<FakeRecordingSource> recording(new FakeRecordingSource); | 5935 std::unique_ptr<FakeRecordingSource> recording(new FakeRecordingSource); |
5983 scoped_refptr<FakePictureLayer> root = | 5936 scoped_refptr<FakePictureLayer> root = |
5984 FakePictureLayer::CreateWithRecordingSource(&client_, | 5937 FakePictureLayer::CreateWithRecordingSource(&client_, |
5985 std::move(recording)); | 5938 std::move(recording)); |
5986 root->SetBounds(gfx::Size(10000, 10000)); | 5939 root->SetBounds(gfx::Size(10000, 10000)); |
5987 client_.set_bounds(root->bounds()); | 5940 client_.set_bounds(root->bounds()); |
5988 root->SetContentsOpaque(true); | 5941 root->SetContentsOpaque(true); |
5989 | 5942 |
5990 layer_tree_host()->SetRootLayer(root); | 5943 layer_tree()->SetRootLayer(root); |
5991 LayerTreeHostTest::SetupTree(); | 5944 LayerTreeHostTest::SetupTree(); |
5992 layer_tree_host()->SetViewportSize(viewport_size_); | 5945 layer_tree()->SetViewportSize(viewport_size_); |
5993 client_.set_bounds(root->bounds()); | 5946 client_.set_bounds(root->bounds()); |
5994 } | 5947 } |
5995 | 5948 |
5996 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5949 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
5997 | 5950 |
5998 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 5951 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
5999 LayerTreeHostImpl::FrameData* frame_data, | 5952 LayerTreeHostImpl::FrameData* frame_data, |
6000 DrawResult draw_result) override { | 5953 DrawResult draw_result) override { |
6001 EXPECT_EQ(10u, host_impl->resource_provider()->num_resources()); | 5954 EXPECT_EQ(10u, host_impl->resource_provider()->num_resources()); |
6002 EndTest(); | 5955 EndTest(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6040 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); | 5993 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); |
6041 scoped_refptr<FakePictureLayer> layer = | 5994 scoped_refptr<FakePictureLayer> layer = |
6042 FakePictureLayer::CreateWithRecordingSource(&client_, | 5995 FakePictureLayer::CreateWithRecordingSource(&client_, |
6043 std::move(recording)); | 5996 std::move(recording)); |
6044 layer->SetBounds(gfx::Size(500, 500)); | 5997 layer->SetBounds(gfx::Size(500, 500)); |
6045 layer->SetContentsOpaque(true); | 5998 layer->SetContentsOpaque(true); |
6046 // Avoid LCD text on the layer so we don't cause extra commits when we | 5999 // Avoid LCD text on the layer so we don't cause extra commits when we |
6047 // pinch. | 6000 // pinch. |
6048 pinch->AddChild(layer); | 6001 pinch->AddChild(layer); |
6049 | 6002 |
6050 layer_tree_host()->RegisterViewportLayers(NULL, page_scale_layer, pinch, | 6003 layer_tree()->RegisterViewportLayers(NULL, page_scale_layer, pinch, |
6051 nullptr); | 6004 nullptr); |
6052 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); | 6005 layer_tree()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); |
6053 layer_tree_host()->SetRootLayer(root_clip); | 6006 layer_tree()->SetRootLayer(root_clip); |
6054 LayerTreeHostTest::SetupTree(); | 6007 LayerTreeHostTest::SetupTree(); |
6055 client_.set_bounds(root_clip->bounds()); | 6008 client_.set_bounds(root_clip->bounds()); |
6056 } | 6009 } |
6057 | 6010 |
6058 // Returns the delta scale of all quads in the frame's root pass from their | 6011 // Returns the delta scale of all quads in the frame's root pass from their |
6059 // ideal, or 0 if they are not all the same. | 6012 // ideal, or 0 if they are not all the same. |
6060 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { | 6013 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { |
6061 if (frame_data->has_no_damage) | 6014 if (frame_data->has_no_damage) |
6062 return 0.f; | 6015 return 0.f; |
6063 float frame_scale = 0.f; | 6016 float frame_scale = 0.f; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6197 : notify_ready_to_activate_count_(0u), | 6150 : notify_ready_to_activate_count_(0u), |
6198 scheduled_prepare_tiles_count_(0) {} | 6151 scheduled_prepare_tiles_count_(0) {} |
6199 | 6152 |
6200 void SetupTree() override { | 6153 void SetupTree() override { |
6201 client_.set_fill_with_nonsolid_color(true); | 6154 client_.set_fill_with_nonsolid_color(true); |
6202 scoped_refptr<FakePictureLayer> root_layer = | 6155 scoped_refptr<FakePictureLayer> root_layer = |
6203 FakePictureLayer::Create(&client_); | 6156 FakePictureLayer::Create(&client_); |
6204 root_layer->SetBounds(gfx::Size(1500, 1500)); | 6157 root_layer->SetBounds(gfx::Size(1500, 1500)); |
6205 root_layer->SetIsDrawable(true); | 6158 root_layer->SetIsDrawable(true); |
6206 | 6159 |
6207 layer_tree_host()->SetRootLayer(root_layer); | 6160 layer_tree()->SetRootLayer(root_layer); |
6208 LayerTreeHostTest::SetupTree(); | 6161 LayerTreeHostTest::SetupTree(); |
6209 client_.set_bounds(root_layer->bounds()); | 6162 client_.set_bounds(root_layer->bounds()); |
6210 } | 6163 } |
6211 | 6164 |
6212 void BeginTest() override { | 6165 void BeginTest() override { |
6213 layer_tree_host()->SetViewportSize(gfx::Size(16, 16)); | 6166 layer_tree()->SetViewportSize(gfx::Size(16, 16)); |
6214 PostSetNeedsCommitToMainThread(); | 6167 PostSetNeedsCommitToMainThread(); |
6215 } | 6168 } |
6216 | 6169 |
6217 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, | 6170 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, |
6218 bool success) override { | 6171 bool success) override { |
6219 ASSERT_TRUE(success); | 6172 ASSERT_TRUE(success); |
6220 host_impl->tile_manager()->SetScheduledRasterTaskLimitForTesting(1); | 6173 host_impl->tile_manager()->SetScheduledRasterTaskLimitForTesting(1); |
6221 } | 6174 } |
6222 | 6175 |
6223 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { | 6176 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { |
(...skipping 29 matching lines...) Expand all Loading... |
6253 LayerTreeHostTestActivationCausesPrepareTiles() | 6206 LayerTreeHostTestActivationCausesPrepareTiles() |
6254 : scheduled_prepare_tiles_count_(0) {} | 6207 : scheduled_prepare_tiles_count_(0) {} |
6255 | 6208 |
6256 void SetupTree() override { | 6209 void SetupTree() override { |
6257 client_.set_fill_with_nonsolid_color(true); | 6210 client_.set_fill_with_nonsolid_color(true); |
6258 scoped_refptr<FakePictureLayer> root_layer = | 6211 scoped_refptr<FakePictureLayer> root_layer = |
6259 FakePictureLayer::Create(&client_); | 6212 FakePictureLayer::Create(&client_); |
6260 root_layer->SetBounds(gfx::Size(150, 150)); | 6213 root_layer->SetBounds(gfx::Size(150, 150)); |
6261 root_layer->SetIsDrawable(true); | 6214 root_layer->SetIsDrawable(true); |
6262 | 6215 |
6263 layer_tree_host()->SetRootLayer(root_layer); | 6216 layer_tree()->SetRootLayer(root_layer); |
6264 LayerTreeHostTest::SetupTree(); | 6217 LayerTreeHostTest::SetupTree(); |
6265 client_.set_bounds(root_layer->bounds()); | 6218 client_.set_bounds(root_layer->bounds()); |
6266 } | 6219 } |
6267 | 6220 |
6268 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6221 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
6269 | 6222 |
6270 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { | 6223 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { |
6271 // Ensure we've already activated. | 6224 // Ensure we've already activated. |
6272 EXPECT_FALSE(impl->pending_tree()); | 6225 EXPECT_FALSE(impl->pending_tree()); |
6273 | 6226 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6331 }; | 6284 }; |
6332 | 6285 |
6333 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); | 6286 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); |
6334 | 6287 |
6335 class LayerTreeHostTestUpdateCopyRequests : public LayerTreeHostTest { | 6288 class LayerTreeHostTestUpdateCopyRequests : public LayerTreeHostTest { |
6336 protected: | 6289 protected: |
6337 void SetupTree() override { | 6290 void SetupTree() override { |
6338 root = Layer::Create(); | 6291 root = Layer::Create(); |
6339 child = Layer::Create(); | 6292 child = Layer::Create(); |
6340 root->AddChild(child); | 6293 root->AddChild(child); |
6341 layer_tree_host()->SetRootLayer(root); | 6294 layer_tree()->SetRootLayer(root); |
6342 LayerTreeHostTest::SetupTree(); | 6295 LayerTreeHostTest::SetupTree(); |
6343 } | 6296 } |
6344 | 6297 |
6345 static void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} | 6298 static void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} |
6346 | 6299 |
6347 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6300 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
6348 | 6301 |
6349 void WillCommit() override { | 6302 void WillCommit() override { |
6350 switch (layer_tree_host()->source_frame_number()) { | 6303 switch (layer_tree_host()->source_frame_number()) { |
6351 case 1: | 6304 case 1: |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6426 clipping_origin.OffsetFromOrigin()); | 6379 clipping_origin.OffsetFromOrigin()); |
6427 | 6380 |
6428 gfx::Size child_size(50, 50); | 6381 gfx::Size child_size(50, 50); |
6429 content_child_layer->SetBounds(child_size); | 6382 content_child_layer->SetBounds(child_size); |
6430 content_child_layer->SetPosition(gfx::PointF(20.f, 0.f)); | 6383 content_child_layer->SetPosition(gfx::PointF(20.f, 0.f)); |
6431 | 6384 |
6432 gfx::Size mask_size(100, 100); | 6385 gfx::Size mask_size(100, 100); |
6433 mask_layer->SetBounds(mask_size); | 6386 mask_layer->SetBounds(mask_size); |
6434 mask_layer->SetIsMask(true); | 6387 mask_layer->SetIsMask(true); |
6435 | 6388 |
6436 layer_tree_host()->SetRootLayer(root); | 6389 layer_tree()->SetRootLayer(root); |
6437 LayerTreeTest::SetupTree(); | 6390 LayerTreeTest::SetupTree(); |
6438 client_.set_bounds(root->bounds()); | 6391 client_.set_bounds(root->bounds()); |
6439 } | 6392 } |
6440 | 6393 |
6441 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6394 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
6442 | 6395 |
6443 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6396 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
6444 LayerTreeHostImpl::FrameData* frame_data, | 6397 LayerTreeHostImpl::FrameData* frame_data, |
6445 DrawResult draw_result) override { | 6398 DrawResult draw_result) override { |
6446 EXPECT_EQ(2u, frame_data->render_passes.size()); | 6399 EXPECT_EQ(2u, frame_data->render_passes.size()); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6511 scaling_layer->SetBounds(scaling_layer_size); | 6464 scaling_layer->SetBounds(scaling_layer_size); |
6512 gfx::Transform scale; | 6465 gfx::Transform scale; |
6513 scale.Scale(2.f, 2.f); | 6466 scale.Scale(2.f, 2.f); |
6514 scaling_layer->SetTransform(scale); | 6467 scaling_layer->SetTransform(scale); |
6515 | 6468 |
6516 content_layer->SetBounds(scaling_layer_size); | 6469 content_layer->SetBounds(scaling_layer_size); |
6517 | 6470 |
6518 mask_layer->SetBounds(scaling_layer_size); | 6471 mask_layer->SetBounds(scaling_layer_size); |
6519 mask_layer->SetIsMask(true); | 6472 mask_layer->SetIsMask(true); |
6520 | 6473 |
6521 layer_tree_host()->SetRootLayer(root); | 6474 layer_tree()->SetRootLayer(root); |
6522 LayerTreeTest::SetupTree(); | 6475 LayerTreeTest::SetupTree(); |
6523 client_.set_bounds(root->bounds()); | 6476 client_.set_bounds(root->bounds()); |
6524 } | 6477 } |
6525 | 6478 |
6526 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6479 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
6527 | 6480 |
6528 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6481 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
6529 LayerTreeHostImpl::FrameData* frame_data, | 6482 LayerTreeHostImpl::FrameData* frame_data, |
6530 DrawResult draw_result) override { | 6483 DrawResult draw_result) override { |
6531 EXPECT_EQ(2u, frame_data->render_passes.size()); | 6484 EXPECT_EQ(2u, frame_data->render_passes.size()); |
(...skipping 29 matching lines...) Expand all Loading... |
6561 EndTest(); | 6514 EndTest(); |
6562 break; | 6515 break; |
6563 } | 6516 } |
6564 return draw_result; | 6517 return draw_result; |
6565 } | 6518 } |
6566 | 6519 |
6567 void DidCommit() override { | 6520 void DidCommit() override { |
6568 switch (layer_tree_host()->source_frame_number()) { | 6521 switch (layer_tree_host()->source_frame_number()) { |
6569 case 1: | 6522 case 1: |
6570 gfx::Size double_root_size(200, 200); | 6523 gfx::Size double_root_size(200, 200); |
6571 layer_tree_host()->SetViewportSize(double_root_size); | 6524 layer_tree()->SetViewportSize(double_root_size); |
6572 layer_tree_host()->SetDeviceScaleFactor(2.f); | 6525 layer_tree()->SetDeviceScaleFactor(2.f); |
6573 break; | 6526 break; |
6574 } | 6527 } |
6575 } | 6528 } |
6576 | 6529 |
6577 void AfterTest() override {} | 6530 void AfterTest() override {} |
6578 | 6531 |
6579 FakeContentLayerClient client_; | 6532 FakeContentLayerClient client_; |
6580 }; | 6533 }; |
6581 | 6534 |
6582 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling); | 6535 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling); |
(...skipping 17 matching lines...) Expand all Loading... |
6600 gfx::Size root_size(100, 100); | 6553 gfx::Size root_size(100, 100); |
6601 root->SetBounds(root_size); | 6554 root->SetBounds(root_size); |
6602 | 6555 |
6603 gfx::Size layer_size(50, 50); | 6556 gfx::Size layer_size(50, 50); |
6604 content_layer->SetBounds(layer_size); | 6557 content_layer->SetBounds(layer_size); |
6605 | 6558 |
6606 gfx::Size mask_size(100, 100); | 6559 gfx::Size mask_size(100, 100); |
6607 mask_layer->SetBounds(mask_size); | 6560 mask_layer->SetBounds(mask_size); |
6608 mask_layer->SetIsMask(true); | 6561 mask_layer->SetIsMask(true); |
6609 | 6562 |
6610 layer_tree_host()->SetRootLayer(root); | 6563 layer_tree()->SetRootLayer(root); |
6611 LayerTreeTest::SetupTree(); | 6564 LayerTreeTest::SetupTree(); |
6612 client_.set_bounds(root->bounds()); | 6565 client_.set_bounds(root->bounds()); |
6613 } | 6566 } |
6614 | 6567 |
6615 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6568 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
6616 | 6569 |
6617 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6570 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
6618 LayerTreeHostImpl::FrameData* frame_data, | 6571 LayerTreeHostImpl::FrameData* frame_data, |
6619 DrawResult draw_result) override { | 6572 DrawResult draw_result) override { |
6620 EXPECT_EQ(2u, frame_data->render_passes.size()); | 6573 EXPECT_EQ(2u, frame_data->render_passes.size()); |
(...skipping 28 matching lines...) Expand all Loading... |
6649 EndTest(); | 6602 EndTest(); |
6650 break; | 6603 break; |
6651 } | 6604 } |
6652 return draw_result; | 6605 return draw_result; |
6653 } | 6606 } |
6654 | 6607 |
6655 void DidCommit() override { | 6608 void DidCommit() override { |
6656 switch (layer_tree_host()->source_frame_number()) { | 6609 switch (layer_tree_host()->source_frame_number()) { |
6657 case 1: | 6610 case 1: |
6658 gfx::Size double_root_size(200, 200); | 6611 gfx::Size double_root_size(200, 200); |
6659 layer_tree_host()->SetViewportSize(double_root_size); | 6612 layer_tree()->SetViewportSize(double_root_size); |
6660 layer_tree_host()->SetDeviceScaleFactor(2.f); | 6613 layer_tree()->SetDeviceScaleFactor(2.f); |
6661 break; | 6614 break; |
6662 } | 6615 } |
6663 } | 6616 } |
6664 | 6617 |
6665 void AfterTest() override {} | 6618 void AfterTest() override {} |
6666 | 6619 |
6667 FakeContentLayerClient client_; | 6620 FakeContentLayerClient client_; |
6668 }; | 6621 }; |
6669 | 6622 |
6670 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds); | 6623 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds); |
(...skipping 21 matching lines...) Expand all Loading... |
6692 gfx::Size root_size(100, 100); | 6645 gfx::Size root_size(100, 100); |
6693 root->SetBounds(root_size); | 6646 root->SetBounds(root_size); |
6694 | 6647 |
6695 gfx::Size layer_size(50, 50); | 6648 gfx::Size layer_size(50, 50); |
6696 content_layer->SetBounds(layer_size); | 6649 content_layer->SetBounds(layer_size); |
6697 | 6650 |
6698 gfx::Size mask_size(100, 100); | 6651 gfx::Size mask_size(100, 100); |
6699 mask_layer->SetBounds(mask_size); | 6652 mask_layer->SetBounds(mask_size); |
6700 mask_layer->SetIsMask(true); | 6653 mask_layer->SetIsMask(true); |
6701 | 6654 |
6702 layer_tree_host()->SetRootLayer(root); | 6655 layer_tree()->SetRootLayer(root); |
6703 LayerTreeTest::SetupTree(); | 6656 LayerTreeTest::SetupTree(); |
6704 client_.set_bounds(root->bounds()); | 6657 client_.set_bounds(root->bounds()); |
6705 } | 6658 } |
6706 | 6659 |
6707 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6660 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
6708 | 6661 |
6709 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6662 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
6710 LayerTreeHostImpl::FrameData* frame_data, | 6663 LayerTreeHostImpl::FrameData* frame_data, |
6711 DrawResult draw_result) override { | 6664 DrawResult draw_result) override { |
6712 EXPECT_EQ(2u, frame_data->render_passes.size()); | 6665 EXPECT_EQ(2u, frame_data->render_passes.size()); |
(...skipping 29 matching lines...) Expand all Loading... |
6742 EndTest(); | 6695 EndTest(); |
6743 break; | 6696 break; |
6744 } | 6697 } |
6745 return draw_result; | 6698 return draw_result; |
6746 } | 6699 } |
6747 | 6700 |
6748 void DidCommit() override { | 6701 void DidCommit() override { |
6749 switch (layer_tree_host()->source_frame_number()) { | 6702 switch (layer_tree_host()->source_frame_number()) { |
6750 case 1: | 6703 case 1: |
6751 gfx::Size double_root_size(200, 200); | 6704 gfx::Size double_root_size(200, 200); |
6752 layer_tree_host()->SetViewportSize(double_root_size); | 6705 layer_tree()->SetViewportSize(double_root_size); |
6753 layer_tree_host()->SetDeviceScaleFactor(2.f); | 6706 layer_tree()->SetDeviceScaleFactor(2.f); |
6754 break; | 6707 break; |
6755 } | 6708 } |
6756 } | 6709 } |
6757 | 6710 |
6758 void AfterTest() override {} | 6711 void AfterTest() override {} |
6759 | 6712 |
6760 FakeContentLayerClient client_; | 6713 FakeContentLayerClient client_; |
6761 }; | 6714 }; |
6762 | 6715 |
6763 SINGLE_AND_MULTI_THREAD_TEST_F( | 6716 SINGLE_AND_MULTI_THREAD_TEST_F( |
(...skipping 27 matching lines...) Expand all Loading... |
6791 | 6744 |
6792 gfx::Size layer_size(50, 50); | 6745 gfx::Size layer_size(50, 50); |
6793 content_layer->SetBounds(layer_size); | 6746 content_layer->SetBounds(layer_size); |
6794 content_child_layer_->SetBounds(layer_size); | 6747 content_child_layer_->SetBounds(layer_size); |
6795 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f)); | 6748 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f)); |
6796 | 6749 |
6797 gfx::Size mask_size(100, 100); | 6750 gfx::Size mask_size(100, 100); |
6798 mask_layer->SetBounds(mask_size); | 6751 mask_layer->SetBounds(mask_size); |
6799 mask_layer->SetIsMask(true); | 6752 mask_layer->SetIsMask(true); |
6800 | 6753 |
6801 layer_tree_host()->SetRootLayer(root); | 6754 layer_tree()->SetRootLayer(root); |
6802 LayerTreeTest::SetupTree(); | 6755 LayerTreeTest::SetupTree(); |
6803 client_.set_bounds(root->bounds()); | 6756 client_.set_bounds(root->bounds()); |
6804 } | 6757 } |
6805 | 6758 |
6806 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6759 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
6807 | 6760 |
6808 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6761 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
6809 LayerTreeHostImpl::FrameData* frame_data, | 6762 LayerTreeHostImpl::FrameData* frame_data, |
6810 DrawResult draw_result) override { | 6763 DrawResult draw_result) override { |
6811 EXPECT_EQ(2u, frame_data->render_passes.size()); | 6764 EXPECT_EQ(2u, frame_data->render_passes.size()); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6884 scoped_refptr<Layer> post_page_scale = Layer::Create(); | 6837 scoped_refptr<Layer> post_page_scale = Layer::Create(); |
6885 | 6838 |
6886 root->AddChild(pre_page_scale); | 6839 root->AddChild(pre_page_scale); |
6887 root->AddChild(page_scale); | 6840 root->AddChild(page_scale); |
6888 root->AddChild(post_page_scale); | 6841 root->AddChild(post_page_scale); |
6889 | 6842 |
6890 page_scale->AddChild(page_scale_child1); | 6843 page_scale->AddChild(page_scale_child1); |
6891 page_scale->AddChild(page_scale_child2); | 6844 page_scale->AddChild(page_scale_child2); |
6892 page_scale_child1->AddChild(page_scale_grandchild); | 6845 page_scale_child1->AddChild(page_scale_grandchild); |
6893 | 6846 |
6894 layer_tree_host()->SetRootLayer(root); | 6847 layer_tree()->SetRootLayer(root); |
6895 LayerTreeTest::SetupTree(); | 6848 LayerTreeTest::SetupTree(); |
6896 | 6849 |
6897 scoped_refptr<Layer> overscroll_elasticity_layer = nullptr; | 6850 scoped_refptr<Layer> overscroll_elasticity_layer = nullptr; |
6898 scoped_refptr<Layer> inner_viewport_scroll_layer = nullptr; | 6851 scoped_refptr<Layer> inner_viewport_scroll_layer = nullptr; |
6899 scoped_refptr<Layer> outer_viewport_scroll_layer = nullptr; | 6852 scoped_refptr<Layer> outer_viewport_scroll_layer = nullptr; |
6900 layer_tree_host()->RegisterViewportLayers( | 6853 layer_tree()->RegisterViewportLayers( |
6901 overscroll_elasticity_layer, page_scale, inner_viewport_scroll_layer, | 6854 overscroll_elasticity_layer, page_scale, inner_viewport_scroll_layer, |
6902 outer_viewport_scroll_layer); | 6855 outer_viewport_scroll_layer); |
6903 | 6856 |
6904 affected_by_page_scale_.push_back(page_scale->id()); | 6857 affected_by_page_scale_.push_back(page_scale->id()); |
6905 affected_by_page_scale_.push_back(page_scale_child1->id()); | 6858 affected_by_page_scale_.push_back(page_scale_child1->id()); |
6906 affected_by_page_scale_.push_back(page_scale_child2->id()); | 6859 affected_by_page_scale_.push_back(page_scale_child2->id()); |
6907 affected_by_page_scale_.push_back(page_scale_grandchild->id()); | 6860 affected_by_page_scale_.push_back(page_scale_grandchild->id()); |
6908 | 6861 |
6909 not_affected_by_page_scale_.push_back(root->id()); | 6862 not_affected_by_page_scale_.push_back(root->id()); |
6910 not_affected_by_page_scale_.push_back(pre_page_scale->id()); | 6863 not_affected_by_page_scale_.push_back(pre_page_scale->id()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6949 void AfterTest() override {} | 6902 void AfterTest() override {} |
6950 }; | 6903 }; |
6951 | 6904 |
6952 MULTI_THREAD_TEST_F(LayerTreeHostTestDestroyWhileInitializingOutputSurface); | 6905 MULTI_THREAD_TEST_F(LayerTreeHostTestDestroyWhileInitializingOutputSurface); |
6953 | 6906 |
6954 // Makes sure that painted_device_scale_factor is propagated to the | 6907 // Makes sure that painted_device_scale_factor is propagated to the |
6955 // frame's metadata. | 6908 // frame's metadata. |
6956 class LayerTreeHostTestPaintedDeviceScaleFactor : public LayerTreeHostTest { | 6909 class LayerTreeHostTestPaintedDeviceScaleFactor : public LayerTreeHostTest { |
6957 protected: | 6910 protected: |
6958 void BeginTest() override { | 6911 void BeginTest() override { |
6959 layer_tree_host()->SetPaintedDeviceScaleFactor(2.0f); | 6912 layer_tree()->SetPaintedDeviceScaleFactor(2.0f); |
6960 EXPECT_EQ(1.0f, layer_tree_host()->device_scale_factor()); | 6913 EXPECT_EQ(1.0f, layer_tree()->device_scale_factor()); |
6961 PostSetNeedsCommitToMainThread(); | 6914 PostSetNeedsCommitToMainThread(); |
6962 } | 6915 } |
6963 | 6916 |
6964 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 6917 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
6965 EXPECT_EQ(2.0f, host_impl->active_tree()->painted_device_scale_factor()); | 6918 EXPECT_EQ(2.0f, host_impl->active_tree()->painted_device_scale_factor()); |
6966 EXPECT_EQ(1.0f, host_impl->active_tree()->device_scale_factor()); | 6919 EXPECT_EQ(1.0f, host_impl->active_tree()->device_scale_factor()); |
6967 } | 6920 } |
6968 | 6921 |
6969 void DisplayReceivedCompositorFrameOnThread( | 6922 void DisplayReceivedCompositorFrameOnThread( |
6970 const CompositorFrame& frame) override { | 6923 const CompositorFrame& frame) override { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7010 recording->SetGenerateDiscardableImagesMetadata(true); | 6963 recording->SetGenerateDiscardableImagesMetadata(true); |
7011 recording->Rerecord(); | 6964 recording->Rerecord(); |
7012 | 6965 |
7013 scoped_refptr<FakePictureLayer> root = | 6966 scoped_refptr<FakePictureLayer> root = |
7014 FakePictureLayer::CreateWithRecordingSource(&client_, | 6967 FakePictureLayer::CreateWithRecordingSource(&client_, |
7015 std::move(recording)); | 6968 std::move(recording)); |
7016 root->SetBounds(gfx::Size(10000, 10000)); | 6969 root->SetBounds(gfx::Size(10000, 10000)); |
7017 client_.set_bounds(root->bounds()); | 6970 client_.set_bounds(root->bounds()); |
7018 root->SetContentsOpaque(true); | 6971 root->SetContentsOpaque(true); |
7019 | 6972 |
7020 layer_tree_host()->SetRootLayer(root); | 6973 layer_tree()->SetRootLayer(root); |
7021 LayerTreeHostTest::SetupTree(); | 6974 LayerTreeHostTest::SetupTree(); |
7022 layer_tree_host()->SetViewportSize(viewport_size_); | 6975 layer_tree()->SetViewportSize(viewport_size_); |
7023 client_.set_bounds(root->bounds()); | 6976 client_.set_bounds(root->bounds()); |
7024 } | 6977 } |
7025 | 6978 |
7026 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, | 6979 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, |
7027 bool success) override { | 6980 bool success) override { |
7028 // Check that our large_image_size_ is greater than max texture size. We do | 6981 // Check that our large_image_size_ is greater than max texture size. We do |
7029 // this here to ensure that our otuput surface exists. | 6982 // this here to ensure that our otuput surface exists. |
7030 | 6983 |
7031 // Retrieve max texture size from Skia. | 6984 // Retrieve max texture size from Skia. |
7032 ContextProvider* context_provider = | 6985 ContextProvider* context_provider = |
(...skipping 17 matching lines...) Expand all Loading... |
7050 private: | 7003 private: |
7051 FakeContentLayerClient client_; | 7004 FakeContentLayerClient client_; |
7052 const gfx::Size viewport_size_; | 7005 const gfx::Size viewport_size_; |
7053 const gfx::Size large_image_size_; | 7006 const gfx::Size large_image_size_; |
7054 }; | 7007 }; |
7055 | 7008 |
7056 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage); | 7009 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage); |
7057 | 7010 |
7058 } // namespace | 7011 } // namespace |
7059 } // namespace cc | 7012 } // namespace cc |
OLD | NEW |