| 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()->SetRootLayer(root_layer); | 270 layer_tree_host()->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()->SetRootLayer(root_layer); | 341 layer_tree_host()->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()->SetRootLayer(root_layer); | 380 layer_tree_host()->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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 }; | 635 }; |
| 636 | 636 |
| 637 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit2); | 637 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit2); |
| 638 | 638 |
| 639 // Verify that we pass property values in PushPropertiesTo. | 639 // Verify that we pass property values in PushPropertiesTo. |
| 640 class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest { | 640 class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest { |
| 641 protected: | 641 protected: |
| 642 void SetupTree() override { | 642 void SetupTree() override { |
| 643 scoped_refptr<Layer> root = Layer::Create(); | 643 scoped_refptr<Layer> root = Layer::Create(); |
| 644 root->SetBounds(gfx::Size(10, 10)); | 644 root->SetBounds(gfx::Size(10, 10)); |
| 645 layer_tree()->SetRootLayer(root); | 645 layer_tree_host()->SetRootLayer(root); |
| 646 LayerTreeHostTest::SetupTree(); | 646 LayerTreeHostTest::SetupTree(); |
| 647 } | 647 } |
| 648 | 648 |
| 649 enum Properties { | 649 enum Properties { |
| 650 STARTUP, | 650 STARTUP, |
| 651 BOUNDS, | 651 BOUNDS, |
| 652 HIDE_LAYER_AND_SUBTREE, | 652 HIDE_LAYER_AND_SUBTREE, |
| 653 DRAWS_CONTENT, | 653 DRAWS_CONTENT, |
| 654 DONE, | 654 DONE, |
| 655 }; | 655 }; |
| 656 | 656 |
| 657 void BeginTest() override { | 657 void BeginTest() override { |
| 658 index_ = STARTUP; | 658 index_ = STARTUP; |
| 659 PostSetNeedsCommitToMainThread(); | 659 PostSetNeedsCommitToMainThread(); |
| 660 } | 660 } |
| 661 | 661 |
| 662 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 662 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
| 663 VerifyAfterValues(impl->active_tree()->root_layer_for_testing()); | 663 VerifyAfterValues(impl->active_tree()->root_layer_for_testing()); |
| 664 } | 664 } |
| 665 | 665 |
| 666 void DidCommitAndDrawFrame() override { | 666 void DidCommitAndDrawFrame() override { |
| 667 SetBeforeValues(layer_tree()->root_layer()); | 667 SetBeforeValues(layer_tree_host()->root_layer()); |
| 668 VerifyBeforeValues(layer_tree()->root_layer()); | 668 VerifyBeforeValues(layer_tree_host()->root_layer()); |
| 669 | 669 |
| 670 ++index_; | 670 ++index_; |
| 671 if (index_ == DONE) { | 671 if (index_ == DONE) { |
| 672 EndTest(); | 672 EndTest(); |
| 673 return; | 673 return; |
| 674 } | 674 } |
| 675 | 675 |
| 676 SetAfterValues(layer_tree()->root_layer()); | 676 SetAfterValues(layer_tree_host()->root_layer()); |
| 677 } | 677 } |
| 678 | 678 |
| 679 void AfterTest() override {} | 679 void AfterTest() override {} |
| 680 | 680 |
| 681 void VerifyBeforeValues(Layer* layer) { | 681 void VerifyBeforeValues(Layer* layer) { |
| 682 EXPECT_EQ(gfx::Size(10, 10).ToString(), layer->bounds().ToString()); | 682 EXPECT_EQ(gfx::Size(10, 10).ToString(), layer->bounds().ToString()); |
| 683 EXPECT_FALSE(layer->hide_layer_and_subtree()); | 683 EXPECT_FALSE(layer->hide_layer_and_subtree()); |
| 684 EXPECT_FALSE(layer->DrawsContent()); | 684 EXPECT_FALSE(layer->DrawsContent()); |
| 685 } | 685 } |
| 686 | 686 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 }; | 730 }; |
| 731 | 731 |
| 732 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); | 732 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); |
| 733 | 733 |
| 734 class LayerTreeHostTestPushNodeOwnerToNodeIdMap : public LayerTreeHostTest { | 734 class LayerTreeHostTestPushNodeOwnerToNodeIdMap : public LayerTreeHostTest { |
| 735 protected: | 735 protected: |
| 736 void SetupTree() override { | 736 void SetupTree() override { |
| 737 root_ = Layer::Create(); | 737 root_ = Layer::Create(); |
| 738 child_ = Layer::Create(); | 738 child_ = Layer::Create(); |
| 739 root_->AddChild(child_); | 739 root_->AddChild(child_); |
| 740 layer_tree()->SetRootLayer(root_); | 740 layer_tree_host()->SetRootLayer(root_); |
| 741 LayerTreeHostTest::SetupTree(); | 741 LayerTreeHostTest::SetupTree(); |
| 742 } | 742 } |
| 743 | 743 |
| 744 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 744 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 745 | 745 |
| 746 void DidCommit() override { | 746 void DidCommit() override { |
| 747 switch (layer_tree_host()->source_frame_number()) { | 747 switch (layer_tree_host()->source_frame_number()) { |
| 748 case 1: | 748 case 1: |
| 749 // child_ should create transform, effect, clip node. | 749 // child_ should create transform, effect, clip node. |
| 750 child_->SetForceRenderSurfaceForTesting(true); | 750 child_->SetForceRenderSurfaceForTesting(true); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 scoped_refptr<Layer> root_; | 850 scoped_refptr<Layer> root_; |
| 851 scoped_refptr<Layer> child_; | 851 scoped_refptr<Layer> child_; |
| 852 }; | 852 }; |
| 853 | 853 |
| 854 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushNodeOwnerToNodeIdMap); | 854 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushNodeOwnerToNodeIdMap); |
| 855 | 855 |
| 856 class LayerTreeHostTestDamageWithReplica : public LayerTreeHostTest { | 856 class LayerTreeHostTestDamageWithReplica : public LayerTreeHostTest { |
| 857 protected: | 857 protected: |
| 858 void SetupTree() override { | 858 void SetupTree() override { |
| 859 scoped_refptr<Layer> root = Layer::Create(); | 859 scoped_refptr<Layer> root = Layer::Create(); |
| 860 layer_tree()->SetRootLayer(root); | 860 layer_tree_host()->SetRootLayer(root); |
| 861 LayerTreeHostTest::SetupTree(); | 861 LayerTreeHostTest::SetupTree(); |
| 862 } | 862 } |
| 863 | 863 |
| 864 void BeginTest() override { | 864 void BeginTest() override { |
| 865 index_ = 0; | 865 index_ = 0; |
| 866 PostSetNeedsCommitToMainThread(); | 866 PostSetNeedsCommitToMainThread(); |
| 867 } | 867 } |
| 868 | 868 |
| 869 void DidCommit() override { | 869 void DidCommit() override { |
| 870 switch (layer_tree_host()->source_frame_number()) { | 870 switch (layer_tree_host()->source_frame_number()) { |
| 871 case 0: | 871 case 0: |
| 872 break; | 872 break; |
| 873 case 1: | 873 case 1: |
| 874 scoped_refptr<Layer> replica_layer = Layer::Create(); | 874 scoped_refptr<Layer> replica_layer = Layer::Create(); |
| 875 layer_tree()->root_layer()->SetReplicaLayer(replica_layer.get()); | 875 layer_tree_host()->root_layer()->SetReplicaLayer(replica_layer.get()); |
| 876 break; | 876 break; |
| 877 } | 877 } |
| 878 } | 878 } |
| 879 | 879 |
| 880 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 880 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
| 881 switch (index_) { | 881 switch (index_) { |
| 882 case 0: | 882 case 0: |
| 883 impl->sync_tree()->ResetAllChangeTracking(); | 883 impl->sync_tree()->ResetAllChangeTracking(); |
| 884 EXPECT_FALSE(impl->sync_tree() | 884 EXPECT_FALSE(impl->sync_tree() |
| 885 ->root_layer_for_testing() | 885 ->root_layer_for_testing() |
| (...skipping 19 matching lines...) Expand all Loading... |
| 905 | 905 |
| 906 // Verify damage status of property trees is preserved after commit. | 906 // Verify damage status of property trees is preserved after commit. |
| 907 class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest { | 907 class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest { |
| 908 protected: | 908 protected: |
| 909 void SetupTree() override { | 909 void SetupTree() override { |
| 910 root_ = Layer::Create(); | 910 root_ = Layer::Create(); |
| 911 child_ = Layer::Create(); | 911 child_ = Layer::Create(); |
| 912 // This is to force the child to create a transform and effect node. | 912 // This is to force the child to create a transform and effect node. |
| 913 child_->SetForceRenderSurfaceForTesting(true); | 913 child_->SetForceRenderSurfaceForTesting(true); |
| 914 root_->AddChild(child_); | 914 root_->AddChild(child_); |
| 915 layer_tree()->SetRootLayer(root_); | 915 layer_tree_host()->SetRootLayer(root_); |
| 916 LayerTreeHostTest::SetupTree(); | 916 LayerTreeHostTest::SetupTree(); |
| 917 } | 917 } |
| 918 | 918 |
| 919 enum Animations { | 919 enum Animations { |
| 920 OPACITY, | 920 OPACITY, |
| 921 TRANSFORM, | 921 TRANSFORM, |
| 922 FILTER, | 922 FILTER, |
| 923 END, | 923 END, |
| 924 }; | 924 }; |
| 925 | 925 |
| 926 void BeginTest() override { | 926 void BeginTest() override { |
| 927 index_ = OPACITY; | 927 index_ = OPACITY; |
| 928 PostSetNeedsCommitToMainThread(); | 928 PostSetNeedsCommitToMainThread(); |
| 929 } | 929 } |
| 930 | 930 |
| 931 void DidCommit() override { | 931 void DidCommit() override { |
| 932 switch (layer_tree_host()->source_frame_number()) { | 932 switch (layer_tree_host()->source_frame_number()) { |
| 933 case 2: | 933 case 2: |
| 934 // We rebuild property trees for this case to test the code path of | 934 // We rebuild property trees for this case to test the code path of |
| 935 // damage status synchronization when property trees are different. | 935 // damage status synchronization when property trees are different. |
| 936 layer_tree()->property_trees()->needs_rebuild = true; | 936 layer_tree_host()->property_trees()->needs_rebuild = true; |
| 937 break; | 937 break; |
| 938 default: | 938 default: |
| 939 EXPECT_FALSE(layer_tree()->property_trees()->needs_rebuild); | 939 EXPECT_FALSE(layer_tree_host()->property_trees()->needs_rebuild); |
| 940 } | 940 } |
| 941 } | 941 } |
| 942 | 942 |
| 943 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 943 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
| 944 gfx::Transform transform; | 944 gfx::Transform transform; |
| 945 FilterOperations filters; | 945 FilterOperations filters; |
| 946 switch (static_cast<Animations>(index_)) { | 946 switch (static_cast<Animations>(index_)) { |
| 947 case OPACITY: | 947 case OPACITY: |
| 948 index_++; | 948 index_++; |
| 949 impl->active_tree()->ResetAllChangeTracking(); | 949 impl->active_tree()->ResetAllChangeTracking(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 scoped_refptr<Layer> root_; | 1003 scoped_refptr<Layer> root_; |
| 1004 scoped_refptr<Layer> child_; | 1004 scoped_refptr<Layer> child_; |
| 1005 }; | 1005 }; |
| 1006 | 1006 |
| 1007 SINGLE_THREAD_TEST_F(LayerTreeHostTestPropertyTreesChangedSync); | 1007 SINGLE_THREAD_TEST_F(LayerTreeHostTestPropertyTreesChangedSync); |
| 1008 | 1008 |
| 1009 class LayerTreeHostTestEffectTreeSync : public LayerTreeHostTest { | 1009 class LayerTreeHostTestEffectTreeSync : public LayerTreeHostTest { |
| 1010 protected: | 1010 protected: |
| 1011 void SetupTree() override { | 1011 void SetupTree() override { |
| 1012 root_ = Layer::Create(); | 1012 root_ = Layer::Create(); |
| 1013 layer_tree()->SetRootLayer(root_); | 1013 layer_tree_host()->SetRootLayer(root_); |
| 1014 blur_filter_.Append(FilterOperation::CreateBlurFilter(0.5f)); | 1014 blur_filter_.Append(FilterOperation::CreateBlurFilter(0.5f)); |
| 1015 brightness_filter_.Append(FilterOperation::CreateBrightnessFilter(0.25f)); | 1015 brightness_filter_.Append(FilterOperation::CreateBrightnessFilter(0.25f)); |
| 1016 sepia_filter_.Append(FilterOperation::CreateSepiaFilter(0.75f)); | 1016 sepia_filter_.Append(FilterOperation::CreateSepiaFilter(0.75f)); |
| 1017 LayerTreeHostTest::SetupTree(); | 1017 LayerTreeHostTest::SetupTree(); |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1020 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1021 | 1021 |
| 1022 void DidCommit() override { | 1022 void DidCommit() override { |
| 1023 EffectTree& effect_tree = layer_tree()->property_trees()->effect_tree; | 1023 EffectTree& effect_tree = layer_tree_host()->property_trees()->effect_tree; |
| 1024 EffectNode* node = effect_tree.Node(root_->effect_tree_index()); | 1024 EffectNode* node = effect_tree.Node(root_->effect_tree_index()); |
| 1025 switch (layer_tree_host()->source_frame_number()) { | 1025 switch (layer_tree_host()->source_frame_number()) { |
| 1026 case 1: | 1026 case 1: |
| 1027 node->opacity = 0.5f; | 1027 node->opacity = 0.5f; |
| 1028 node->is_currently_animating_opacity = true; | 1028 node->is_currently_animating_opacity = true; |
| 1029 break; | 1029 break; |
| 1030 case 2: | 1030 case 2: |
| 1031 node->is_currently_animating_opacity = true; | 1031 node->is_currently_animating_opacity = true; |
| 1032 break; | 1032 break; |
| 1033 case 3: | 1033 case 3: |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 FilterOperations brightness_filter_; | 1111 FilterOperations brightness_filter_; |
| 1112 FilterOperations sepia_filter_; | 1112 FilterOperations sepia_filter_; |
| 1113 }; | 1113 }; |
| 1114 | 1114 |
| 1115 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestEffectTreeSync); | 1115 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestEffectTreeSync); |
| 1116 | 1116 |
| 1117 class LayerTreeHostTestTransformTreeSync : public LayerTreeHostTest { | 1117 class LayerTreeHostTestTransformTreeSync : public LayerTreeHostTest { |
| 1118 protected: | 1118 protected: |
| 1119 void SetupTree() override { | 1119 void SetupTree() override { |
| 1120 root_ = Layer::Create(); | 1120 root_ = Layer::Create(); |
| 1121 layer_tree()->SetRootLayer(root_); | 1121 layer_tree_host()->SetRootLayer(root_); |
| 1122 LayerTreeHostTest::SetupTree(); | 1122 LayerTreeHostTest::SetupTree(); |
| 1123 } | 1123 } |
| 1124 | 1124 |
| 1125 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1125 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1126 | 1126 |
| 1127 void DidCommit() override { | 1127 void DidCommit() override { |
| 1128 TransformTree& transform_tree = | 1128 TransformTree& transform_tree = |
| 1129 layer_tree()->property_trees()->transform_tree; | 1129 layer_tree_host()->property_trees()->transform_tree; |
| 1130 TransformNode* node = transform_tree.Node(root_->transform_tree_index()); | 1130 TransformNode* node = transform_tree.Node(root_->transform_tree_index()); |
| 1131 gfx::Transform rotate10; | 1131 gfx::Transform rotate10; |
| 1132 rotate10.Rotate(10.f); | 1132 rotate10.Rotate(10.f); |
| 1133 switch (layer_tree_host()->source_frame_number()) { | 1133 switch (layer_tree_host()->source_frame_number()) { |
| 1134 case 1: | 1134 case 1: |
| 1135 node->local = rotate10; | 1135 node->local = rotate10; |
| 1136 node->is_currently_animating = true; | 1136 node->is_currently_animating = true; |
| 1137 break; | 1137 break; |
| 1138 case 2: | 1138 case 2: |
| 1139 node->is_currently_animating = true; | 1139 node->is_currently_animating = true; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 root_->SetBounds(gfx::Size(50, 50)); | 1203 root_->SetBounds(gfx::Size(50, 50)); |
| 1204 | 1204 |
| 1205 // Make sure child and grand_child have transform nodes. | 1205 // Make sure child and grand_child have transform nodes. |
| 1206 gfx::Transform rotation; | 1206 gfx::Transform rotation; |
| 1207 rotation.RotateAboutZAxis(45.0); | 1207 rotation.RotateAboutZAxis(45.0); |
| 1208 child_->SetTransform(rotation); | 1208 child_->SetTransform(rotation); |
| 1209 grand_child_->SetTransform(rotation); | 1209 grand_child_->SetTransform(rotation); |
| 1210 | 1210 |
| 1211 root_->AddChild(child_); | 1211 root_->AddChild(child_); |
| 1212 child_->AddChild(grand_child_); | 1212 child_->AddChild(grand_child_); |
| 1213 layer_tree()->SetRootLayer(root_); | 1213 layer_tree_host()->SetRootLayer(root_); |
| 1214 LayerTreeHostTest::SetupTree(); | 1214 LayerTreeHostTest::SetupTree(); |
| 1215 } | 1215 } |
| 1216 | 1216 |
| 1217 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1217 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1218 | 1218 |
| 1219 void DidCommit() override { | 1219 void DidCommit() override { |
| 1220 if (layer_tree_host()->source_frame_number() == 1) { | 1220 if (layer_tree_host()->source_frame_number() == 1) { |
| 1221 gfx::Transform scale; | 1221 gfx::Transform scale; |
| 1222 scale.Scale(2.0, 2.0); | 1222 scale.Scale(2.0, 2.0); |
| 1223 LayerInternalsForTest(child_.get()).OnTransformAnimated(scale); | 1223 LayerInternalsForTest(child_.get()).OnTransformAnimated(scale); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 class LayerTreeHostTestSwitchMaskLayer : public LayerTreeHostTest { | 1270 class LayerTreeHostTestSwitchMaskLayer : public LayerTreeHostTest { |
| 1271 protected: | 1271 protected: |
| 1272 void SetupTree() override { | 1272 void SetupTree() override { |
| 1273 scoped_refptr<Layer> root = Layer::Create(); | 1273 scoped_refptr<Layer> root = Layer::Create(); |
| 1274 root->SetBounds(gfx::Size(10, 10)); | 1274 root->SetBounds(gfx::Size(10, 10)); |
| 1275 scoped_refptr<Layer> child = Layer::Create(); | 1275 scoped_refptr<Layer> child = Layer::Create(); |
| 1276 mask_layer = Layer::Create(); | 1276 mask_layer = Layer::Create(); |
| 1277 mask_layer->SetBounds(gfx::Size(10, 10)); | 1277 mask_layer->SetBounds(gfx::Size(10, 10)); |
| 1278 child->SetMaskLayer(mask_layer.get()); | 1278 child->SetMaskLayer(mask_layer.get()); |
| 1279 root->AddChild(std::move(child)); | 1279 root->AddChild(std::move(child)); |
| 1280 layer_tree()->SetRootLayer(root); | 1280 layer_tree_host()->SetRootLayer(root); |
| 1281 LayerTreeHostTest::SetupTree(); | 1281 LayerTreeHostTest::SetupTree(); |
| 1282 } | 1282 } |
| 1283 | 1283 |
| 1284 void BeginTest() override { | 1284 void BeginTest() override { |
| 1285 index_ = 0; | 1285 index_ = 0; |
| 1286 PostSetNeedsCommitToMainThread(); | 1286 PostSetNeedsCommitToMainThread(); |
| 1287 } | 1287 } |
| 1288 | 1288 |
| 1289 void DidCommit() override { | 1289 void DidCommit() override { |
| 1290 switch (layer_tree_host()->source_frame_number()) { | 1290 switch (layer_tree_host()->source_frame_number()) { |
| 1291 case 1: | 1291 case 1: |
| 1292 // Root and mask layer should have the same source frame number as they | 1292 // Root and mask layer should have the same source frame number as they |
| 1293 // will be in the layer update list but the child is not as it has empty | 1293 // will be in the layer update list but the child is not as it has empty |
| 1294 // bounds. | 1294 // bounds. |
| 1295 EXPECT_EQ( | 1295 EXPECT_EQ(mask_layer->paint_properties().source_frame_number, |
| 1296 mask_layer->paint_properties().source_frame_number, | 1296 layer_tree_host() |
| 1297 layer_tree()->root_layer()->paint_properties().source_frame_number); | 1297 ->root_layer() |
| 1298 ->paint_properties() |
| 1299 .source_frame_number); |
| 1298 EXPECT_NE(mask_layer->paint_properties().source_frame_number, | 1300 EXPECT_NE(mask_layer->paint_properties().source_frame_number, |
| 1299 layer_tree() | 1301 layer_tree_host() |
| 1300 ->root_layer() | 1302 ->root_layer() |
| 1301 ->child_at(0) | 1303 ->child_at(0) |
| 1302 ->paint_properties() | 1304 ->paint_properties() |
| 1303 .source_frame_number); | 1305 .source_frame_number); |
| 1304 layer_tree()->root_layer()->RemoveAllChildren(); | 1306 layer_tree_host()->root_layer()->RemoveAllChildren(); |
| 1305 layer_tree()->root_layer()->SetMaskLayer(mask_layer.get()); | 1307 layer_tree_host()->root_layer()->SetMaskLayer(mask_layer.get()); |
| 1306 break; | 1308 break; |
| 1307 } | 1309 } |
| 1308 } | 1310 } |
| 1309 | 1311 |
| 1310 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 1312 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
| 1311 switch (index_) { | 1313 switch (index_) { |
| 1312 case 0: | 1314 case 0: |
| 1313 index_++; | 1315 index_++; |
| 1314 EXPECT_FALSE(impl->sync_tree() | 1316 EXPECT_FALSE(impl->sync_tree() |
| 1315 ->root_layer_for_testing() | 1317 ->root_layer_for_testing() |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1374 // must contain invalid_rect. | 1376 // must contain invalid_rect. |
| 1375 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { | 1377 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { |
| 1376 public: | 1378 public: |
| 1377 LayerTreeHostTestSetNeedsRedrawRect() | 1379 LayerTreeHostTestSetNeedsRedrawRect() |
| 1378 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} | 1380 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} |
| 1379 | 1381 |
| 1380 void BeginTest() override { | 1382 void BeginTest() override { |
| 1381 root_layer_ = FakePictureLayer::Create(&client_); | 1383 root_layer_ = FakePictureLayer::Create(&client_); |
| 1382 root_layer_->SetIsDrawable(true); | 1384 root_layer_->SetIsDrawable(true); |
| 1383 root_layer_->SetBounds(bounds_); | 1385 root_layer_->SetBounds(bounds_); |
| 1384 layer_tree()->SetRootLayer(root_layer_); | 1386 layer_tree_host()->SetRootLayer(root_layer_); |
| 1385 layer_tree()->SetViewportSize(bounds_); | 1387 layer_tree_host()->SetViewportSize(bounds_); |
| 1386 PostSetNeedsCommitToMainThread(); | 1388 PostSetNeedsCommitToMainThread(); |
| 1387 client_.set_bounds(root_layer_->bounds()); | 1389 client_.set_bounds(root_layer_->bounds()); |
| 1388 } | 1390 } |
| 1389 | 1391 |
| 1390 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 1392 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 1391 LayerTreeHostImpl::FrameData* frame_data, | 1393 LayerTreeHostImpl::FrameData* frame_data, |
| 1392 DrawResult draw_result) override { | 1394 DrawResult draw_result) override { |
| 1393 EXPECT_EQ(DRAW_SUCCESS, draw_result); | 1395 EXPECT_EQ(DRAW_SUCCESS, draw_result); |
| 1394 | 1396 |
| 1395 gfx::Rect root_damage_rect; | 1397 gfx::Rect root_damage_rect; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1438 void BeginTest() override { | 1440 void BeginTest() override { |
| 1439 client_.set_fill_with_nonsolid_color(true); | 1441 client_.set_fill_with_nonsolid_color(true); |
| 1440 root_layer_ = FakePictureLayer::Create(&client_); | 1442 root_layer_ = FakePictureLayer::Create(&client_); |
| 1441 root_layer_->SetIsDrawable(true); | 1443 root_layer_->SetIsDrawable(true); |
| 1442 gfx::Transform transform; | 1444 gfx::Transform transform; |
| 1443 // Translate the layer out of the viewport to force it to not update its | 1445 // Translate the layer out of the viewport to force it to not update its |
| 1444 // tile size via PushProperties. | 1446 // tile size via PushProperties. |
| 1445 transform.Translate(10000.0, 10000.0); | 1447 transform.Translate(10000.0, 10000.0); |
| 1446 root_layer_->SetTransform(transform); | 1448 root_layer_->SetTransform(transform); |
| 1447 root_layer_->SetBounds(bounds_); | 1449 root_layer_->SetBounds(bounds_); |
| 1448 layer_tree()->SetRootLayer(root_layer_); | 1450 layer_tree_host()->SetRootLayer(root_layer_); |
| 1449 layer_tree()->SetViewportSize(bounds_); | 1451 layer_tree_host()->SetViewportSize(bounds_); |
| 1450 | 1452 |
| 1451 PostSetNeedsCommitToMainThread(); | 1453 PostSetNeedsCommitToMainThread(); |
| 1452 client_.set_bounds(root_layer_->bounds()); | 1454 client_.set_bounds(root_layer_->bounds()); |
| 1453 } | 1455 } |
| 1454 | 1456 |
| 1455 void InitializeSettings(LayerTreeSettings* settings) override { | 1457 void InitializeSettings(LayerTreeSettings* settings) override { |
| 1456 settings->gpu_rasterization_enabled = true; | 1458 settings->gpu_rasterization_enabled = true; |
| 1457 settings->gpu_rasterization_forced = true; | 1459 settings->gpu_rasterization_forced = true; |
| 1458 } | 1460 } |
| 1459 | 1461 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1483 EXPECT_EQ( | 1485 EXPECT_EQ( |
| 1484 pending_tiling->TilingDataForTesting().max_texture_size().width(), | 1486 pending_tiling->TilingDataForTesting().max_texture_size().width(), |
| 1485 active_tiling->TilingDataForTesting().max_texture_size().width()); | 1487 active_tiling->TilingDataForTesting().max_texture_size().width()); |
| 1486 EndTest(); | 1488 EndTest(); |
| 1487 } | 1489 } |
| 1488 } | 1490 } |
| 1489 | 1491 |
| 1490 void DidCommitAndDrawFrame() override { | 1492 void DidCommitAndDrawFrame() override { |
| 1491 // On the second commit, resize the viewport. | 1493 // On the second commit, resize the viewport. |
| 1492 if (num_draws_ == 1) { | 1494 if (num_draws_ == 1) { |
| 1493 layer_tree()->SetViewportSize(gfx::Size(400, 64)); | 1495 layer_tree_host()->SetViewportSize(gfx::Size(400, 64)); |
| 1494 } | 1496 } |
| 1495 } | 1497 } |
| 1496 | 1498 |
| 1497 void AfterTest() override {} | 1499 void AfterTest() override {} |
| 1498 | 1500 |
| 1499 private: | 1501 private: |
| 1500 int num_draws_; | 1502 int num_draws_; |
| 1501 const gfx::Size bounds_; | 1503 const gfx::Size bounds_; |
| 1502 const gfx::Rect invalid_rect_; | 1504 const gfx::Rect invalid_rect_; |
| 1503 FakeContentLayerClient client_; | 1505 FakeContentLayerClient client_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1516 } | 1518 } |
| 1517 | 1519 |
| 1518 void SetupTree() override { | 1520 void SetupTree() override { |
| 1519 root_layer_ = Layer::Create(); | 1521 root_layer_ = Layer::Create(); |
| 1520 root_layer_->SetBounds(gfx::Size(10, 20)); | 1522 root_layer_->SetBounds(gfx::Size(10, 20)); |
| 1521 | 1523 |
| 1522 scaled_layer_ = FakePictureLayer::Create(&client_); | 1524 scaled_layer_ = FakePictureLayer::Create(&client_); |
| 1523 scaled_layer_->SetBounds(gfx::Size(1, 1)); | 1525 scaled_layer_->SetBounds(gfx::Size(1, 1)); |
| 1524 root_layer_->AddChild(scaled_layer_); | 1526 root_layer_->AddChild(scaled_layer_); |
| 1525 | 1527 |
| 1526 layer_tree()->SetRootLayer(root_layer_); | 1528 layer_tree_host()->SetRootLayer(root_layer_); |
| 1527 LayerTreeHostTest::SetupTree(); | 1529 LayerTreeHostTest::SetupTree(); |
| 1528 client_.set_bounds(root_layer_->bounds()); | 1530 client_.set_bounds(root_layer_->bounds()); |
| 1529 } | 1531 } |
| 1530 | 1532 |
| 1531 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1533 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1532 | 1534 |
| 1533 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 1535 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
| 1534 if (host_impl->active_tree()->source_frame_number() == 1) | 1536 if (host_impl->active_tree()->source_frame_number() == 1) |
| 1535 EndTest(); | 1537 EndTest(); |
| 1536 } | 1538 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1572 | 1574 |
| 1573 bool paint_scrollbar = true; | 1575 bool paint_scrollbar = true; |
| 1574 bool has_thumb = false; | 1576 bool has_thumb = false; |
| 1575 scrollbar_ = FakePaintedScrollbarLayer::Create(paint_scrollbar, has_thumb, | 1577 scrollbar_ = FakePaintedScrollbarLayer::Create(paint_scrollbar, has_thumb, |
| 1576 root_layer_->id()); | 1578 root_layer_->id()); |
| 1577 scrollbar_->SetPosition(gfx::PointF(0.f, 10.f)); | 1579 scrollbar_->SetPosition(gfx::PointF(0.f, 10.f)); |
| 1578 scrollbar_->SetBounds(gfx::Size(10, 10)); | 1580 scrollbar_->SetBounds(gfx::Size(10, 10)); |
| 1579 | 1581 |
| 1580 root_layer_->AddChild(scrollbar_); | 1582 root_layer_->AddChild(scrollbar_); |
| 1581 | 1583 |
| 1582 layer_tree()->SetRootLayer(root_layer_); | 1584 layer_tree_host()->SetRootLayer(root_layer_); |
| 1583 LayerTreeHostTest::SetupTree(); | 1585 LayerTreeHostTest::SetupTree(); |
| 1584 client_.set_bounds(root_layer_->bounds()); | 1586 client_.set_bounds(root_layer_->bounds()); |
| 1585 } | 1587 } |
| 1586 | 1588 |
| 1587 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1589 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1588 | 1590 |
| 1589 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 1591 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
| 1590 if (host_impl->active_tree()->source_frame_number() == 1) | 1592 if (host_impl->active_tree()->source_frame_number() == 1) |
| 1591 EndTest(); | 1593 EndTest(); |
| 1592 } | 1594 } |
| 1593 | 1595 |
| 1594 void DidCommit() override { | 1596 void DidCommit() override { |
| 1595 switch (layer_tree_host()->source_frame_number()) { | 1597 switch (layer_tree_host()->source_frame_number()) { |
| 1596 case 1: | 1598 case 1: |
| 1597 // Changing the device scale factor causes a commit. It also changes | 1599 // Changing the device scale factor causes a commit. It also changes |
| 1598 // the content bounds of |scrollbar_|, which should not generate | 1600 // the content bounds of |scrollbar_|, which should not generate |
| 1599 // a second commit as a result. | 1601 // a second commit as a result. |
| 1600 layer_tree()->SetDeviceScaleFactor(4.f); | 1602 layer_tree_host()->SetDeviceScaleFactor(4.f); |
| 1601 break; | 1603 break; |
| 1602 default: | 1604 default: |
| 1603 // No extra commits. | 1605 // No extra commits. |
| 1604 EXPECT_EQ(2, layer_tree_host()->source_frame_number()); | 1606 EXPECT_EQ(2, layer_tree_host()->source_frame_number()); |
| 1605 break; | 1607 break; |
| 1606 } | 1608 } |
| 1607 } | 1609 } |
| 1608 | 1610 |
| 1609 void AfterTest() override {} | 1611 void AfterTest() override {} |
| 1610 | 1612 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1624 } | 1626 } |
| 1625 | 1627 |
| 1626 void SetupTree() override { | 1628 void SetupTree() override { |
| 1627 root_layer_ = Layer::Create(); | 1629 root_layer_ = Layer::Create(); |
| 1628 root_layer_->SetBounds(gfx::Size(10, 20)); | 1630 root_layer_->SetBounds(gfx::Size(10, 20)); |
| 1629 | 1631 |
| 1630 child_layer_ = FakePictureLayer::Create(&client_); | 1632 child_layer_ = FakePictureLayer::Create(&client_); |
| 1631 child_layer_->SetBounds(gfx::Size(10, 10)); | 1633 child_layer_->SetBounds(gfx::Size(10, 10)); |
| 1632 root_layer_->AddChild(child_layer_); | 1634 root_layer_->AddChild(child_layer_); |
| 1633 | 1635 |
| 1634 layer_tree()->SetRootLayer(root_layer_); | 1636 layer_tree_host()->SetRootLayer(root_layer_); |
| 1635 LayerTreeHostTest::SetupTree(); | 1637 LayerTreeHostTest::SetupTree(); |
| 1636 client_.set_bounds(root_layer_->bounds()); | 1638 client_.set_bounds(root_layer_->bounds()); |
| 1637 } | 1639 } |
| 1638 | 1640 |
| 1639 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1641 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1640 | 1642 |
| 1641 void DidCommit() override { | 1643 void DidCommit() override { |
| 1642 if (layer_tree_host()->source_frame_number() == 1) | 1644 if (layer_tree_host()->source_frame_number() == 1) |
| 1643 layer_tree()->SetDeviceScaleFactor(4.f); | 1645 layer_tree_host()->SetDeviceScaleFactor(4.f); |
| 1644 } | 1646 } |
| 1645 | 1647 |
| 1646 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 1648 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
| 1647 if (host_impl->sync_tree()->source_frame_number() == 1) { | 1649 if (host_impl->sync_tree()->source_frame_number() == 1) { |
| 1648 EXPECT_EQ(4.f, host_impl->sync_tree()->device_scale_factor()); | 1650 EXPECT_EQ(4.f, host_impl->sync_tree()->device_scale_factor()); |
| 1649 if (host_impl->pending_tree()) { | 1651 if (host_impl->pending_tree()) { |
| 1650 // The active tree's device scale factor shouldn't change until | 1652 // The active tree's device scale factor shouldn't change until |
| 1651 // activation. | 1653 // activation. |
| 1652 EXPECT_EQ(1.f, host_impl->active_tree()->device_scale_factor()); | 1654 EXPECT_EQ(1.f, host_impl->active_tree()->device_scale_factor()); |
| 1653 } | 1655 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1685 | 1687 |
| 1686 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { | 1688 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { |
| 1687 public: | 1689 public: |
| 1688 LayerTreeHostTestSetNextCommitForcesRedraw() | 1690 LayerTreeHostTestSetNextCommitForcesRedraw() |
| 1689 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} | 1691 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} |
| 1690 | 1692 |
| 1691 void BeginTest() override { | 1693 void BeginTest() override { |
| 1692 root_layer_ = FakePictureLayer::Create(&client_); | 1694 root_layer_ = FakePictureLayer::Create(&client_); |
| 1693 root_layer_->SetIsDrawable(true); | 1695 root_layer_->SetIsDrawable(true); |
| 1694 root_layer_->SetBounds(bounds_); | 1696 root_layer_->SetBounds(bounds_); |
| 1695 layer_tree()->SetRootLayer(root_layer_); | 1697 layer_tree_host()->SetRootLayer(root_layer_); |
| 1696 layer_tree()->SetViewportSize(bounds_); | 1698 layer_tree_host()->SetViewportSize(bounds_); |
| 1697 PostSetNeedsCommitToMainThread(); | 1699 PostSetNeedsCommitToMainThread(); |
| 1698 client_.set_bounds(root_layer_->bounds()); | 1700 client_.set_bounds(root_layer_->bounds()); |
| 1699 } | 1701 } |
| 1700 | 1702 |
| 1701 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 1703 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
| 1702 if (num_draws_ == 3) | 1704 if (num_draws_ == 3) |
| 1703 host_impl->SetNeedsRedrawRect(invalid_rect_); | 1705 host_impl->SetNeedsRedrawRect(invalid_rect_); |
| 1704 } | 1706 } |
| 1705 | 1707 |
| 1706 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 1708 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1778 // If we don't set the minimum contents scale, it's harder to verify whether | 1780 // If we don't set the minimum contents scale, it's harder to verify whether |
| 1779 // the damage we get is correct. For other scale amounts, please see | 1781 // the damage we get is correct. For other scale amounts, please see |
| 1780 // LayerTreeHostTestDamageWithScale. | 1782 // LayerTreeHostTestDamageWithScale. |
| 1781 settings->minimum_contents_scale = 1.f; | 1783 settings->minimum_contents_scale = 1.f; |
| 1782 } | 1784 } |
| 1783 | 1785 |
| 1784 void SetupTree() override { | 1786 void SetupTree() override { |
| 1785 root_layer_ = FakePictureLayer::Create(&client_); | 1787 root_layer_ = FakePictureLayer::Create(&client_); |
| 1786 root_layer_->SetIsDrawable(true); | 1788 root_layer_->SetIsDrawable(true); |
| 1787 root_layer_->SetBounds(gfx::Size(50, 50)); | 1789 root_layer_->SetBounds(gfx::Size(50, 50)); |
| 1788 layer_tree()->SetRootLayer(root_layer_); | 1790 layer_tree_host()->SetRootLayer(root_layer_); |
| 1789 | 1791 |
| 1790 // The initially transparent layer has a larger child layer, which is | 1792 // The initially transparent layer has a larger child layer, which is |
| 1791 // not initially drawn because of the this (parent) layer. | 1793 // not initially drawn because of the this (parent) layer. |
| 1792 parent_layer_ = FakePictureLayer::Create(&client_); | 1794 parent_layer_ = FakePictureLayer::Create(&client_); |
| 1793 parent_layer_->SetBounds(gfx::Size(15, 15)); | 1795 parent_layer_->SetBounds(gfx::Size(15, 15)); |
| 1794 parent_layer_->SetOpacity(0.0f); | 1796 parent_layer_->SetOpacity(0.0f); |
| 1795 root_layer_->AddChild(parent_layer_); | 1797 root_layer_->AddChild(parent_layer_); |
| 1796 | 1798 |
| 1797 child_layer_ = FakePictureLayer::Create(&client_); | 1799 child_layer_ = FakePictureLayer::Create(&client_); |
| 1798 child_layer_->SetBounds(gfx::Size(25, 25)); | 1800 child_layer_->SetBounds(gfx::Size(25, 25)); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1882 root_layer_->SetBounds(gfx::Size(50, 50)); | 1884 root_layer_->SetBounds(gfx::Size(50, 50)); |
| 1883 | 1885 |
| 1884 recording.reset(new FakeRecordingSource); | 1886 recording.reset(new FakeRecordingSource); |
| 1885 child_layer_ = FakePictureLayer::CreateWithRecordingSource( | 1887 child_layer_ = FakePictureLayer::CreateWithRecordingSource( |
| 1886 &client_, std::move(recording)); | 1888 &client_, std::move(recording)); |
| 1887 child_layer_->SetBounds(gfx::Size(25, 25)); | 1889 child_layer_->SetBounds(gfx::Size(25, 25)); |
| 1888 child_layer_->SetIsDrawable(true); | 1890 child_layer_->SetIsDrawable(true); |
| 1889 child_layer_->SetContentsOpaque(true); | 1891 child_layer_->SetContentsOpaque(true); |
| 1890 root_layer_->AddChild(child_layer_); | 1892 root_layer_->AddChild(child_layer_); |
| 1891 | 1893 |
| 1892 layer_tree()->SetRootLayer(root_layer_); | 1894 layer_tree_host()->SetRootLayer(root_layer_); |
| 1893 LayerTreeHostTest::SetupTree(); | 1895 LayerTreeHostTest::SetupTree(); |
| 1894 client_.set_bounds(root_layer_->bounds()); | 1896 client_.set_bounds(root_layer_->bounds()); |
| 1895 } | 1897 } |
| 1896 | 1898 |
| 1897 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 1899 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
| 1898 // Force the layer to have a tiling at 1.3f scale. Note that if we simply | 1900 // Force the layer to have a tiling at 1.3f scale. Note that if we simply |
| 1899 // add tiling, it will be gone by the time we draw because of aggressive | 1901 // add tiling, it will be gone by the time we draw because of aggressive |
| 1900 // cleanup. AddTilingUntilNextDraw ensures that it remains there during | 1902 // cleanup. AddTilingUntilNextDraw ensures that it remains there during |
| 1901 // damage calculation. | 1903 // damage calculation. |
| 1902 FakePictureLayerImpl* child_layer_impl = static_cast<FakePictureLayerImpl*>( | 1904 FakePictureLayerImpl* child_layer_impl = static_cast<FakePictureLayerImpl*>( |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1972 | 1974 |
| 1973 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDamageWithScale); | 1975 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDamageWithScale); |
| 1974 | 1976 |
| 1975 // This test verifies that properties on the layer tree host are commited | 1977 // This test verifies that properties on the layer tree host are commited |
| 1976 // to the impl side. | 1978 // to the impl side. |
| 1977 class LayerTreeHostTestCommit : public LayerTreeHostTest { | 1979 class LayerTreeHostTestCommit : public LayerTreeHostTest { |
| 1978 public: | 1980 public: |
| 1979 LayerTreeHostTestCommit() {} | 1981 LayerTreeHostTestCommit() {} |
| 1980 | 1982 |
| 1981 void BeginTest() override { | 1983 void BeginTest() override { |
| 1982 layer_tree()->SetViewportSize(gfx::Size(20, 20)); | 1984 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); |
| 1983 layer_tree()->set_background_color(SK_ColorGRAY); | 1985 layer_tree_host()->set_background_color(SK_ColorGRAY); |
| 1984 layer_tree()->SetEventListenerProperties(EventListenerClass::kMouseWheel, | 1986 layer_tree_host()->SetEventListenerProperties( |
| 1985 EventListenerProperties::kPassive); | 1987 EventListenerClass::kMouseWheel, EventListenerProperties::kPassive); |
| 1986 layer_tree()->SetEventListenerProperties( | 1988 layer_tree_host()->SetEventListenerProperties( |
| 1987 EventListenerClass::kTouchStartOrMove, | 1989 EventListenerClass::kTouchStartOrMove, |
| 1988 EventListenerProperties::kBlocking); | 1990 EventListenerProperties::kBlocking); |
| 1989 layer_tree()->SetEventListenerProperties( | 1991 layer_tree_host()->SetEventListenerProperties( |
| 1990 EventListenerClass::kTouchEndOrCancel, | 1992 EventListenerClass::kTouchEndOrCancel, |
| 1991 EventListenerProperties::kBlockingAndPassive); | 1993 EventListenerProperties::kBlockingAndPassive); |
| 1992 layer_tree()->SetHaveScrollEventHandlers(true); | 1994 layer_tree_host()->SetHaveScrollEventHandlers(true); |
| 1993 | 1995 |
| 1994 PostSetNeedsCommitToMainThread(); | 1996 PostSetNeedsCommitToMainThread(); |
| 1995 } | 1997 } |
| 1996 | 1998 |
| 1997 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 1999 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
| 1998 EXPECT_EQ(gfx::Size(20, 20), impl->DrawViewportSize()); | 2000 EXPECT_EQ(gfx::Size(20, 20), impl->DrawViewportSize()); |
| 1999 EXPECT_EQ(SK_ColorGRAY, impl->active_tree()->background_color()); | 2001 EXPECT_EQ(SK_ColorGRAY, impl->active_tree()->background_color()); |
| 2000 EXPECT_EQ(EventListenerProperties::kPassive, | 2002 EXPECT_EQ(EventListenerProperties::kPassive, |
| 2001 impl->active_tree()->event_listener_properties( | 2003 impl->active_tree()->event_listener_properties( |
| 2002 EventListenerClass::kMouseWheel)); | 2004 EventListenerClass::kMouseWheel)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2019 // This test verifies that LayerTreeHostImpl's current frame time gets | 2021 // This test verifies that LayerTreeHostImpl's current frame time gets |
| 2020 // updated in consecutive frames when it doesn't draw due to tree | 2022 // updated in consecutive frames when it doesn't draw due to tree |
| 2021 // activation failure. | 2023 // activation failure. |
| 2022 class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails | 2024 class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails |
| 2023 : public LayerTreeHostTest { | 2025 : public LayerTreeHostTest { |
| 2024 public: | 2026 public: |
| 2025 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails() | 2027 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails() |
| 2026 : frame_count_with_pending_tree_(0) {} | 2028 : frame_count_with_pending_tree_(0) {} |
| 2027 | 2029 |
| 2028 void BeginTest() override { | 2030 void BeginTest() override { |
| 2029 layer_tree()->SetViewportSize(gfx::Size(20, 20)); | 2031 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); |
| 2030 layer_tree()->set_background_color(SK_ColorGRAY); | 2032 layer_tree_host()->set_background_color(SK_ColorGRAY); |
| 2031 | 2033 |
| 2032 PostSetNeedsCommitToMainThread(); | 2034 PostSetNeedsCommitToMainThread(); |
| 2033 } | 2035 } |
| 2034 | 2036 |
| 2035 void BeginCommitOnThread(LayerTreeHostImpl* impl) override { | 2037 void BeginCommitOnThread(LayerTreeHostImpl* impl) override { |
| 2036 EXPECT_EQ(frame_count_with_pending_tree_, 0); | 2038 EXPECT_EQ(frame_count_with_pending_tree_, 0); |
| 2037 impl->BlockNotifyReadyToActivateForTesting(true); | 2039 impl->BlockNotifyReadyToActivateForTesting(true); |
| 2038 } | 2040 } |
| 2039 | 2041 |
| 2040 void WillBeginImplFrameOnThread(LayerTreeHostImpl* impl, | 2042 void WillBeginImplFrameOnThread(LayerTreeHostImpl* impl, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2073 MULTI_THREAD_BLOCKNOTIFY_TEST_F( | 2075 MULTI_THREAD_BLOCKNOTIFY_TEST_F( |
| 2074 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); | 2076 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); |
| 2075 | 2077 |
| 2076 // This test verifies that LayerTreeHostImpl's current frame time gets | 2078 // This test verifies that LayerTreeHostImpl's current frame time gets |
| 2077 // updated in consecutive frames when it draws in each frame. | 2079 // updated in consecutive frames when it draws in each frame. |
| 2078 class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest { | 2080 class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest { |
| 2079 public: | 2081 public: |
| 2080 LayerTreeHostTestFrameTimeUpdatesAfterDraw() : frame_(0) {} | 2082 LayerTreeHostTestFrameTimeUpdatesAfterDraw() : frame_(0) {} |
| 2081 | 2083 |
| 2082 void BeginTest() override { | 2084 void BeginTest() override { |
| 2083 layer_tree()->SetViewportSize(gfx::Size(20, 20)); | 2085 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); |
| 2084 layer_tree()->set_background_color(SK_ColorGRAY); | 2086 layer_tree_host()->set_background_color(SK_ColorGRAY); |
| 2085 | 2087 |
| 2086 PostSetNeedsCommitToMainThread(); | 2088 PostSetNeedsCommitToMainThread(); |
| 2087 } | 2089 } |
| 2088 | 2090 |
| 2089 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 2091 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
| 2090 frame_++; | 2092 frame_++; |
| 2091 if (frame_ == 1) { | 2093 if (frame_ == 1) { |
| 2092 first_frame_time_ = impl->CurrentBeginFrameArgs().frame_time; | 2094 first_frame_time_ = impl->CurrentBeginFrameArgs().frame_time; |
| 2093 impl->SetNeedsRedraw(); | 2095 impl->SetNeedsRedraw(); |
| 2094 | 2096 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2124 | 2126 |
| 2125 // Verifies that StartPageScaleAnimation events propagate correctly | 2127 // Verifies that StartPageScaleAnimation events propagate correctly |
| 2126 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. | 2128 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. |
| 2127 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { | 2129 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { |
| 2128 public: | 2130 public: |
| 2129 LayerTreeHostTestStartPageScaleAnimation() {} | 2131 LayerTreeHostTestStartPageScaleAnimation() {} |
| 2130 | 2132 |
| 2131 void SetupTree() override { | 2133 void SetupTree() override { |
| 2132 LayerTreeHostTest::SetupTree(); | 2134 LayerTreeHostTest::SetupTree(); |
| 2133 | 2135 |
| 2134 Layer* root_layer = layer_tree()->root_layer(); | 2136 Layer* root_layer = layer_tree_host()->root_layer(); |
| 2135 | 2137 |
| 2136 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(&client_); | 2138 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(&client_); |
| 2137 layer->set_always_update_resources(true); | 2139 layer->set_always_update_resources(true); |
| 2138 scroll_layer_ = layer; | 2140 scroll_layer_ = layer; |
| 2139 | 2141 |
| 2140 scroll_layer_->SetBounds(gfx::Size(2 * root_layer->bounds().width(), | 2142 scroll_layer_->SetBounds(gfx::Size(2 * root_layer->bounds().width(), |
| 2141 2 * root_layer->bounds().height())); | 2143 2 * root_layer->bounds().height())); |
| 2142 scroll_layer_->SetScrollOffset(gfx::ScrollOffset()); | 2144 scroll_layer_->SetScrollOffset(gfx::ScrollOffset()); |
| 2143 | 2145 |
| 2144 CreateVirtualViewportLayers(root_layer, scroll_layer_, root_layer->bounds(), | 2146 CreateVirtualViewportLayers(root_layer, scroll_layer_, root_layer->bounds(), |
| 2145 root_layer->bounds(), layer_tree_host()); | 2147 root_layer->bounds(), layer_tree_host()); |
| 2146 | 2148 |
| 2147 layer_tree()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); | 2149 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); |
| 2148 client_.set_bounds(root_layer->bounds()); | 2150 client_.set_bounds(root_layer->bounds()); |
| 2149 } | 2151 } |
| 2150 | 2152 |
| 2151 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2153 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 2152 | 2154 |
| 2153 void ApplyViewportDeltas(const gfx::Vector2dF& scroll_delta, | 2155 void ApplyViewportDeltas(const gfx::Vector2dF& scroll_delta, |
| 2154 const gfx::Vector2dF&, | 2156 const gfx::Vector2dF&, |
| 2155 const gfx::Vector2dF& elastic_overscroll_delta, | 2157 const gfx::Vector2dF& elastic_overscroll_delta, |
| 2156 float scale, | 2158 float scale, |
| 2157 float) override { | 2159 float) override { |
| 2158 gfx::ScrollOffset offset = scroll_layer_->scroll_offset(); | 2160 gfx::ScrollOffset offset = scroll_layer_->scroll_offset(); |
| 2159 scroll_layer_->SetScrollOffset(ScrollOffsetWithDelta(offset, scroll_delta)); | 2161 scroll_layer_->SetScrollOffset(ScrollOffsetWithDelta(offset, scroll_delta)); |
| 2160 layer_tree()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f); | 2162 layer_tree_host()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f); |
| 2161 } | 2163 } |
| 2162 | 2164 |
| 2163 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 2165 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
| 2164 // We get one commit before the first draw, and the animation doesn't happen | 2166 // We get one commit before the first draw, and the animation doesn't happen |
| 2165 // until the second draw. | 2167 // until the second draw. |
| 2166 switch (impl->active_tree()->source_frame_number()) { | 2168 switch (impl->active_tree()->source_frame_number()) { |
| 2167 case 0: | 2169 case 0: |
| 2168 EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor()); | 2170 EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor()); |
| 2169 // We'll start an animation when we get back to the main thread. | 2171 // We'll start an animation when we get back to the main thread. |
| 2170 break; | 2172 break; |
| 2171 case 1: | 2173 case 1: |
| 2172 EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor()); | 2174 EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor()); |
| 2173 break; | 2175 break; |
| 2174 case 2: | 2176 case 2: |
| 2175 EXPECT_EQ(1.25f, impl->active_tree()->current_page_scale_factor()); | 2177 EXPECT_EQ(1.25f, impl->active_tree()->current_page_scale_factor()); |
| 2176 EndTest(); | 2178 EndTest(); |
| 2177 break; | 2179 break; |
| 2178 case 3: | 2180 case 3: |
| 2179 break; | 2181 break; |
| 2180 default: | 2182 default: |
| 2181 NOTREACHED(); | 2183 NOTREACHED(); |
| 2182 } | 2184 } |
| 2183 } | 2185 } |
| 2184 | 2186 |
| 2185 void DidCommitAndDrawFrame() override { | 2187 void DidCommitAndDrawFrame() override { |
| 2186 switch (layer_tree_host()->source_frame_number()) { | 2188 switch (layer_tree_host()->source_frame_number()) { |
| 2187 case 1: | 2189 case 1: |
| 2188 layer_tree()->StartPageScaleAnimation(gfx::Vector2d(), false, 1.25f, | 2190 layer_tree_host()->StartPageScaleAnimation(gfx::Vector2d(), false, |
| 2189 base::TimeDelta()); | 2191 1.25f, base::TimeDelta()); |
| 2190 break; | 2192 break; |
| 2191 } | 2193 } |
| 2192 } | 2194 } |
| 2193 | 2195 |
| 2194 void AfterTest() override {} | 2196 void AfterTest() override {} |
| 2195 | 2197 |
| 2196 FakeContentLayerClient client_; | 2198 FakeContentLayerClient client_; |
| 2197 scoped_refptr<Layer> scroll_layer_; | 2199 scoped_refptr<Layer> scroll_layer_; |
| 2198 }; | 2200 }; |
| 2199 | 2201 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2230 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers | 2232 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers |
| 2231 : public LayerTreeHostTest { | 2233 : public LayerTreeHostTest { |
| 2232 public: | 2234 public: |
| 2233 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {} | 2235 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {} |
| 2234 | 2236 |
| 2235 void BeginTest() override { | 2237 void BeginTest() override { |
| 2236 client_.set_fill_with_nonsolid_color(true); | 2238 client_.set_fill_with_nonsolid_color(true); |
| 2237 root_layer_ = FakePictureLayer::Create(&client_); | 2239 root_layer_ = FakePictureLayer::Create(&client_); |
| 2238 child_layer_ = FakePictureLayer::Create(&client_); | 2240 child_layer_ = FakePictureLayer::Create(&client_); |
| 2239 | 2241 |
| 2240 layer_tree()->SetViewportSize(gfx::Size(60, 60)); | 2242 layer_tree_host()->SetViewportSize(gfx::Size(60, 60)); |
| 2241 layer_tree()->SetDeviceScaleFactor(1.5); | 2243 layer_tree_host()->SetDeviceScaleFactor(1.5); |
| 2242 EXPECT_EQ(gfx::Size(60, 60), layer_tree()->device_viewport_size()); | 2244 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size()); |
| 2243 | 2245 |
| 2244 root_layer_->AddChild(child_layer_); | 2246 root_layer_->AddChild(child_layer_); |
| 2245 | 2247 |
| 2246 root_layer_->SetIsDrawable(true); | 2248 root_layer_->SetIsDrawable(true); |
| 2247 root_layer_->SetBounds(gfx::Size(30, 30)); | 2249 root_layer_->SetBounds(gfx::Size(30, 30)); |
| 2248 | 2250 |
| 2249 child_layer_->SetIsDrawable(true); | 2251 child_layer_->SetIsDrawable(true); |
| 2250 child_layer_->SetPosition(gfx::PointF(2.f, 2.f)); | 2252 child_layer_->SetPosition(gfx::PointF(2.f, 2.f)); |
| 2251 child_layer_->SetBounds(gfx::Size(10, 10)); | 2253 child_layer_->SetBounds(gfx::Size(10, 10)); |
| 2252 client_.set_bounds(gfx::Size(10, 10)); | 2254 client_.set_bounds(gfx::Size(10, 10)); |
| 2253 | 2255 |
| 2254 layer_tree()->SetRootLayer(root_layer_); | 2256 layer_tree_host()->SetRootLayer(root_layer_); |
| 2255 | 2257 |
| 2256 PostSetNeedsCommitToMainThread(); | 2258 PostSetNeedsCommitToMainThread(); |
| 2257 client_.set_bounds(root_layer_->bounds()); | 2259 client_.set_bounds(root_layer_->bounds()); |
| 2258 } | 2260 } |
| 2259 | 2261 |
| 2260 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 2262 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
| 2261 // Should only do one commit. | 2263 // Should only do one commit. |
| 2262 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); | 2264 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); |
| 2263 // Device scale factor should come over to impl. | 2265 // Device scale factor should come over to impl. |
| 2264 EXPECT_NEAR(impl->active_tree()->device_scale_factor(), 1.5f, 0.00001f); | 2266 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... |
| 2328 }; | 2330 }; |
| 2329 | 2331 |
| 2330 MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers); | 2332 MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers); |
| 2331 | 2333 |
| 2332 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { | 2334 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { |
| 2333 public: | 2335 public: |
| 2334 LayerTreeHostTestContinuousInvalidate() | 2336 LayerTreeHostTestContinuousInvalidate() |
| 2335 : num_commit_complete_(0), num_draw_layers_(0) {} | 2337 : num_commit_complete_(0), num_draw_layers_(0) {} |
| 2336 | 2338 |
| 2337 void BeginTest() override { | 2339 void BeginTest() override { |
| 2338 layer_tree()->SetViewportSize(gfx::Size(10, 10)); | 2340 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); |
| 2339 layer_tree()->root_layer()->SetBounds(gfx::Size(10, 10)); | 2341 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); |
| 2340 | 2342 |
| 2341 layer_ = FakePictureLayer::Create(&client_); | 2343 layer_ = FakePictureLayer::Create(&client_); |
| 2342 layer_->SetBounds(gfx::Size(10, 10)); | 2344 layer_->SetBounds(gfx::Size(10, 10)); |
| 2343 layer_->SetPosition(gfx::PointF(0.f, 0.f)); | 2345 layer_->SetPosition(gfx::PointF(0.f, 0.f)); |
| 2344 layer_->SetIsDrawable(true); | 2346 layer_->SetIsDrawable(true); |
| 2345 layer_tree()->root_layer()->AddChild(layer_); | 2347 layer_tree_host()->root_layer()->AddChild(layer_); |
| 2346 | 2348 |
| 2347 PostSetNeedsCommitToMainThread(); | 2349 PostSetNeedsCommitToMainThread(); |
| 2348 client_.set_bounds(layer_->bounds()); | 2350 client_.set_bounds(layer_->bounds()); |
| 2349 } | 2351 } |
| 2350 | 2352 |
| 2351 void DidCommitAndDrawFrame() override { | 2353 void DidCommitAndDrawFrame() override { |
| 2352 if (num_draw_layers_ == 2) | 2354 if (num_draw_layers_ == 2) |
| 2353 return; | 2355 return; |
| 2354 layer_->SetNeedsDisplay(); | 2356 layer_->SetNeedsDisplay(); |
| 2355 } | 2357 } |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2511 public: | 2513 public: |
| 2512 void SetupTree() override { | 2514 void SetupTree() override { |
| 2513 num_tiles_rastered_ = 0; | 2515 num_tiles_rastered_ = 0; |
| 2514 | 2516 |
| 2515 scoped_refptr<Layer> root_layer = PictureLayer::Create(&client_); | 2517 scoped_refptr<Layer> root_layer = PictureLayer::Create(&client_); |
| 2516 client_.set_fill_with_nonsolid_color(true); | 2518 client_.set_fill_with_nonsolid_color(true); |
| 2517 root_layer->SetIsDrawable(true); | 2519 root_layer->SetIsDrawable(true); |
| 2518 root_layer->SetBounds(gfx::Size(10, 10)); | 2520 root_layer->SetBounds(gfx::Size(10, 10)); |
| 2519 root_layer->SetContentsOpaque(true); | 2521 root_layer->SetContentsOpaque(true); |
| 2520 | 2522 |
| 2521 layer_tree()->SetRootLayer(root_layer); | 2523 layer_tree_host()->SetRootLayer(root_layer); |
| 2522 | 2524 |
| 2523 // The expectations are based on the assumption that the default | 2525 // The expectations are based on the assumption that the default |
| 2524 // LCD settings are: | 2526 // LCD settings are: |
| 2525 EXPECT_TRUE(layer_tree_host()->settings().can_use_lcd_text); | 2527 EXPECT_TRUE(layer_tree_host()->settings().can_use_lcd_text); |
| 2526 | 2528 |
| 2527 LayerTreeHostTest::SetupTree(); | 2529 LayerTreeHostTest::SetupTree(); |
| 2528 client_.set_bounds(root_layer->bounds()); | 2530 client_.set_bounds(root_layer->bounds()); |
| 2529 } | 2531 } |
| 2530 | 2532 |
| 2531 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2533 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 2532 | 2534 |
| 2533 void DidCommitAndDrawFrame() override { | 2535 void DidCommitAndDrawFrame() override { |
| 2534 switch (layer_tree_host()->source_frame_number()) { | 2536 switch (layer_tree_host()->source_frame_number()) { |
| 2535 case 1: | 2537 case 1: |
| 2536 PostSetNeedsCommitToMainThread(); | 2538 PostSetNeedsCommitToMainThread(); |
| 2537 break; | 2539 break; |
| 2538 case 2: | 2540 case 2: |
| 2539 // Change layer opacity that should trigger lcd change. | 2541 // Change layer opacity that should trigger lcd change. |
| 2540 layer_tree()->root_layer()->SetOpacity(.5f); | 2542 layer_tree_host()->root_layer()->SetOpacity(.5f); |
| 2541 break; | 2543 break; |
| 2542 case 3: | 2544 case 3: |
| 2543 // Change layer opacity that should not trigger lcd change. | 2545 // Change layer opacity that should not trigger lcd change. |
| 2544 layer_tree()->root_layer()->SetOpacity(1.f); | 2546 layer_tree_host()->root_layer()->SetOpacity(1.f); |
| 2545 break; | 2547 break; |
| 2546 case 4: | 2548 case 4: |
| 2547 EndTest(); | 2549 EndTest(); |
| 2548 break; | 2550 break; |
| 2549 } | 2551 } |
| 2550 } | 2552 } |
| 2551 | 2553 |
| 2552 void NotifyTileStateChangedOnThread(LayerTreeHostImpl* host_impl, | 2554 void NotifyTileStateChangedOnThread(LayerTreeHostImpl* host_impl, |
| 2553 const Tile* tile) override { | 2555 const Tile* tile) override { |
| 2554 ++num_tiles_rastered_; | 2556 ++num_tiles_rastered_; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2759 | 2761 |
| 2760 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation | 2762 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation |
| 2761 : public LayerTreeHostTest { | 2763 : public LayerTreeHostTest { |
| 2762 protected: | 2764 protected: |
| 2763 void SetupTree() override { | 2765 void SetupTree() override { |
| 2764 LayerTreeHostTest::SetupTree(); | 2766 LayerTreeHostTest::SetupTree(); |
| 2765 | 2767 |
| 2766 scoped_refptr<Layer> layer = PictureLayer::Create(&client_); | 2768 scoped_refptr<Layer> layer = PictureLayer::Create(&client_); |
| 2767 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); | 2769 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); |
| 2768 layer->SetBounds(gfx::Size(10, 10)); | 2770 layer->SetBounds(gfx::Size(10, 10)); |
| 2769 layer_tree()->root_layer()->AddChild(layer); | 2771 layer_tree_host()->root_layer()->AddChild(layer); |
| 2770 client_.set_bounds(layer->bounds()); | 2772 client_.set_bounds(layer->bounds()); |
| 2771 } | 2773 } |
| 2772 | 2774 |
| 2773 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2775 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 2774 | 2776 |
| 2775 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 2777 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
| 2776 EndTest(); | 2778 EndTest(); |
| 2777 } | 2779 } |
| 2778 | 2780 |
| 2779 void AfterTest() override {} | 2781 void AfterTest() override {} |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2846 parent_layer_->SetIsDrawable(true); | 2848 parent_layer_->SetIsDrawable(true); |
| 2847 parent_layer_->SetBounds(gfx::Size(50, 50)); | 2849 parent_layer_->SetBounds(gfx::Size(50, 50)); |
| 2848 parent_layer_->SetForceRenderSurfaceForTesting(true); | 2850 parent_layer_->SetForceRenderSurfaceForTesting(true); |
| 2849 | 2851 |
| 2850 child_layer_ = FakePictureLayer::Create(&client_); | 2852 child_layer_ = FakePictureLayer::Create(&client_); |
| 2851 child_layer_->SetIsDrawable(true); | 2853 child_layer_->SetIsDrawable(true); |
| 2852 child_layer_->SetBounds(gfx::Size(50, 50)); | 2854 child_layer_->SetBounds(gfx::Size(50, 50)); |
| 2853 | 2855 |
| 2854 root_layer_->AddChild(parent_layer_); | 2856 root_layer_->AddChild(parent_layer_); |
| 2855 parent_layer_->AddChild(child_layer_); | 2857 parent_layer_->AddChild(child_layer_); |
| 2856 layer_tree()->SetRootLayer(root_layer_); | 2858 layer_tree_host()->SetRootLayer(root_layer_); |
| 2857 | 2859 |
| 2858 LayerTreeHostTest::SetupTree(); | 2860 LayerTreeHostTest::SetupTree(); |
| 2859 client_.set_bounds(root_layer_->bounds()); | 2861 client_.set_bounds(root_layer_->bounds()); |
| 2860 } | 2862 } |
| 2861 | 2863 |
| 2862 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface( | 2864 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface( |
| 2863 scoped_refptr<ContextProvider> compositor_context_provider, | 2865 scoped_refptr<ContextProvider> compositor_context_provider, |
| 2864 scoped_refptr<ContextProvider> worker_context_provider) override { | 2866 scoped_refptr<ContextProvider> worker_context_provider) override { |
| 2865 auto on_draw_callback = | 2867 auto on_draw_callback = |
| 2866 base::Bind(&LayerTreeHostTestResourcelessSoftwareDraw::CallOnDraw, | 2868 base::Bind(&LayerTreeHostTestResourcelessSoftwareDraw::CallOnDraw, |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3189 } | 3191 } |
| 3190 | 3192 |
| 3191 if (other_root_->layer_tree_host()) { | 3193 if (other_root_->layer_tree_host()) { |
| 3192 EXPECT_FALSE( | 3194 EXPECT_FALSE( |
| 3193 other_root_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( | 3195 other_root_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( |
| 3194 other_root_.get())); | 3196 other_root_.get())); |
| 3195 } | 3197 } |
| 3196 | 3198 |
| 3197 switch (num_commits_) { | 3199 switch (num_commits_) { |
| 3198 case 1: | 3200 case 1: |
| 3199 layer_tree()->SetRootLayer(root_); | 3201 layer_tree_host()->SetRootLayer(root_); |
| 3200 // Layers added to the tree get committed. | 3202 // Layers added to the tree get committed. |
| 3201 ++expected_push_properties_root_; | 3203 ++expected_push_properties_root_; |
| 3202 ++expected_push_properties_child_; | 3204 ++expected_push_properties_child_; |
| 3203 ++expected_push_properties_grandchild_; | 3205 ++expected_push_properties_grandchild_; |
| 3204 ++expected_push_properties_child2_; | 3206 ++expected_push_properties_child2_; |
| 3205 break; | 3207 break; |
| 3206 case 2: | 3208 case 2: |
| 3207 layer_tree_host()->SetNeedsCommit(); | 3209 layer_tree_host()->SetNeedsCommit(); |
| 3208 // No layers need commit. | 3210 // No layers need commit. |
| 3209 break; | 3211 break; |
| 3210 case 3: | 3212 case 3: |
| 3211 layer_tree()->SetRootLayer(other_root_); | 3213 layer_tree_host()->SetRootLayer(other_root_); |
| 3212 // Layers added to the tree get committed. | 3214 // Layers added to the tree get committed. |
| 3213 ++expected_push_properties_other_root_; | 3215 ++expected_push_properties_other_root_; |
| 3214 break; | 3216 break; |
| 3215 case 4: | 3217 case 4: |
| 3216 layer_tree()->SetRootLayer(root_); | 3218 layer_tree_host()->SetRootLayer(root_); |
| 3217 // Layers added to the tree get committed. | 3219 // Layers added to the tree get committed. |
| 3218 ++expected_push_properties_root_; | 3220 ++expected_push_properties_root_; |
| 3219 ++expected_push_properties_child_; | 3221 ++expected_push_properties_child_; |
| 3220 ++expected_push_properties_grandchild_; | 3222 ++expected_push_properties_grandchild_; |
| 3221 ++expected_push_properties_child2_; | 3223 ++expected_push_properties_child2_; |
| 3222 break; | 3224 break; |
| 3223 case 5: | 3225 case 5: |
| 3224 layer_tree_host()->SetNeedsCommit(); | 3226 layer_tree_host()->SetNeedsCommit(); |
| 3225 // No layers need commit. | 3227 // No layers need commit. |
| 3226 break; | 3228 break; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3237 case 8: | 3239 case 8: |
| 3238 grandchild_->RemoveFromParent(); | 3240 grandchild_->RemoveFromParent(); |
| 3239 // No layers need commit. | 3241 // No layers need commit. |
| 3240 break; | 3242 break; |
| 3241 case 9: | 3243 case 9: |
| 3242 child_->AddChild(grandchild_); | 3244 child_->AddChild(grandchild_); |
| 3243 // Layers added to the tree get committed. | 3245 // Layers added to the tree get committed. |
| 3244 ++expected_push_properties_grandchild_; | 3246 ++expected_push_properties_grandchild_; |
| 3245 break; | 3247 break; |
| 3246 case 10: | 3248 case 10: |
| 3247 layer_tree()->SetViewportSize(gfx::Size(20, 20)); | 3249 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); |
| 3248 // No layers need commit. | 3250 // No layers need commit. |
| 3249 break; | 3251 break; |
| 3250 case 11: | 3252 case 11: |
| 3251 layer_tree()->SetPageScaleFactorAndLimits(1.f, 0.8f, 1.1f); | 3253 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.8f, 1.1f); |
| 3252 // No layers need commit. | 3254 // No layers need commit. |
| 3253 break; | 3255 break; |
| 3254 case 12: | 3256 case 12: |
| 3255 child_->MakePushProperties(); | 3257 child_->MakePushProperties(); |
| 3256 // The modified layer needs commit | 3258 // The modified layer needs commit |
| 3257 ++expected_push_properties_child_; | 3259 ++expected_push_properties_child_; |
| 3258 ++expected_push_properties_grandchild_; | 3260 ++expected_push_properties_grandchild_; |
| 3259 break; | 3261 break; |
| 3260 case 13: | 3262 case 13: |
| 3261 child2_->MakePushProperties(); | 3263 child2_->MakePushProperties(); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3517 root_ = Layer::Create(); | 3519 root_ = Layer::Create(); |
| 3518 root_->SetBounds(gfx::Size(1, 1)); | 3520 root_->SetBounds(gfx::Size(1, 1)); |
| 3519 | 3521 |
| 3520 bool paint_scrollbar = true; | 3522 bool paint_scrollbar = true; |
| 3521 bool has_thumb = false; | 3523 bool has_thumb = false; |
| 3522 scrollbar_layer_ = FakePaintedScrollbarLayer::Create( | 3524 scrollbar_layer_ = FakePaintedScrollbarLayer::Create( |
| 3523 paint_scrollbar, has_thumb, root_->id()); | 3525 paint_scrollbar, has_thumb, root_->id()); |
| 3524 | 3526 |
| 3525 root_->AddChild(scrollbar_layer_); | 3527 root_->AddChild(scrollbar_layer_); |
| 3526 | 3528 |
| 3527 layer_tree()->SetRootLayer(root_); | 3529 layer_tree_host()->SetRootLayer(root_); |
| 3528 LayerTreeHostTest::SetupTree(); | 3530 LayerTreeHostTest::SetupTree(); |
| 3529 } | 3531 } |
| 3530 | 3532 |
| 3531 void DidCommitAndDrawFrame() override { | 3533 void DidCommitAndDrawFrame() override { |
| 3532 switch (layer_tree_host()->source_frame_number()) { | 3534 switch (layer_tree_host()->source_frame_number()) { |
| 3533 case 0: | 3535 case 0: |
| 3534 break; | 3536 break; |
| 3535 case 1: { | 3537 case 1: { |
| 3536 // During update, the ignore_set_needs_commit_ bit is set to true to | 3538 // During update, the ignore_set_needs_commit_ bit is set to true to |
| 3537 // avoid causing a second commit to be scheduled. If a property change | 3539 // avoid causing a second commit to be scheduled. If a property change |
| 3538 // is made during this, however, it needs to be pushed in the upcoming | 3540 // is made during this, however, it needs to be pushed in the upcoming |
| 3539 // commit. | 3541 // commit. |
| 3540 std::unique_ptr<base::AutoReset<bool>> ignore = | 3542 std::unique_ptr<base::AutoReset<bool>> ignore = |
| 3541 scrollbar_layer_->IgnoreSetNeedsCommit(); | 3543 scrollbar_layer_->IgnoreSetNeedsCommit(); |
| 3542 | 3544 |
| 3543 scrollbar_layer_->SetBounds(gfx::Size(30, 30)); | 3545 scrollbar_layer_->SetBounds(gfx::Size(30, 30)); |
| 3544 | 3546 |
| 3545 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3547 EXPECT_TRUE( |
| 3546 scrollbar_layer_.get())); | 3548 layer_tree_host() |
| 3549 ->GetLayerTree() |
| 3550 ->LayerNeedsPushPropertiesForTesting(scrollbar_layer_.get())); |
| 3547 layer_tree_host()->SetNeedsCommit(); | 3551 layer_tree_host()->SetNeedsCommit(); |
| 3548 | 3552 |
| 3549 scrollbar_layer_->reset_push_properties_count(); | 3553 scrollbar_layer_->reset_push_properties_count(); |
| 3550 EXPECT_EQ(0u, scrollbar_layer_->push_properties_count()); | 3554 EXPECT_EQ(0u, scrollbar_layer_->push_properties_count()); |
| 3551 break; | 3555 break; |
| 3552 } | 3556 } |
| 3553 case 2: | 3557 case 2: |
| 3554 EXPECT_EQ(1u, scrollbar_layer_->push_properties_count()); | 3558 EXPECT_EQ(1u, scrollbar_layer_->push_properties_count()); |
| 3555 EndTest(); | 3559 EndTest(); |
| 3556 break; | 3560 break; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3567 | 3571 |
| 3568 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { | 3572 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { |
| 3569 protected: | 3573 protected: |
| 3570 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 3574 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 3571 | 3575 |
| 3572 void SetupTree() override { | 3576 void SetupTree() override { |
| 3573 root_ = PushPropertiesCountingLayer::Create(); | 3577 root_ = PushPropertiesCountingLayer::Create(); |
| 3574 child_ = PushPropertiesCountingLayer::Create(); | 3578 child_ = PushPropertiesCountingLayer::Create(); |
| 3575 root_->AddChild(child_); | 3579 root_->AddChild(child_); |
| 3576 | 3580 |
| 3577 layer_tree()->SetRootLayer(root_); | 3581 layer_tree_host()->SetRootLayer(root_); |
| 3578 LayerTreeHostTest::SetupTree(); | 3582 LayerTreeHostTest::SetupTree(); |
| 3579 } | 3583 } |
| 3580 | 3584 |
| 3581 void DidCommitAndDrawFrame() override { | 3585 void DidCommitAndDrawFrame() override { |
| 3586 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
| 3582 switch (layer_tree_host()->source_frame_number()) { | 3587 switch (layer_tree_host()->source_frame_number()) { |
| 3583 case 0: | 3588 case 0: |
| 3584 break; | 3589 break; |
| 3585 case 1: { | 3590 case 1: { |
| 3586 // During update, the ignore_set_needs_commit_ bit is set to true to | 3591 // During update, the ignore_set_needs_commit_ bit is set to true to |
| 3587 // avoid causing a second commit to be scheduled. If a property change | 3592 // avoid causing a second commit to be scheduled. If a property change |
| 3588 // is made during this, however, it needs to be pushed in the upcoming | 3593 // is made during this, however, it needs to be pushed in the upcoming |
| 3589 // commit. | 3594 // commit. |
| 3590 EXPECT_FALSE( | 3595 EXPECT_FALSE( |
| 3591 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3596 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3592 EXPECT_FALSE( | 3597 EXPECT_FALSE( |
| 3593 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3598 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3594 EXPECT_EQ(0, root_->NumDescendantsThatDrawContent()); | 3599 EXPECT_EQ(0, root_->NumDescendantsThatDrawContent()); |
| 3595 root_->reset_push_properties_count(); | 3600 root_->reset_push_properties_count(); |
| 3596 child_->reset_push_properties_count(); | 3601 child_->reset_push_properties_count(); |
| 3597 child_->SetDrawsContent(true); | 3602 child_->SetDrawsContent(true); |
| 3598 EXPECT_EQ(1, root_->NumDescendantsThatDrawContent()); | 3603 EXPECT_EQ(1, root_->NumDescendantsThatDrawContent()); |
| 3599 EXPECT_EQ(0u, root_->push_properties_count()); | 3604 EXPECT_EQ(0u, root_->push_properties_count()); |
| 3600 EXPECT_EQ(0u, child_->push_properties_count()); | 3605 EXPECT_EQ(0u, child_->push_properties_count()); |
| 3601 EXPECT_TRUE( | 3606 EXPECT_TRUE( |
| 3602 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3607 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3603 EXPECT_TRUE( | 3608 EXPECT_TRUE( |
| 3604 | 3609 |
| 3605 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3610 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3606 break; | 3611 break; |
| 3607 } | 3612 } |
| 3608 case 2: | 3613 case 2: |
| 3609 EXPECT_EQ(1u, root_->push_properties_count()); | 3614 EXPECT_EQ(1u, root_->push_properties_count()); |
| 3610 EXPECT_EQ(1u, child_->push_properties_count()); | 3615 EXPECT_EQ(1u, child_->push_properties_count()); |
| 3611 EXPECT_FALSE( | 3616 EXPECT_FALSE( |
| 3612 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3617 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3613 EXPECT_FALSE( | 3618 EXPECT_FALSE( |
| 3614 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3619 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3615 EndTest(); | 3620 EndTest(); |
| 3616 break; | 3621 break; |
| 3617 } | 3622 } |
| 3618 } | 3623 } |
| 3619 | 3624 |
| 3620 void AfterTest() override {} | 3625 void AfterTest() override {} |
| 3621 | 3626 |
| 3622 scoped_refptr<PushPropertiesCountingLayer> root_; | 3627 scoped_refptr<PushPropertiesCountingLayer> root_; |
| 3623 scoped_refptr<PushPropertiesCountingLayer> child_; | 3628 scoped_refptr<PushPropertiesCountingLayer> child_; |
| 3624 }; | 3629 }; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3670 }; | 3675 }; |
| 3671 | 3676 |
| 3672 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush | 3677 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush |
| 3673 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3678 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3674 protected: | 3679 protected: |
| 3675 void DidCommitAndDrawFrame() override { | 3680 void DidCommitAndDrawFrame() override { |
| 3676 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3681 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3677 switch (last_source_frame_number) { | 3682 switch (last_source_frame_number) { |
| 3678 case 0: | 3683 case 0: |
| 3679 // All layers will need push properties as we set their layer tree host | 3684 // All layers will need push properties as we set their layer tree host |
| 3680 layer_tree()->SetRootLayer(root_); | 3685 layer_tree_host()->SetRootLayer(root_); |
| 3686 EXPECT_TRUE(layer_tree_host() |
| 3687 ->GetLayerTree() |
| 3688 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3689 EXPECT_TRUE(layer_tree_host() |
| 3690 ->GetLayerTree() |
| 3691 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3681 EXPECT_TRUE( | 3692 EXPECT_TRUE( |
| 3682 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3693 layer_tree_host() |
| 3694 ->GetLayerTree() |
| 3695 ->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3683 EXPECT_TRUE( | 3696 EXPECT_TRUE( |
| 3684 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3697 layer_tree_host() |
| 3685 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3698 ->GetLayerTree() |
| 3686 grandchild1_.get())); | 3699 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| 3687 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3700 EXPECT_TRUE( |
| 3688 grandchild2_.get())); | 3701 layer_tree_host() |
| 3689 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3702 ->GetLayerTree() |
| 3690 grandchild3_.get())); | 3703 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
| 3691 break; | 3704 break; |
| 3692 case 1: | 3705 case 1: |
| 3693 EndTest(); | 3706 EndTest(); |
| 3694 break; | 3707 break; |
| 3695 } | 3708 } |
| 3696 } | 3709 } |
| 3697 }; | 3710 }; |
| 3698 | 3711 |
| 3699 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); | 3712 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); |
| 3700 | 3713 |
| 3701 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion | 3714 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion |
| 3702 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3715 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3703 protected: | 3716 protected: |
| 3704 void DidCommitAndDrawFrame() override { | 3717 void DidCommitAndDrawFrame() override { |
| 3705 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3718 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3706 switch (last_source_frame_number) { | 3719 switch (last_source_frame_number) { |
| 3707 case 0: | 3720 case 0: |
| 3708 layer_tree()->SetRootLayer(root_); | 3721 layer_tree_host()->SetRootLayer(root_); |
| 3709 break; | 3722 break; |
| 3710 case 1: | 3723 case 1: |
| 3724 EXPECT_FALSE(layer_tree_host() |
| 3725 ->GetLayerTree() |
| 3726 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3727 EXPECT_FALSE(layer_tree_host() |
| 3728 ->GetLayerTree() |
| 3729 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3711 EXPECT_FALSE( | 3730 EXPECT_FALSE( |
| 3712 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3731 layer_tree_host() |
| 3732 ->GetLayerTree() |
| 3733 ->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3713 EXPECT_FALSE( | 3734 EXPECT_FALSE( |
| 3714 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3735 layer_tree_host() |
| 3715 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3736 ->GetLayerTree() |
| 3716 grandchild1_.get())); | 3737 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| 3717 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3738 EXPECT_FALSE( |
| 3718 grandchild2_.get())); | 3739 layer_tree_host() |
| 3719 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3740 ->GetLayerTree() |
| 3720 grandchild3_.get())); | 3741 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
| 3721 | 3742 |
| 3722 grandchild1_->RemoveFromParent(); | 3743 grandchild1_->RemoveFromParent(); |
| 3723 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 3744 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3724 | 3745 |
| 3746 EXPECT_FALSE(layer_tree_host() |
| 3747 ->GetLayerTree() |
| 3748 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3749 EXPECT_FALSE(layer_tree_host() |
| 3750 ->GetLayerTree() |
| 3751 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3725 EXPECT_FALSE( | 3752 EXPECT_FALSE( |
| 3726 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3753 layer_tree_host() |
| 3754 ->GetLayerTree() |
| 3755 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| 3727 EXPECT_FALSE( | 3756 EXPECT_FALSE( |
| 3728 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3757 layer_tree_host() |
| 3729 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3758 ->GetLayerTree() |
| 3730 grandchild2_.get())); | 3759 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
| 3731 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( | |
| 3732 grandchild3_.get())); | |
| 3733 | 3760 |
| 3734 child_->AddChild(grandchild1_); | 3761 child_->AddChild(grandchild1_); |
| 3735 | 3762 |
| 3763 EXPECT_FALSE(layer_tree_host() |
| 3764 ->GetLayerTree() |
| 3765 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3766 EXPECT_FALSE(layer_tree_host() |
| 3767 ->GetLayerTree() |
| 3768 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3769 EXPECT_TRUE( |
| 3770 layer_tree_host() |
| 3771 ->GetLayerTree() |
| 3772 ->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3736 EXPECT_FALSE( | 3773 EXPECT_FALSE( |
| 3737 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3774 layer_tree_host() |
| 3775 ->GetLayerTree() |
| 3776 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| 3738 EXPECT_FALSE( | 3777 EXPECT_FALSE( |
| 3739 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3778 layer_tree_host() |
| 3740 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3779 ->GetLayerTree() |
| 3741 grandchild1_.get())); | 3780 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
| 3742 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( | |
| 3743 grandchild2_.get())); | |
| 3744 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( | |
| 3745 grandchild3_.get())); | |
| 3746 | 3781 |
| 3747 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 3782 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3748 | 3783 |
| 3784 EXPECT_FALSE(layer_tree_host() |
| 3785 ->GetLayerTree() |
| 3786 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3787 EXPECT_FALSE(layer_tree_host() |
| 3788 ->GetLayerTree() |
| 3789 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3790 EXPECT_TRUE( |
| 3791 layer_tree_host() |
| 3792 ->GetLayerTree() |
| 3793 ->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3794 EXPECT_TRUE( |
| 3795 layer_tree_host() |
| 3796 ->GetLayerTree() |
| 3797 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| 3749 EXPECT_FALSE( | 3798 EXPECT_FALSE( |
| 3750 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3799 layer_tree_host() |
| 3751 EXPECT_FALSE( | 3800 ->GetLayerTree() |
| 3752 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3801 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
| 3753 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | |
| 3754 grandchild1_.get())); | |
| 3755 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | |
| 3756 grandchild2_.get())); | |
| 3757 EXPECT_FALSE(layer_tree()->LayerNeedsPushPropertiesForTesting( | |
| 3758 grandchild3_.get())); | |
| 3759 | 3802 |
| 3760 // grandchild2_ will still need a push properties. | 3803 // grandchild2_ will still need a push properties. |
| 3761 grandchild1_->RemoveFromParent(); | 3804 grandchild1_->RemoveFromParent(); |
| 3762 | 3805 |
| 3763 EXPECT_FALSE( | 3806 EXPECT_FALSE(layer_tree_host() |
| 3764 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3807 ->GetLayerTree() |
| 3765 EXPECT_FALSE( | 3808 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3766 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3809 EXPECT_FALSE(layer_tree_host() |
| 3810 ->GetLayerTree() |
| 3811 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3767 | 3812 |
| 3768 // grandchild3_ does not need a push properties, so recursing should | 3813 // grandchild3_ does not need a push properties, so recursing should |
| 3769 // no longer be needed. | 3814 // no longer be needed. |
| 3770 grandchild2_->RemoveFromParent(); | 3815 grandchild2_->RemoveFromParent(); |
| 3771 | 3816 |
| 3772 EXPECT_FALSE( | 3817 EXPECT_FALSE(layer_tree_host() |
| 3773 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3818 ->GetLayerTree() |
| 3774 EXPECT_FALSE( | 3819 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3775 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 3820 EXPECT_FALSE(layer_tree_host() |
| 3821 ->GetLayerTree() |
| 3822 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3776 EndTest(); | 3823 EndTest(); |
| 3777 break; | 3824 break; |
| 3778 } | 3825 } |
| 3779 } | 3826 } |
| 3780 }; | 3827 }; |
| 3781 | 3828 |
| 3782 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); | 3829 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); |
| 3783 | 3830 |
| 3784 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence | 3831 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence |
| 3785 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3832 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3786 protected: | 3833 protected: |
| 3787 void DidCommitAndDrawFrame() override { | 3834 void DidCommitAndDrawFrame() override { |
| 3788 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 3835 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
| 3789 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3836 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3790 switch (last_source_frame_number) { | 3837 switch (last_source_frame_number) { |
| 3791 case 0: | 3838 case 0: |
| 3792 layer_tree->SetRootLayer(root_); | 3839 layer_tree_host()->SetRootLayer(root_); |
| 3793 grandchild1_->set_persist_needs_push_properties(true); | 3840 grandchild1_->set_persist_needs_push_properties(true); |
| 3794 grandchild2_->set_persist_needs_push_properties(true); | 3841 grandchild2_->set_persist_needs_push_properties(true); |
| 3795 break; | 3842 break; |
| 3796 case 1: | 3843 case 1: |
| 3797 EXPECT_FALSE( | 3844 EXPECT_FALSE( |
| 3798 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 3845 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3799 EXPECT_FALSE( | 3846 EXPECT_FALSE( |
| 3800 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 3847 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3801 EXPECT_TRUE( | 3848 EXPECT_TRUE( |
| 3802 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | 3849 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 3831 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); | 3878 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); |
| 3832 | 3879 |
| 3833 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree | 3880 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree |
| 3834 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3881 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3835 protected: | 3882 protected: |
| 3836 void DidCommitAndDrawFrame() override { | 3883 void DidCommitAndDrawFrame() override { |
| 3837 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 3884 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
| 3838 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3885 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3839 switch (last_source_frame_number) { | 3886 switch (last_source_frame_number) { |
| 3840 case 0: | 3887 case 0: |
| 3841 layer_tree->SetRootLayer(root_); | 3888 layer_tree_host()->SetRootLayer(root_); |
| 3842 break; | 3889 break; |
| 3843 case 1: | 3890 case 1: |
| 3844 EXPECT_FALSE( | 3891 EXPECT_FALSE( |
| 3845 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 3892 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3846 EXPECT_FALSE( | 3893 EXPECT_FALSE( |
| 3847 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 3894 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3848 EXPECT_FALSE( | 3895 EXPECT_FALSE( |
| 3849 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | 3896 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3850 EXPECT_FALSE( | 3897 EXPECT_FALSE( |
| 3851 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | 3898 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3900 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); | 3947 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); |
| 3901 | 3948 |
| 3902 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild | 3949 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild |
| 3903 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3950 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3904 protected: | 3951 protected: |
| 3905 void DidCommitAndDrawFrame() override { | 3952 void DidCommitAndDrawFrame() override { |
| 3906 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 3953 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
| 3907 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3954 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3908 switch (last_source_frame_number) { | 3955 switch (last_source_frame_number) { |
| 3909 case 0: | 3956 case 0: |
| 3910 layer_tree->SetRootLayer(root_); | 3957 layer_tree_host()->SetRootLayer(root_); |
| 3911 break; | 3958 break; |
| 3912 case 1: | 3959 case 1: |
| 3913 EXPECT_FALSE( | 3960 EXPECT_FALSE( |
| 3914 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 3961 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3915 EXPECT_FALSE( | 3962 EXPECT_FALSE( |
| 3916 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 3963 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3917 EXPECT_FALSE( | 3964 EXPECT_FALSE( |
| 3918 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | 3965 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3919 EXPECT_FALSE( | 3966 EXPECT_FALSE( |
| 3920 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | 3967 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3965 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); | 4012 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); |
| 3966 | 4013 |
| 3967 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent | 4014 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent |
| 3968 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 4015 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3969 protected: | 4016 protected: |
| 3970 void DidCommitAndDrawFrame() override { | 4017 void DidCommitAndDrawFrame() override { |
| 3971 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 4018 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
| 3972 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 4019 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3973 switch (last_source_frame_number) { | 4020 switch (last_source_frame_number) { |
| 3974 case 0: | 4021 case 0: |
| 3975 layer_tree->SetRootLayer(root_); | 4022 layer_tree_host()->SetRootLayer(root_); |
| 3976 break; | 4023 break; |
| 3977 case 1: | 4024 case 1: |
| 3978 EXPECT_FALSE( | 4025 EXPECT_FALSE( |
| 3979 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4026 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3980 EXPECT_FALSE( | 4027 EXPECT_FALSE( |
| 3981 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4028 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3982 EXPECT_FALSE( | 4029 EXPECT_FALSE( |
| 3983 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); | 4030 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3984 EXPECT_FALSE( | 4031 EXPECT_FALSE( |
| 3985 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); | 4032 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4132 // to the compositor thread, even though no resources are updated in | 4179 // to the compositor thread, even though no resources are updated in |
| 4133 // response to that invalidation. | 4180 // response to that invalidation. |
| 4134 class LayerTreeHostTestVideoLayerInvalidate : public LayerInvalidateCausesDraw { | 4181 class LayerTreeHostTestVideoLayerInvalidate : public LayerInvalidateCausesDraw { |
| 4135 public: | 4182 public: |
| 4136 void SetupTree() override { | 4183 void SetupTree() override { |
| 4137 LayerTreeHostTest::SetupTree(); | 4184 LayerTreeHostTest::SetupTree(); |
| 4138 scoped_refptr<VideoLayer> video_layer = | 4185 scoped_refptr<VideoLayer> video_layer = |
| 4139 VideoLayer::Create(&provider_, media::VIDEO_ROTATION_0); | 4186 VideoLayer::Create(&provider_, media::VIDEO_ROTATION_0); |
| 4140 video_layer->SetBounds(gfx::Size(10, 10)); | 4187 video_layer->SetBounds(gfx::Size(10, 10)); |
| 4141 video_layer->SetIsDrawable(true); | 4188 video_layer->SetIsDrawable(true); |
| 4142 layer_tree()->root_layer()->AddChild(video_layer); | 4189 layer_tree_host()->root_layer()->AddChild(video_layer); |
| 4143 | 4190 |
| 4144 invalidate_layer_ = video_layer; | 4191 invalidate_layer_ = video_layer; |
| 4145 } | 4192 } |
| 4146 | 4193 |
| 4147 private: | 4194 private: |
| 4148 FakeVideoFrameProvider provider_; | 4195 FakeVideoFrameProvider provider_; |
| 4149 }; | 4196 }; |
| 4150 | 4197 |
| 4151 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate); | 4198 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate); |
| 4152 | 4199 |
| 4153 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { | 4200 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { |
| 4154 protected: | 4201 protected: |
| 4155 void SetupTree() override { | 4202 void SetupTree() override { |
| 4156 root_layer_ = Layer::Create(); | 4203 root_layer_ = Layer::Create(); |
| 4157 root_layer_->SetPosition(gfx::PointF()); | 4204 root_layer_->SetPosition(gfx::PointF()); |
| 4158 root_layer_->SetBounds(gfx::Size(10, 10)); | 4205 root_layer_->SetBounds(gfx::Size(10, 10)); |
| 4159 | 4206 |
| 4160 parent_layer_ = SolidColorLayer::Create(); | 4207 parent_layer_ = SolidColorLayer::Create(); |
| 4161 parent_layer_->SetPosition(gfx::PointF()); | 4208 parent_layer_->SetPosition(gfx::PointF()); |
| 4162 parent_layer_->SetBounds(gfx::Size(10, 10)); | 4209 parent_layer_->SetBounds(gfx::Size(10, 10)); |
| 4163 parent_layer_->SetIsDrawable(true); | 4210 parent_layer_->SetIsDrawable(true); |
| 4164 root_layer_->AddChild(parent_layer_); | 4211 root_layer_->AddChild(parent_layer_); |
| 4165 | 4212 |
| 4166 child_layer_ = SolidColorLayer::Create(); | 4213 child_layer_ = SolidColorLayer::Create(); |
| 4167 child_layer_->SetPosition(gfx::PointF()); | 4214 child_layer_->SetPosition(gfx::PointF()); |
| 4168 child_layer_->SetBounds(gfx::Size(10, 10)); | 4215 child_layer_->SetBounds(gfx::Size(10, 10)); |
| 4169 child_layer_->SetIsDrawable(true); | 4216 child_layer_->SetIsDrawable(true); |
| 4170 parent_layer_->AddChild(child_layer_); | 4217 parent_layer_->AddChild(child_layer_); |
| 4171 | 4218 |
| 4172 layer_tree()->SetRootLayer(root_layer_); | 4219 layer_tree_host()->SetRootLayer(root_layer_); |
| 4173 LayerTreeHostTest::SetupTree(); | 4220 LayerTreeHostTest::SetupTree(); |
| 4174 } | 4221 } |
| 4175 | 4222 |
| 4176 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4223 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 4177 | 4224 |
| 4178 void DidCommitAndDrawFrame() override { | 4225 void DidCommitAndDrawFrame() override { |
| 4179 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 4226 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
| 4180 switch (layer_tree_host()->source_frame_number()) { | 4227 switch (layer_tree_host()->source_frame_number()) { |
| 4181 case 1: | 4228 case 1: |
| 4182 // The layer type used does not need to push properties every frame. | 4229 // 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... |
| 4216 }; | 4263 }; |
| 4217 | 4264 |
| 4218 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer); | 4265 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer); |
| 4219 | 4266 |
| 4220 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { | 4267 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { |
| 4221 protected: | 4268 protected: |
| 4222 void SetupTree() override { | 4269 void SetupTree() override { |
| 4223 root_layer_ = FakePictureLayer::Create(&client_); | 4270 root_layer_ = FakePictureLayer::Create(&client_); |
| 4224 root_layer_->SetBounds(gfx::Size(10, 10)); | 4271 root_layer_->SetBounds(gfx::Size(10, 10)); |
| 4225 | 4272 |
| 4226 layer_tree()->SetRootLayer(root_layer_); | 4273 layer_tree_host()->SetRootLayer(root_layer_); |
| 4227 LayerTreeHostTest::SetupTree(); | 4274 LayerTreeHostTest::SetupTree(); |
| 4228 client_.set_bounds(root_layer_->bounds()); | 4275 client_.set_bounds(root_layer_->bounds()); |
| 4229 } | 4276 } |
| 4230 | 4277 |
| 4231 void BeginTest() override { | 4278 void BeginTest() override { |
| 4232 // The viewport is empty, but we still need to update layers on the main | 4279 // The viewport is empty, but we still need to update layers on the main |
| 4233 // thread. | 4280 // thread. |
| 4234 layer_tree()->SetViewportSize(gfx::Size(0, 0)); | 4281 layer_tree_host()->SetViewportSize(gfx::Size(0, 0)); |
| 4235 PostSetNeedsCommitToMainThread(); | 4282 PostSetNeedsCommitToMainThread(); |
| 4236 } | 4283 } |
| 4237 | 4284 |
| 4238 void DidCommit() override { | 4285 void DidCommit() override { |
| 4239 // The layer should be updated even though the viewport is empty, so we | 4286 // The layer should be updated even though the viewport is empty, so we |
| 4240 // are capable of drawing it on the impl tree. | 4287 // are capable of drawing it on the impl tree. |
| 4241 EXPECT_GT(root_layer_->update_count(), 0); | 4288 EXPECT_GT(root_layer_->update_count(), 0); |
| 4242 EndTest(); | 4289 EndTest(); |
| 4243 } | 4290 } |
| 4244 | 4291 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 4275 root_layer_->AddChild(inner_viewport_container_layer); | 4322 root_layer_->AddChild(inner_viewport_container_layer); |
| 4276 inner_viewport_container_layer->AddChild(overscroll_elasticity_layer); | 4323 inner_viewport_container_layer->AddChild(overscroll_elasticity_layer); |
| 4277 overscroll_elasticity_layer->AddChild(page_scale_layer); | 4324 overscroll_elasticity_layer->AddChild(page_scale_layer); |
| 4278 page_scale_layer->AddChild(inner_viewport_scroll_layer); | 4325 page_scale_layer->AddChild(inner_viewport_scroll_layer); |
| 4279 | 4326 |
| 4280 scoped_refptr<Layer> content_layer = FakePictureLayer::Create(&client_); | 4327 scoped_refptr<Layer> content_layer = FakePictureLayer::Create(&client_); |
| 4281 content_layer_id_ = content_layer->id(); | 4328 content_layer_id_ = content_layer->id(); |
| 4282 content_layer->SetBounds(gfx::Size(10, 10)); | 4329 content_layer->SetBounds(gfx::Size(10, 10)); |
| 4283 inner_viewport_scroll_layer->AddChild(content_layer); | 4330 inner_viewport_scroll_layer->AddChild(content_layer); |
| 4284 | 4331 |
| 4285 layer_tree()->SetRootLayer(root_layer_); | 4332 layer_tree_host()->SetRootLayer(root_layer_); |
| 4286 layer_tree()->RegisterViewportLayers(overscroll_elasticity_layer, | 4333 layer_tree_host()->RegisterViewportLayers( |
| 4287 page_scale_layer, | 4334 overscroll_elasticity_layer, page_scale_layer, |
| 4288 inner_viewport_scroll_layer, nullptr); | 4335 inner_viewport_scroll_layer, nullptr); |
| 4289 LayerTreeHostTest::SetupTree(); | 4336 LayerTreeHostTest::SetupTree(); |
| 4290 client_.set_bounds(content_layer->bounds()); | 4337 client_.set_bounds(content_layer->bounds()); |
| 4291 } | 4338 } |
| 4292 | 4339 |
| 4293 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4340 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 4294 | 4341 |
| 4295 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 4342 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
| 4296 if (host_impl->sync_tree()->source_frame_number() == 0) { | 4343 if (host_impl->sync_tree()->source_frame_number() == 0) { |
| 4297 scroll_elasticity_helper_ = host_impl->CreateScrollElasticityHelper(); | 4344 scroll_elasticity_helper_ = host_impl->CreateScrollElasticityHelper(); |
| 4298 } | 4345 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4370 second_context_provider_.get() ? second_output_surface_memory_limit_ | 4417 second_context_provider_.get() ? second_output_surface_memory_limit_ |
| 4371 : first_output_surface_memory_limit_, | 4418 : first_output_surface_memory_limit_, |
| 4372 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, | 4419 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, |
| 4373 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); | 4420 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); |
| 4374 return std::move(output_surface); | 4421 return std::move(output_surface); |
| 4375 } | 4422 } |
| 4376 | 4423 |
| 4377 void SetupTree() override { | 4424 void SetupTree() override { |
| 4378 root_ = FakePictureLayer::Create(&client_); | 4425 root_ = FakePictureLayer::Create(&client_); |
| 4379 root_->SetBounds(gfx::Size(20, 20)); | 4426 root_->SetBounds(gfx::Size(20, 20)); |
| 4380 layer_tree()->SetRootLayer(root_); | 4427 layer_tree_host()->SetRootLayer(root_); |
| 4381 LayerTreeHostTest::SetupTree(); | 4428 LayerTreeHostTest::SetupTree(); |
| 4382 client_.set_bounds(root_->bounds()); | 4429 client_.set_bounds(root_->bounds()); |
| 4383 } | 4430 } |
| 4384 | 4431 |
| 4385 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4432 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 4386 | 4433 |
| 4387 void DidCommitAndDrawFrame() override { | 4434 void DidCommitAndDrawFrame() override { |
| 4388 // Lost context sometimes takes two frames to recreate. The third frame | 4435 // Lost context sometimes takes two frames to recreate. The third frame |
| 4389 // is sometimes aborted, so wait until the fourth frame to verify that | 4436 // is sometimes aborted, so wait until the fourth frame to verify that |
| 4390 // the memory has been set, and the fifth frame to end the test. | 4437 // the memory has been set, and the fifth frame to end the test. |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4624 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); | 4671 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); |
| 4625 | 4672 |
| 4626 class LayerTreeHostTestKeepSwapPromise : public LayerTreeHostTest { | 4673 class LayerTreeHostTestKeepSwapPromise : public LayerTreeHostTest { |
| 4627 public: | 4674 public: |
| 4628 LayerTreeHostTestKeepSwapPromise() {} | 4675 LayerTreeHostTestKeepSwapPromise() {} |
| 4629 | 4676 |
| 4630 void BeginTest() override { | 4677 void BeginTest() override { |
| 4631 layer_ = SolidColorLayer::Create(); | 4678 layer_ = SolidColorLayer::Create(); |
| 4632 layer_->SetIsDrawable(true); | 4679 layer_->SetIsDrawable(true); |
| 4633 layer_->SetBounds(gfx::Size(10, 10)); | 4680 layer_->SetBounds(gfx::Size(10, 10)); |
| 4634 layer_tree()->SetRootLayer(layer_); | 4681 layer_tree_host()->SetRootLayer(layer_); |
| 4635 gfx::Size bounds(100, 100); | 4682 gfx::Size bounds(100, 100); |
| 4636 layer_tree()->SetViewportSize(bounds); | 4683 layer_tree_host()->SetViewportSize(bounds); |
| 4637 PostSetNeedsCommitToMainThread(); | 4684 PostSetNeedsCommitToMainThread(); |
| 4638 } | 4685 } |
| 4639 | 4686 |
| 4640 void DidCommit() override { | 4687 void DidCommit() override { |
| 4641 MainThreadTaskRunner()->PostTask( | 4688 MainThreadTaskRunner()->PostTask( |
| 4642 FROM_HERE, base::Bind(&LayerTreeHostTestKeepSwapPromise::ChangeFrame, | 4689 FROM_HERE, base::Bind(&LayerTreeHostTestKeepSwapPromise::ChangeFrame, |
| 4643 base::Unretained(this))); | 4690 base::Unretained(this))); |
| 4644 } | 4691 } |
| 4645 | 4692 |
| 4646 void ChangeFrame() { | 4693 void ChangeFrame() { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4719 LayerTreeHostTestKeepSwapPromiseMFBA() {} | 4766 LayerTreeHostTestKeepSwapPromiseMFBA() {} |
| 4720 | 4767 |
| 4721 void InitializeSettings(LayerTreeSettings* settings) override { | 4768 void InitializeSettings(LayerTreeSettings* settings) override { |
| 4722 settings->main_frame_before_activation_enabled = true; | 4769 settings->main_frame_before_activation_enabled = true; |
| 4723 } | 4770 } |
| 4724 | 4771 |
| 4725 void BeginTest() override { | 4772 void BeginTest() override { |
| 4726 layer_ = SolidColorLayer::Create(); | 4773 layer_ = SolidColorLayer::Create(); |
| 4727 layer_->SetIsDrawable(true); | 4774 layer_->SetIsDrawable(true); |
| 4728 layer_->SetBounds(gfx::Size(10, 10)); | 4775 layer_->SetBounds(gfx::Size(10, 10)); |
| 4729 layer_tree()->SetRootLayer(layer_); | 4776 layer_tree_host()->SetRootLayer(layer_); |
| 4730 gfx::Size bounds(100, 100); | 4777 gfx::Size bounds(100, 100); |
| 4731 layer_tree()->SetViewportSize(bounds); | 4778 layer_tree_host()->SetViewportSize(bounds); |
| 4732 PostSetNeedsCommitToMainThread(); | 4779 PostSetNeedsCommitToMainThread(); |
| 4733 } | 4780 } |
| 4734 | 4781 |
| 4735 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { | 4782 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { |
| 4736 // Safe to check frame number here because main thread is blocked. | 4783 // Safe to check frame number here because main thread is blocked. |
| 4737 if (layer_tree_host()->source_frame_number() == 0) { | 4784 if (layer_tree_host()->source_frame_number() == 0) { |
| 4738 host_impl->BlockNotifyReadyToActivateForTesting(true); | 4785 host_impl->BlockNotifyReadyToActivateForTesting(true); |
| 4739 } else { | 4786 } else { |
| 4740 NOTREACHED(); | 4787 NOTREACHED(); |
| 4741 } | 4788 } |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4998 }; | 5045 }; |
| 4999 | 5046 |
| 5000 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor); | 5047 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor); |
| 5001 | 5048 |
| 5002 class LayerTreeHostTestHighResRequiredAfterEvictingUIResources | 5049 class LayerTreeHostTestHighResRequiredAfterEvictingUIResources |
| 5003 : public LayerTreeHostTest { | 5050 : public LayerTreeHostTest { |
| 5004 protected: | 5051 protected: |
| 5005 void SetupTree() override { | 5052 void SetupTree() override { |
| 5006 LayerTreeHostTest::SetupTree(); | 5053 LayerTreeHostTest::SetupTree(); |
| 5007 ui_resource_ = FakeScopedUIResource::Create(layer_tree_host()); | 5054 ui_resource_ = FakeScopedUIResource::Create(layer_tree_host()); |
| 5008 client_.set_bounds(layer_tree()->root_layer()->bounds()); | 5055 client_.set_bounds(layer_tree_host()->root_layer()->bounds()); |
| 5009 } | 5056 } |
| 5010 | 5057 |
| 5011 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5058 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 5012 | 5059 |
| 5013 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 5060 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
| 5014 host_impl->EvictAllUIResources(); | 5061 host_impl->EvictAllUIResources(); |
| 5015 // Existence of evicted UI resources will trigger NEW_CONTENT_TAKES_PRIORITY | 5062 // Existence of evicted UI resources will trigger NEW_CONTENT_TAKES_PRIORITY |
| 5016 // mode. Active tree should require high-res to draw after entering this | 5063 // mode. Active tree should require high-res to draw after entering this |
| 5017 // mode to ensure that high-res tiles are also required for a pending tree | 5064 // mode to ensure that high-res tiles are also required for a pending tree |
| 5018 // to be activated. | 5065 // to be activated. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5054 std::unique_ptr<FakeRecordingSource> recording_source( | 5101 std::unique_ptr<FakeRecordingSource> recording_source( |
| 5055 new FakeRecordingSource); | 5102 new FakeRecordingSource); |
| 5056 recording_source_ = recording_source.get(); | 5103 recording_source_ = recording_source.get(); |
| 5057 | 5104 |
| 5058 scoped_refptr<FakePictureLayer> layer = | 5105 scoped_refptr<FakePictureLayer> layer = |
| 5059 FakePictureLayer::CreateWithRecordingSource( | 5106 FakePictureLayer::CreateWithRecordingSource( |
| 5060 &layer_client_, std::move(recording_source)); | 5107 &layer_client_, std::move(recording_source)); |
| 5061 layer_ = layer.get(); | 5108 layer_ = layer.get(); |
| 5062 layer->SetBounds(gfx::Size(10, 10)); | 5109 layer->SetBounds(gfx::Size(10, 10)); |
| 5063 layer->SetIsDrawable(true); | 5110 layer->SetIsDrawable(true); |
| 5064 layer_tree()->root_layer()->AddChild(layer); | 5111 layer_tree_host()->root_layer()->AddChild(layer); |
| 5065 layer_client_.set_bounds(layer_->bounds()); | 5112 layer_client_.set_bounds(layer_->bounds()); |
| 5066 } | 5113 } |
| 5067 | 5114 |
| 5068 void BeginTest() override { | 5115 void BeginTest() override { |
| 5069 // Verify default value. | 5116 // Verify default value. |
| 5070 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5117 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| 5071 | 5118 |
| 5072 // Setting gpu rasterization trigger does not enable gpu rasterization. | 5119 // Setting gpu rasterization trigger does not enable gpu rasterization. |
| 5073 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 5120 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
| 5074 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5121 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5108 std::unique_ptr<FakeRecordingSource> recording_source( | 5155 std::unique_ptr<FakeRecordingSource> recording_source( |
| 5109 new FakeRecordingSource); | 5156 new FakeRecordingSource); |
| 5110 recording_source_ = recording_source.get(); | 5157 recording_source_ = recording_source.get(); |
| 5111 | 5158 |
| 5112 scoped_refptr<FakePictureLayer> layer = | 5159 scoped_refptr<FakePictureLayer> layer = |
| 5113 FakePictureLayer::CreateWithRecordingSource( | 5160 FakePictureLayer::CreateWithRecordingSource( |
| 5114 &layer_client_, std::move(recording_source)); | 5161 &layer_client_, std::move(recording_source)); |
| 5115 layer_ = layer.get(); | 5162 layer_ = layer.get(); |
| 5116 layer->SetBounds(gfx::Size()); | 5163 layer->SetBounds(gfx::Size()); |
| 5117 layer->SetIsDrawable(true); | 5164 layer->SetIsDrawable(true); |
| 5118 layer_tree()->root_layer()->AddChild(layer); | 5165 layer_tree_host()->root_layer()->AddChild(layer); |
| 5119 layer_client_.set_bounds(layer->bounds()); | 5166 layer_client_.set_bounds(layer->bounds()); |
| 5120 } | 5167 } |
| 5121 | 5168 |
| 5122 void BeginTest() override { | 5169 void BeginTest() override { |
| 5123 // Setting gpu rasterization trigger does not enable gpu rasterization. | 5170 // Setting gpu rasterization trigger does not enable gpu rasterization. |
| 5124 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 5171 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
| 5125 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5172 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| 5126 | 5173 |
| 5127 PostSetNeedsCommitToMainThread(); | 5174 PostSetNeedsCommitToMainThread(); |
| 5128 } | 5175 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5164 std::unique_ptr<FakeRecordingSource> recording_source( | 5211 std::unique_ptr<FakeRecordingSource> recording_source( |
| 5165 new FakeRecordingSource); | 5212 new FakeRecordingSource); |
| 5166 recording_source_ = recording_source.get(); | 5213 recording_source_ = recording_source.get(); |
| 5167 | 5214 |
| 5168 scoped_refptr<FakePictureLayer> layer = | 5215 scoped_refptr<FakePictureLayer> layer = |
| 5169 FakePictureLayer::CreateWithRecordingSource( | 5216 FakePictureLayer::CreateWithRecordingSource( |
| 5170 &layer_client_, std::move(recording_source)); | 5217 &layer_client_, std::move(recording_source)); |
| 5171 layer_ = layer.get(); | 5218 layer_ = layer.get(); |
| 5172 layer->SetBounds(gfx::Size(10, 10)); | 5219 layer->SetBounds(gfx::Size(10, 10)); |
| 5173 layer->SetIsDrawable(true); | 5220 layer->SetIsDrawable(true); |
| 5174 layer_tree()->root_layer()->AddChild(layer); | 5221 layer_tree_host()->root_layer()->AddChild(layer); |
| 5175 layer_client_.set_bounds(layer_->bounds()); | 5222 layer_client_.set_bounds(layer_->bounds()); |
| 5176 } | 5223 } |
| 5177 | 5224 |
| 5178 void BeginTest() override { | 5225 void BeginTest() override { |
| 5179 // Verify default value. | 5226 // Verify default value. |
| 5180 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5227 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| 5181 | 5228 |
| 5182 // Gpu rasterization trigger is relevant. | 5229 // Gpu rasterization trigger is relevant. |
| 5183 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 5230 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
| 5184 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5231 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5234 std::unique_ptr<FakeRecordingSource> recording_source( | 5281 std::unique_ptr<FakeRecordingSource> recording_source( |
| 5235 new FakeRecordingSource); | 5282 new FakeRecordingSource); |
| 5236 recording_source_ = recording_source.get(); | 5283 recording_source_ = recording_source.get(); |
| 5237 | 5284 |
| 5238 scoped_refptr<FakePictureLayer> layer = | 5285 scoped_refptr<FakePictureLayer> layer = |
| 5239 FakePictureLayer::CreateWithRecordingSource( | 5286 FakePictureLayer::CreateWithRecordingSource( |
| 5240 &layer_client_, std::move(recording_source)); | 5287 &layer_client_, std::move(recording_source)); |
| 5241 layer_ = layer.get(); | 5288 layer_ = layer.get(); |
| 5242 layer->SetBounds(gfx::Size(10, 10)); | 5289 layer->SetBounds(gfx::Size(10, 10)); |
| 5243 layer->SetIsDrawable(true); | 5290 layer->SetIsDrawable(true); |
| 5244 layer_tree()->root_layer()->AddChild(layer); | 5291 layer_tree_host()->root_layer()->AddChild(layer); |
| 5245 layer_client_.set_bounds(layer_->bounds()); | 5292 layer_client_.set_bounds(layer_->bounds()); |
| 5246 } | 5293 } |
| 5247 | 5294 |
| 5248 void BeginTest() override { | 5295 void BeginTest() override { |
| 5249 // Verify default value. | 5296 // Verify default value. |
| 5250 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5297 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| 5251 | 5298 |
| 5252 // Gpu rasterization trigger is relevant. | 5299 // Gpu rasterization trigger is relevant. |
| 5253 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 5300 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
| 5254 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5301 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5317 new FakeRecordingSource); | 5364 new FakeRecordingSource); |
| 5318 recording_source_ = recording_source.get(); | 5365 recording_source_ = recording_source.get(); |
| 5319 | 5366 |
| 5320 scoped_refptr<FakePictureLayer> layer = | 5367 scoped_refptr<FakePictureLayer> layer = |
| 5321 FakePictureLayer::CreateWithRecordingSource( | 5368 FakePictureLayer::CreateWithRecordingSource( |
| 5322 &layer_client_, std::move(recording_source)); | 5369 &layer_client_, std::move(recording_source)); |
| 5323 layer_ = layer.get(); | 5370 layer_ = layer.get(); |
| 5324 | 5371 |
| 5325 layer->SetBounds(gfx::Size(10, 10)); | 5372 layer->SetBounds(gfx::Size(10, 10)); |
| 5326 layer->SetIsDrawable(true); | 5373 layer->SetIsDrawable(true); |
| 5327 layer_tree()->root_layer()->AddChild(layer); | 5374 layer_tree_host()->root_layer()->AddChild(layer); |
| 5328 layer_client_.set_bounds(layer_->bounds()); | 5375 layer_client_.set_bounds(layer_->bounds()); |
| 5329 } | 5376 } |
| 5330 | 5377 |
| 5331 void BeginTest() override { | 5378 void BeginTest() override { |
| 5332 // Verify default value. | 5379 // Verify default value. |
| 5333 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5380 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| 5334 | 5381 |
| 5335 // With gpu rasterization forced, gpu rasterization trigger is irrelevant. | 5382 // With gpu rasterization forced, gpu rasterization trigger is irrelevant. |
| 5336 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 5383 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
| 5337 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 5384 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5653 | 5700 |
| 5654 // Make sure page scale and top control deltas are applied to the client even | 5701 // Make sure page scale and top control deltas are applied to the client even |
| 5655 // when the LayerTreeHost doesn't have a root layer. | 5702 // when the LayerTreeHost doesn't have a root layer. |
| 5656 class LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer | 5703 class LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer |
| 5657 : public LayerTreeHostTest { | 5704 : public LayerTreeHostTest { |
| 5658 public: | 5705 public: |
| 5659 LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer() | 5706 LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer() |
| 5660 : deltas_sent_to_client_(false) {} | 5707 : deltas_sent_to_client_(false) {} |
| 5661 | 5708 |
| 5662 void BeginTest() override { | 5709 void BeginTest() override { |
| 5663 layer_tree()->SetRootLayer(nullptr); | 5710 layer_tree_host()->SetRootLayer(nullptr); |
| 5664 info_.page_scale_delta = 3.14f; | 5711 info_.page_scale_delta = 3.14f; |
| 5665 info_.top_controls_delta = 2.73f; | 5712 info_.top_controls_delta = 2.73f; |
| 5666 | 5713 |
| 5667 PostSetNeedsCommitToMainThread(); | 5714 PostSetNeedsCommitToMainThread(); |
| 5668 } | 5715 } |
| 5669 | 5716 |
| 5670 void BeginMainFrame(const BeginFrameArgs& args) override { | 5717 void BeginMainFrame(const BeginFrameArgs& args) override { |
| 5671 EXPECT_EQ(nullptr, layer_tree()->root_layer()); | 5718 EXPECT_EQ(nullptr, layer_tree_host()->root_layer()); |
| 5672 | 5719 |
| 5673 layer_tree_host()->ApplyScrollAndScale(&info_); | 5720 layer_tree_host()->ApplyScrollAndScale(&info_); |
| 5674 EndTest(); | 5721 EndTest(); |
| 5675 } | 5722 } |
| 5676 | 5723 |
| 5677 void ApplyViewportDeltas(const gfx::Vector2dF& inner, | 5724 void ApplyViewportDeltas(const gfx::Vector2dF& inner, |
| 5678 const gfx::Vector2dF& outer, | 5725 const gfx::Vector2dF& outer, |
| 5679 const gfx::Vector2dF& elastic_overscroll_delta, | 5726 const gfx::Vector2dF& elastic_overscroll_delta, |
| 5680 float scale_delta, | 5727 float scale_delta, |
| 5681 float top_controls_delta) override { | 5728 float top_controls_delta) override { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5719 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); | 5766 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); |
| 5720 scoped_refptr<FakePictureLayer> layer = | 5767 scoped_refptr<FakePictureLayer> layer = |
| 5721 FakePictureLayer::CreateWithRecordingSource(&client_, | 5768 FakePictureLayer::CreateWithRecordingSource(&client_, |
| 5722 std::move(recording)); | 5769 std::move(recording)); |
| 5723 layer->SetBounds(gfx::Size(500, 500)); | 5770 layer->SetBounds(gfx::Size(500, 500)); |
| 5724 layer->SetContentsOpaque(true); | 5771 layer->SetContentsOpaque(true); |
| 5725 // Avoid LCD text on the layer so we don't cause extra commits when we | 5772 // Avoid LCD text on the layer so we don't cause extra commits when we |
| 5726 // pinch. | 5773 // pinch. |
| 5727 pinch->AddChild(layer); | 5774 pinch->AddChild(layer); |
| 5728 | 5775 |
| 5729 layer_tree()->RegisterViewportLayers(NULL, page_scale_layer, pinch, | 5776 layer_tree_host()->RegisterViewportLayers(NULL, page_scale_layer, pinch, |
| 5730 nullptr); | 5777 nullptr); |
| 5731 layer_tree()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); | 5778 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); |
| 5732 layer_tree()->SetRootLayer(root_clip); | 5779 layer_tree_host()->SetRootLayer(root_clip); |
| 5733 LayerTreeHostTest::SetupTree(); | 5780 LayerTreeHostTest::SetupTree(); |
| 5734 client_.set_bounds(root_clip->bounds()); | 5781 client_.set_bounds(root_clip->bounds()); |
| 5735 } | 5782 } |
| 5736 | 5783 |
| 5737 // Returns the delta scale of all quads in the frame's root pass from their | 5784 // Returns the delta scale of all quads in the frame's root pass from their |
| 5738 // ideal, or 0 if they are not all the same. | 5785 // ideal, or 0 if they are not all the same. |
| 5739 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { | 5786 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { |
| 5740 if (frame_data->has_no_damage) | 5787 if (frame_data->has_no_damage) |
| 5741 return 0.f; | 5788 return 0.f; |
| 5742 float frame_scale = 0.f; | 5789 float frame_scale = 0.f; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5920 client_.set_bounds(root->bounds()); | 5967 client_.set_bounds(root->bounds()); |
| 5921 | 5968 |
| 5922 std::unique_ptr<FakeRecordingSource> recording(new FakeRecordingSource); | 5969 std::unique_ptr<FakeRecordingSource> recording(new FakeRecordingSource); |
| 5923 scoped_refptr<FakePictureLayer> layer = | 5970 scoped_refptr<FakePictureLayer> layer = |
| 5924 FakePictureLayer::CreateWithRecordingSource(&client_, | 5971 FakePictureLayer::CreateWithRecordingSource(&client_, |
| 5925 std::move(recording)); | 5972 std::move(recording)); |
| 5926 layer->SetBounds(gfx::Size(500, 500)); | 5973 layer->SetBounds(gfx::Size(500, 500)); |
| 5927 layer->SetContentsOpaque(true); | 5974 layer->SetContentsOpaque(true); |
| 5928 root->AddChild(layer); | 5975 root->AddChild(layer); |
| 5929 | 5976 |
| 5930 layer_tree()->SetRootLayer(root); | 5977 layer_tree_host()->SetRootLayer(root); |
| 5931 LayerTreeHostTest::SetupTree(); | 5978 LayerTreeHostTest::SetupTree(); |
| 5932 client_.set_bounds(root->bounds()); | 5979 client_.set_bounds(root->bounds()); |
| 5933 } | 5980 } |
| 5934 | 5981 |
| 5935 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5982 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 5936 | 5983 |
| 5937 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 5984 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 5938 LayerTreeHostImpl::FrameData* frame_data, | 5985 LayerTreeHostImpl::FrameData* frame_data, |
| 5939 DrawResult draw_result) override { | 5986 DrawResult draw_result) override { |
| 5940 EXPECT_NE(0u, host_impl->resource_provider()->num_resources()); | 5987 EXPECT_NE(0u, host_impl->resource_provider()->num_resources()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 5961 client_.set_fill_with_nonsolid_color(true); | 6008 client_.set_fill_with_nonsolid_color(true); |
| 5962 | 6009 |
| 5963 std::unique_ptr<FakeRecordingSource> recording(new FakeRecordingSource); | 6010 std::unique_ptr<FakeRecordingSource> recording(new FakeRecordingSource); |
| 5964 scoped_refptr<FakePictureLayer> root = | 6011 scoped_refptr<FakePictureLayer> root = |
| 5965 FakePictureLayer::CreateWithRecordingSource(&client_, | 6012 FakePictureLayer::CreateWithRecordingSource(&client_, |
| 5966 std::move(recording)); | 6013 std::move(recording)); |
| 5967 root->SetBounds(gfx::Size(10000, 10000)); | 6014 root->SetBounds(gfx::Size(10000, 10000)); |
| 5968 client_.set_bounds(root->bounds()); | 6015 client_.set_bounds(root->bounds()); |
| 5969 root->SetContentsOpaque(true); | 6016 root->SetContentsOpaque(true); |
| 5970 | 6017 |
| 5971 layer_tree()->SetRootLayer(root); | 6018 layer_tree_host()->SetRootLayer(root); |
| 5972 LayerTreeHostTest::SetupTree(); | 6019 LayerTreeHostTest::SetupTree(); |
| 5973 layer_tree()->SetViewportSize(viewport_size_); | 6020 layer_tree_host()->SetViewportSize(viewport_size_); |
| 5974 client_.set_bounds(root->bounds()); | 6021 client_.set_bounds(root->bounds()); |
| 5975 } | 6022 } |
| 5976 | 6023 |
| 5977 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6024 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 5978 | 6025 |
| 5979 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6026 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 5980 LayerTreeHostImpl::FrameData* frame_data, | 6027 LayerTreeHostImpl::FrameData* frame_data, |
| 5981 DrawResult draw_result) override { | 6028 DrawResult draw_result) override { |
| 5982 EXPECT_EQ(10u, host_impl->resource_provider()->num_resources()); | 6029 EXPECT_EQ(10u, host_impl->resource_provider()->num_resources()); |
| 5983 EndTest(); | 6030 EndTest(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6021 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); | 6068 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); |
| 6022 scoped_refptr<FakePictureLayer> layer = | 6069 scoped_refptr<FakePictureLayer> layer = |
| 6023 FakePictureLayer::CreateWithRecordingSource(&client_, | 6070 FakePictureLayer::CreateWithRecordingSource(&client_, |
| 6024 std::move(recording)); | 6071 std::move(recording)); |
| 6025 layer->SetBounds(gfx::Size(500, 500)); | 6072 layer->SetBounds(gfx::Size(500, 500)); |
| 6026 layer->SetContentsOpaque(true); | 6073 layer->SetContentsOpaque(true); |
| 6027 // Avoid LCD text on the layer so we don't cause extra commits when we | 6074 // Avoid LCD text on the layer so we don't cause extra commits when we |
| 6028 // pinch. | 6075 // pinch. |
| 6029 pinch->AddChild(layer); | 6076 pinch->AddChild(layer); |
| 6030 | 6077 |
| 6031 layer_tree()->RegisterViewportLayers(NULL, page_scale_layer, pinch, | 6078 layer_tree_host()->RegisterViewportLayers(NULL, page_scale_layer, pinch, |
| 6032 nullptr); | 6079 nullptr); |
| 6033 layer_tree()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); | 6080 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); |
| 6034 layer_tree()->SetRootLayer(root_clip); | 6081 layer_tree_host()->SetRootLayer(root_clip); |
| 6035 LayerTreeHostTest::SetupTree(); | 6082 LayerTreeHostTest::SetupTree(); |
| 6036 client_.set_bounds(root_clip->bounds()); | 6083 client_.set_bounds(root_clip->bounds()); |
| 6037 } | 6084 } |
| 6038 | 6085 |
| 6039 // Returns the delta scale of all quads in the frame's root pass from their | 6086 // Returns the delta scale of all quads in the frame's root pass from their |
| 6040 // ideal, or 0 if they are not all the same. | 6087 // ideal, or 0 if they are not all the same. |
| 6041 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { | 6088 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { |
| 6042 if (frame_data->has_no_damage) | 6089 if (frame_data->has_no_damage) |
| 6043 return 0.f; | 6090 return 0.f; |
| 6044 float frame_scale = 0.f; | 6091 float frame_scale = 0.f; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6178 : notify_ready_to_activate_count_(0u), | 6225 : notify_ready_to_activate_count_(0u), |
| 6179 scheduled_prepare_tiles_count_(0) {} | 6226 scheduled_prepare_tiles_count_(0) {} |
| 6180 | 6227 |
| 6181 void SetupTree() override { | 6228 void SetupTree() override { |
| 6182 client_.set_fill_with_nonsolid_color(true); | 6229 client_.set_fill_with_nonsolid_color(true); |
| 6183 scoped_refptr<FakePictureLayer> root_layer = | 6230 scoped_refptr<FakePictureLayer> root_layer = |
| 6184 FakePictureLayer::Create(&client_); | 6231 FakePictureLayer::Create(&client_); |
| 6185 root_layer->SetBounds(gfx::Size(1500, 1500)); | 6232 root_layer->SetBounds(gfx::Size(1500, 1500)); |
| 6186 root_layer->SetIsDrawable(true); | 6233 root_layer->SetIsDrawable(true); |
| 6187 | 6234 |
| 6188 layer_tree()->SetRootLayer(root_layer); | 6235 layer_tree_host()->SetRootLayer(root_layer); |
| 6189 LayerTreeHostTest::SetupTree(); | 6236 LayerTreeHostTest::SetupTree(); |
| 6190 client_.set_bounds(root_layer->bounds()); | 6237 client_.set_bounds(root_layer->bounds()); |
| 6191 } | 6238 } |
| 6192 | 6239 |
| 6193 void BeginTest() override { | 6240 void BeginTest() override { |
| 6194 layer_tree()->SetViewportSize(gfx::Size(16, 16)); | 6241 layer_tree_host()->SetViewportSize(gfx::Size(16, 16)); |
| 6195 PostSetNeedsCommitToMainThread(); | 6242 PostSetNeedsCommitToMainThread(); |
| 6196 } | 6243 } |
| 6197 | 6244 |
| 6198 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, | 6245 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, |
| 6199 bool success) override { | 6246 bool success) override { |
| 6200 ASSERT_TRUE(success); | 6247 ASSERT_TRUE(success); |
| 6201 host_impl->tile_manager()->SetScheduledRasterTaskLimitForTesting(1); | 6248 host_impl->tile_manager()->SetScheduledRasterTaskLimitForTesting(1); |
| 6202 } | 6249 } |
| 6203 | 6250 |
| 6204 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { | 6251 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 6234 LayerTreeHostTestActivationCausesPrepareTiles() | 6281 LayerTreeHostTestActivationCausesPrepareTiles() |
| 6235 : scheduled_prepare_tiles_count_(0) {} | 6282 : scheduled_prepare_tiles_count_(0) {} |
| 6236 | 6283 |
| 6237 void SetupTree() override { | 6284 void SetupTree() override { |
| 6238 client_.set_fill_with_nonsolid_color(true); | 6285 client_.set_fill_with_nonsolid_color(true); |
| 6239 scoped_refptr<FakePictureLayer> root_layer = | 6286 scoped_refptr<FakePictureLayer> root_layer = |
| 6240 FakePictureLayer::Create(&client_); | 6287 FakePictureLayer::Create(&client_); |
| 6241 root_layer->SetBounds(gfx::Size(150, 150)); | 6288 root_layer->SetBounds(gfx::Size(150, 150)); |
| 6242 root_layer->SetIsDrawable(true); | 6289 root_layer->SetIsDrawable(true); |
| 6243 | 6290 |
| 6244 layer_tree()->SetRootLayer(root_layer); | 6291 layer_tree_host()->SetRootLayer(root_layer); |
| 6245 LayerTreeHostTest::SetupTree(); | 6292 LayerTreeHostTest::SetupTree(); |
| 6246 client_.set_bounds(root_layer->bounds()); | 6293 client_.set_bounds(root_layer->bounds()); |
| 6247 } | 6294 } |
| 6248 | 6295 |
| 6249 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6296 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 6250 | 6297 |
| 6251 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { | 6298 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { |
| 6252 // Ensure we've already activated. | 6299 // Ensure we've already activated. |
| 6253 EXPECT_FALSE(impl->pending_tree()); | 6300 EXPECT_FALSE(impl->pending_tree()); |
| 6254 | 6301 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6312 }; | 6359 }; |
| 6313 | 6360 |
| 6314 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); | 6361 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); |
| 6315 | 6362 |
| 6316 class LayerTreeHostTestUpdateCopyRequests : public LayerTreeHostTest { | 6363 class LayerTreeHostTestUpdateCopyRequests : public LayerTreeHostTest { |
| 6317 protected: | 6364 protected: |
| 6318 void SetupTree() override { | 6365 void SetupTree() override { |
| 6319 root = Layer::Create(); | 6366 root = Layer::Create(); |
| 6320 child = Layer::Create(); | 6367 child = Layer::Create(); |
| 6321 root->AddChild(child); | 6368 root->AddChild(child); |
| 6322 layer_tree()->SetRootLayer(root); | 6369 layer_tree_host()->SetRootLayer(root); |
| 6323 LayerTreeHostTest::SetupTree(); | 6370 LayerTreeHostTest::SetupTree(); |
| 6324 } | 6371 } |
| 6325 | 6372 |
| 6326 static void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} | 6373 static void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} |
| 6327 | 6374 |
| 6328 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6375 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 6329 | 6376 |
| 6330 void WillCommit() override { | 6377 void WillCommit() override { |
| 6331 switch (layer_tree_host()->source_frame_number()) { | 6378 switch (layer_tree_host()->source_frame_number()) { |
| 6332 case 1: | 6379 case 1: |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6407 clipping_origin.OffsetFromOrigin()); | 6454 clipping_origin.OffsetFromOrigin()); |
| 6408 | 6455 |
| 6409 gfx::Size child_size(50, 50); | 6456 gfx::Size child_size(50, 50); |
| 6410 content_child_layer->SetBounds(child_size); | 6457 content_child_layer->SetBounds(child_size); |
| 6411 content_child_layer->SetPosition(gfx::PointF(20.f, 0.f)); | 6458 content_child_layer->SetPosition(gfx::PointF(20.f, 0.f)); |
| 6412 | 6459 |
| 6413 gfx::Size mask_size(100, 100); | 6460 gfx::Size mask_size(100, 100); |
| 6414 mask_layer->SetBounds(mask_size); | 6461 mask_layer->SetBounds(mask_size); |
| 6415 mask_layer->SetIsMask(true); | 6462 mask_layer->SetIsMask(true); |
| 6416 | 6463 |
| 6417 layer_tree()->SetRootLayer(root); | 6464 layer_tree_host()->SetRootLayer(root); |
| 6418 LayerTreeTest::SetupTree(); | 6465 LayerTreeTest::SetupTree(); |
| 6419 client_.set_bounds(root->bounds()); | 6466 client_.set_bounds(root->bounds()); |
| 6420 } | 6467 } |
| 6421 | 6468 |
| 6422 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6469 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 6423 | 6470 |
| 6424 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6471 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 6425 LayerTreeHostImpl::FrameData* frame_data, | 6472 LayerTreeHostImpl::FrameData* frame_data, |
| 6426 DrawResult draw_result) override { | 6473 DrawResult draw_result) override { |
| 6427 EXPECT_EQ(2u, frame_data->render_passes.size()); | 6474 EXPECT_EQ(2u, frame_data->render_passes.size()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6492 scaling_layer->SetBounds(scaling_layer_size); | 6539 scaling_layer->SetBounds(scaling_layer_size); |
| 6493 gfx::Transform scale; | 6540 gfx::Transform scale; |
| 6494 scale.Scale(2.f, 2.f); | 6541 scale.Scale(2.f, 2.f); |
| 6495 scaling_layer->SetTransform(scale); | 6542 scaling_layer->SetTransform(scale); |
| 6496 | 6543 |
| 6497 content_layer->SetBounds(scaling_layer_size); | 6544 content_layer->SetBounds(scaling_layer_size); |
| 6498 | 6545 |
| 6499 mask_layer->SetBounds(scaling_layer_size); | 6546 mask_layer->SetBounds(scaling_layer_size); |
| 6500 mask_layer->SetIsMask(true); | 6547 mask_layer->SetIsMask(true); |
| 6501 | 6548 |
| 6502 layer_tree()->SetRootLayer(root); | 6549 layer_tree_host()->SetRootLayer(root); |
| 6503 LayerTreeTest::SetupTree(); | 6550 LayerTreeTest::SetupTree(); |
| 6504 client_.set_bounds(root->bounds()); | 6551 client_.set_bounds(root->bounds()); |
| 6505 } | 6552 } |
| 6506 | 6553 |
| 6507 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6554 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 6508 | 6555 |
| 6509 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6556 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 6510 LayerTreeHostImpl::FrameData* frame_data, | 6557 LayerTreeHostImpl::FrameData* frame_data, |
| 6511 DrawResult draw_result) override { | 6558 DrawResult draw_result) override { |
| 6512 EXPECT_EQ(2u, frame_data->render_passes.size()); | 6559 EXPECT_EQ(2u, frame_data->render_passes.size()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 6542 EndTest(); | 6589 EndTest(); |
| 6543 break; | 6590 break; |
| 6544 } | 6591 } |
| 6545 return draw_result; | 6592 return draw_result; |
| 6546 } | 6593 } |
| 6547 | 6594 |
| 6548 void DidCommit() override { | 6595 void DidCommit() override { |
| 6549 switch (layer_tree_host()->source_frame_number()) { | 6596 switch (layer_tree_host()->source_frame_number()) { |
| 6550 case 1: | 6597 case 1: |
| 6551 gfx::Size double_root_size(200, 200); | 6598 gfx::Size double_root_size(200, 200); |
| 6552 layer_tree()->SetViewportSize(double_root_size); | 6599 layer_tree_host()->SetViewportSize(double_root_size); |
| 6553 layer_tree()->SetDeviceScaleFactor(2.f); | 6600 layer_tree_host()->SetDeviceScaleFactor(2.f); |
| 6554 break; | 6601 break; |
| 6555 } | 6602 } |
| 6556 } | 6603 } |
| 6557 | 6604 |
| 6558 void AfterTest() override {} | 6605 void AfterTest() override {} |
| 6559 | 6606 |
| 6560 FakeContentLayerClient client_; | 6607 FakeContentLayerClient client_; |
| 6561 }; | 6608 }; |
| 6562 | 6609 |
| 6563 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling); | 6610 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 6581 gfx::Size root_size(100, 100); | 6628 gfx::Size root_size(100, 100); |
| 6582 root->SetBounds(root_size); | 6629 root->SetBounds(root_size); |
| 6583 | 6630 |
| 6584 gfx::Size layer_size(50, 50); | 6631 gfx::Size layer_size(50, 50); |
| 6585 content_layer->SetBounds(layer_size); | 6632 content_layer->SetBounds(layer_size); |
| 6586 | 6633 |
| 6587 gfx::Size mask_size(100, 100); | 6634 gfx::Size mask_size(100, 100); |
| 6588 mask_layer->SetBounds(mask_size); | 6635 mask_layer->SetBounds(mask_size); |
| 6589 mask_layer->SetIsMask(true); | 6636 mask_layer->SetIsMask(true); |
| 6590 | 6637 |
| 6591 layer_tree()->SetRootLayer(root); | 6638 layer_tree_host()->SetRootLayer(root); |
| 6592 LayerTreeTest::SetupTree(); | 6639 LayerTreeTest::SetupTree(); |
| 6593 client_.set_bounds(root->bounds()); | 6640 client_.set_bounds(root->bounds()); |
| 6594 } | 6641 } |
| 6595 | 6642 |
| 6596 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6643 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 6597 | 6644 |
| 6598 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6645 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 6599 LayerTreeHostImpl::FrameData* frame_data, | 6646 LayerTreeHostImpl::FrameData* frame_data, |
| 6600 DrawResult draw_result) override { | 6647 DrawResult draw_result) override { |
| 6601 EXPECT_EQ(2u, frame_data->render_passes.size()); | 6648 EXPECT_EQ(2u, frame_data->render_passes.size()); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 6630 EndTest(); | 6677 EndTest(); |
| 6631 break; | 6678 break; |
| 6632 } | 6679 } |
| 6633 return draw_result; | 6680 return draw_result; |
| 6634 } | 6681 } |
| 6635 | 6682 |
| 6636 void DidCommit() override { | 6683 void DidCommit() override { |
| 6637 switch (layer_tree_host()->source_frame_number()) { | 6684 switch (layer_tree_host()->source_frame_number()) { |
| 6638 case 1: | 6685 case 1: |
| 6639 gfx::Size double_root_size(200, 200); | 6686 gfx::Size double_root_size(200, 200); |
| 6640 layer_tree()->SetViewportSize(double_root_size); | 6687 layer_tree_host()->SetViewportSize(double_root_size); |
| 6641 layer_tree()->SetDeviceScaleFactor(2.f); | 6688 layer_tree_host()->SetDeviceScaleFactor(2.f); |
| 6642 break; | 6689 break; |
| 6643 } | 6690 } |
| 6644 } | 6691 } |
| 6645 | 6692 |
| 6646 void AfterTest() override {} | 6693 void AfterTest() override {} |
| 6647 | 6694 |
| 6648 FakeContentLayerClient client_; | 6695 FakeContentLayerClient client_; |
| 6649 }; | 6696 }; |
| 6650 | 6697 |
| 6651 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds); | 6698 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 6673 gfx::Size root_size(100, 100); | 6720 gfx::Size root_size(100, 100); |
| 6674 root->SetBounds(root_size); | 6721 root->SetBounds(root_size); |
| 6675 | 6722 |
| 6676 gfx::Size layer_size(50, 50); | 6723 gfx::Size layer_size(50, 50); |
| 6677 content_layer->SetBounds(layer_size); | 6724 content_layer->SetBounds(layer_size); |
| 6678 | 6725 |
| 6679 gfx::Size mask_size(100, 100); | 6726 gfx::Size mask_size(100, 100); |
| 6680 mask_layer->SetBounds(mask_size); | 6727 mask_layer->SetBounds(mask_size); |
| 6681 mask_layer->SetIsMask(true); | 6728 mask_layer->SetIsMask(true); |
| 6682 | 6729 |
| 6683 layer_tree()->SetRootLayer(root); | 6730 layer_tree_host()->SetRootLayer(root); |
| 6684 LayerTreeTest::SetupTree(); | 6731 LayerTreeTest::SetupTree(); |
| 6685 client_.set_bounds(root->bounds()); | 6732 client_.set_bounds(root->bounds()); |
| 6686 } | 6733 } |
| 6687 | 6734 |
| 6688 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6735 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 6689 | 6736 |
| 6690 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6737 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 6691 LayerTreeHostImpl::FrameData* frame_data, | 6738 LayerTreeHostImpl::FrameData* frame_data, |
| 6692 DrawResult draw_result) override { | 6739 DrawResult draw_result) override { |
| 6693 EXPECT_EQ(2u, frame_data->render_passes.size()); | 6740 EXPECT_EQ(2u, frame_data->render_passes.size()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 6723 EndTest(); | 6770 EndTest(); |
| 6724 break; | 6771 break; |
| 6725 } | 6772 } |
| 6726 return draw_result; | 6773 return draw_result; |
| 6727 } | 6774 } |
| 6728 | 6775 |
| 6729 void DidCommit() override { | 6776 void DidCommit() override { |
| 6730 switch (layer_tree_host()->source_frame_number()) { | 6777 switch (layer_tree_host()->source_frame_number()) { |
| 6731 case 1: | 6778 case 1: |
| 6732 gfx::Size double_root_size(200, 200); | 6779 gfx::Size double_root_size(200, 200); |
| 6733 layer_tree()->SetViewportSize(double_root_size); | 6780 layer_tree_host()->SetViewportSize(double_root_size); |
| 6734 layer_tree()->SetDeviceScaleFactor(2.f); | 6781 layer_tree_host()->SetDeviceScaleFactor(2.f); |
| 6735 break; | 6782 break; |
| 6736 } | 6783 } |
| 6737 } | 6784 } |
| 6738 | 6785 |
| 6739 void AfterTest() override {} | 6786 void AfterTest() override {} |
| 6740 | 6787 |
| 6741 FakeContentLayerClient client_; | 6788 FakeContentLayerClient client_; |
| 6742 }; | 6789 }; |
| 6743 | 6790 |
| 6744 SINGLE_AND_MULTI_THREAD_TEST_F( | 6791 SINGLE_AND_MULTI_THREAD_TEST_F( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 6772 | 6819 |
| 6773 gfx::Size layer_size(50, 50); | 6820 gfx::Size layer_size(50, 50); |
| 6774 content_layer->SetBounds(layer_size); | 6821 content_layer->SetBounds(layer_size); |
| 6775 content_child_layer_->SetBounds(layer_size); | 6822 content_child_layer_->SetBounds(layer_size); |
| 6776 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f)); | 6823 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f)); |
| 6777 | 6824 |
| 6778 gfx::Size mask_size(100, 100); | 6825 gfx::Size mask_size(100, 100); |
| 6779 mask_layer->SetBounds(mask_size); | 6826 mask_layer->SetBounds(mask_size); |
| 6780 mask_layer->SetIsMask(true); | 6827 mask_layer->SetIsMask(true); |
| 6781 | 6828 |
| 6782 layer_tree()->SetRootLayer(root); | 6829 layer_tree_host()->SetRootLayer(root); |
| 6783 LayerTreeTest::SetupTree(); | 6830 LayerTreeTest::SetupTree(); |
| 6784 client_.set_bounds(root->bounds()); | 6831 client_.set_bounds(root->bounds()); |
| 6785 } | 6832 } |
| 6786 | 6833 |
| 6787 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6834 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 6788 | 6835 |
| 6789 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6836 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 6790 LayerTreeHostImpl::FrameData* frame_data, | 6837 LayerTreeHostImpl::FrameData* frame_data, |
| 6791 DrawResult draw_result) override { | 6838 DrawResult draw_result) override { |
| 6792 EXPECT_EQ(2u, frame_data->render_passes.size()); | 6839 EXPECT_EQ(2u, frame_data->render_passes.size()); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6865 scoped_refptr<Layer> post_page_scale = Layer::Create(); | 6912 scoped_refptr<Layer> post_page_scale = Layer::Create(); |
| 6866 | 6913 |
| 6867 root->AddChild(pre_page_scale); | 6914 root->AddChild(pre_page_scale); |
| 6868 root->AddChild(page_scale); | 6915 root->AddChild(page_scale); |
| 6869 root->AddChild(post_page_scale); | 6916 root->AddChild(post_page_scale); |
| 6870 | 6917 |
| 6871 page_scale->AddChild(page_scale_child1); | 6918 page_scale->AddChild(page_scale_child1); |
| 6872 page_scale->AddChild(page_scale_child2); | 6919 page_scale->AddChild(page_scale_child2); |
| 6873 page_scale_child1->AddChild(page_scale_grandchild); | 6920 page_scale_child1->AddChild(page_scale_grandchild); |
| 6874 | 6921 |
| 6875 layer_tree()->SetRootLayer(root); | 6922 layer_tree_host()->SetRootLayer(root); |
| 6876 LayerTreeTest::SetupTree(); | 6923 LayerTreeTest::SetupTree(); |
| 6877 | 6924 |
| 6878 scoped_refptr<Layer> overscroll_elasticity_layer = nullptr; | 6925 scoped_refptr<Layer> overscroll_elasticity_layer = nullptr; |
| 6879 scoped_refptr<Layer> inner_viewport_scroll_layer = nullptr; | 6926 scoped_refptr<Layer> inner_viewport_scroll_layer = nullptr; |
| 6880 scoped_refptr<Layer> outer_viewport_scroll_layer = nullptr; | 6927 scoped_refptr<Layer> outer_viewport_scroll_layer = nullptr; |
| 6881 layer_tree()->RegisterViewportLayers( | 6928 layer_tree_host()->RegisterViewportLayers( |
| 6882 overscroll_elasticity_layer, page_scale, inner_viewport_scroll_layer, | 6929 overscroll_elasticity_layer, page_scale, inner_viewport_scroll_layer, |
| 6883 outer_viewport_scroll_layer); | 6930 outer_viewport_scroll_layer); |
| 6884 | 6931 |
| 6885 affected_by_page_scale_.push_back(page_scale->id()); | 6932 affected_by_page_scale_.push_back(page_scale->id()); |
| 6886 affected_by_page_scale_.push_back(page_scale_child1->id()); | 6933 affected_by_page_scale_.push_back(page_scale_child1->id()); |
| 6887 affected_by_page_scale_.push_back(page_scale_child2->id()); | 6934 affected_by_page_scale_.push_back(page_scale_child2->id()); |
| 6888 affected_by_page_scale_.push_back(page_scale_grandchild->id()); | 6935 affected_by_page_scale_.push_back(page_scale_grandchild->id()); |
| 6889 | 6936 |
| 6890 not_affected_by_page_scale_.push_back(root->id()); | 6937 not_affected_by_page_scale_.push_back(root->id()); |
| 6891 not_affected_by_page_scale_.push_back(pre_page_scale->id()); | 6938 not_affected_by_page_scale_.push_back(pre_page_scale->id()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6930 void AfterTest() override {} | 6977 void AfterTest() override {} |
| 6931 }; | 6978 }; |
| 6932 | 6979 |
| 6933 MULTI_THREAD_TEST_F(LayerTreeHostTestDestroyWhileInitializingOutputSurface); | 6980 MULTI_THREAD_TEST_F(LayerTreeHostTestDestroyWhileInitializingOutputSurface); |
| 6934 | 6981 |
| 6935 // Makes sure that painted_device_scale_factor is propagated to the | 6982 // Makes sure that painted_device_scale_factor is propagated to the |
| 6936 // frame's metadata. | 6983 // frame's metadata. |
| 6937 class LayerTreeHostTestPaintedDeviceScaleFactor : public LayerTreeHostTest { | 6984 class LayerTreeHostTestPaintedDeviceScaleFactor : public LayerTreeHostTest { |
| 6938 protected: | 6985 protected: |
| 6939 void BeginTest() override { | 6986 void BeginTest() override { |
| 6940 layer_tree()->SetPaintedDeviceScaleFactor(2.0f); | 6987 layer_tree_host()->SetPaintedDeviceScaleFactor(2.0f); |
| 6941 EXPECT_EQ(1.0f, layer_tree()->device_scale_factor()); | 6988 EXPECT_EQ(1.0f, layer_tree_host()->device_scale_factor()); |
| 6942 PostSetNeedsCommitToMainThread(); | 6989 PostSetNeedsCommitToMainThread(); |
| 6943 } | 6990 } |
| 6944 | 6991 |
| 6945 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 6992 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
| 6946 EXPECT_EQ(2.0f, host_impl->active_tree()->painted_device_scale_factor()); | 6993 EXPECT_EQ(2.0f, host_impl->active_tree()->painted_device_scale_factor()); |
| 6947 EXPECT_EQ(1.0f, host_impl->active_tree()->device_scale_factor()); | 6994 EXPECT_EQ(1.0f, host_impl->active_tree()->device_scale_factor()); |
| 6948 } | 6995 } |
| 6949 | 6996 |
| 6950 void DisplayReceivedCompositorFrameOnThread( | 6997 void DisplayReceivedCompositorFrameOnThread( |
| 6951 const CompositorFrame& frame) override { | 6998 const CompositorFrame& frame) override { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6991 recording->SetGenerateDiscardableImagesMetadata(true); | 7038 recording->SetGenerateDiscardableImagesMetadata(true); |
| 6992 recording->Rerecord(); | 7039 recording->Rerecord(); |
| 6993 | 7040 |
| 6994 scoped_refptr<FakePictureLayer> root = | 7041 scoped_refptr<FakePictureLayer> root = |
| 6995 FakePictureLayer::CreateWithRecordingSource(&client_, | 7042 FakePictureLayer::CreateWithRecordingSource(&client_, |
| 6996 std::move(recording)); | 7043 std::move(recording)); |
| 6997 root->SetBounds(gfx::Size(10000, 10000)); | 7044 root->SetBounds(gfx::Size(10000, 10000)); |
| 6998 client_.set_bounds(root->bounds()); | 7045 client_.set_bounds(root->bounds()); |
| 6999 root->SetContentsOpaque(true); | 7046 root->SetContentsOpaque(true); |
| 7000 | 7047 |
| 7001 layer_tree()->SetRootLayer(root); | 7048 layer_tree_host()->SetRootLayer(root); |
| 7002 LayerTreeHostTest::SetupTree(); | 7049 LayerTreeHostTest::SetupTree(); |
| 7003 layer_tree()->SetViewportSize(viewport_size_); | 7050 layer_tree_host()->SetViewportSize(viewport_size_); |
| 7004 client_.set_bounds(root->bounds()); | 7051 client_.set_bounds(root->bounds()); |
| 7005 } | 7052 } |
| 7006 | 7053 |
| 7007 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, | 7054 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, |
| 7008 bool success) override { | 7055 bool success) override { |
| 7009 // Check that our large_image_size_ is greater than max texture size. We do | 7056 // Check that our large_image_size_ is greater than max texture size. We do |
| 7010 // this here to ensure that our otuput surface exists. | 7057 // this here to ensure that our otuput surface exists. |
| 7011 | 7058 |
| 7012 // Retrieve max texture size from Skia. | 7059 // Retrieve max texture size from Skia. |
| 7013 ContextProvider* context_provider = | 7060 ContextProvider* context_provider = |
| (...skipping 17 matching lines...) Expand all Loading... |
| 7031 private: | 7078 private: |
| 7032 FakeContentLayerClient client_; | 7079 FakeContentLayerClient client_; |
| 7033 const gfx::Size viewport_size_; | 7080 const gfx::Size viewport_size_; |
| 7034 const gfx::Size large_image_size_; | 7081 const gfx::Size large_image_size_; |
| 7035 }; | 7082 }; |
| 7036 | 7083 |
| 7037 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage); | 7084 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage); |
| 7038 | 7085 |
| 7039 } // namespace | 7086 } // namespace |
| 7040 } // namespace cc | 7087 } // namespace cc |
| OLD | NEW |