Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(644)

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

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

Powered by Google App Engine
This is Rietveld 408576698