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

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

Issue 1122393003: CC: Plumb LayerSettings parameter for cc::Layer construction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 7 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestReadyToActivateEmpty); 196 SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestReadyToActivateEmpty);
197 197
198 // Test if the LTHI receives ReadyToActivate notifications from the TileManager 198 // Test if the LTHI receives ReadyToActivate notifications from the TileManager
199 // when some raster tasks flagged as REQUIRED_FOR_ACTIVATION got scheduled. 199 // when some raster tasks flagged as REQUIRED_FOR_ACTIVATION got scheduled.
200 class LayerTreeHostTestReadyToActivateNonEmpty 200 class LayerTreeHostTestReadyToActivateNonEmpty
201 : public LayerTreeHostTestReadyToActivateEmpty { 201 : public LayerTreeHostTestReadyToActivateEmpty {
202 public: 202 public:
203 void SetupTree() override { 203 void SetupTree() override {
204 client_.set_fill_with_nonsolid_color(true); 204 client_.set_fill_with_nonsolid_color(true);
205 scoped_refptr<FakePictureLayer> root_layer = 205 scoped_refptr<FakePictureLayer> root_layer =
206 FakePictureLayer::Create(&client_); 206 FakePictureLayer::Create(layer_settings(), &client_);
207 root_layer->SetBounds(gfx::Size(1024, 1024)); 207 root_layer->SetBounds(gfx::Size(1024, 1024));
208 root_layer->SetIsDrawable(true); 208 root_layer->SetIsDrawable(true);
209 209
210 layer_tree_host()->SetRootLayer(root_layer); 210 layer_tree_host()->SetRootLayer(root_layer);
211 LayerTreeHostTest::SetupTree(); 211 LayerTreeHostTest::SetupTree();
212 } 212 }
213 213
214 void AfterTest() override { 214 void AfterTest() override {
215 EXPECT_TRUE(did_notify_ready_to_activate_); 215 EXPECT_TRUE(did_notify_ready_to_activate_);
216 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); 216 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestReadyToDrawEmpty); 266 SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestReadyToDrawEmpty);
267 267
268 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when 268 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when
269 // some raster tasks flagged as REQUIRED_FOR_DRAW got scheduled. 269 // some raster tasks flagged as REQUIRED_FOR_DRAW got scheduled.
270 class LayerTreeHostTestReadyToDrawNonEmpty 270 class LayerTreeHostTestReadyToDrawNonEmpty
271 : public LayerTreeHostTestReadyToDrawEmpty { 271 : public LayerTreeHostTestReadyToDrawEmpty {
272 public: 272 public:
273 void SetupTree() override { 273 void SetupTree() override {
274 client_.set_fill_with_nonsolid_color(true); 274 client_.set_fill_with_nonsolid_color(true);
275 scoped_refptr<FakePictureLayer> root_layer = 275 scoped_refptr<FakePictureLayer> root_layer =
276 FakePictureLayer::Create(&client_); 276 FakePictureLayer::Create(layer_settings(), &client_);
277 root_layer->SetBounds(gfx::Size(1024, 1024)); 277 root_layer->SetBounds(gfx::Size(1024, 1024));
278 root_layer->SetIsDrawable(true); 278 root_layer->SetIsDrawable(true);
279 279
280 layer_tree_host()->SetRootLayer(root_layer); 280 layer_tree_host()->SetRootLayer(root_layer);
281 LayerTreeHostTest::SetupTree(); 281 LayerTreeHostTest::SetupTree();
282 } 282 }
283 283
284 void AfterTest() override { 284 void AfterTest() override {
285 EXPECT_TRUE(did_notify_ready_to_draw_); 285 EXPECT_TRUE(did_notify_ready_to_draw_);
286 EXPECT_TRUE(all_tiles_required_for_draw_are_ready_to_draw_); 286 EXPECT_TRUE(all_tiles_required_for_draw_are_ready_to_draw_);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 int num_commits_; 361 int num_commits_;
362 int num_draws_; 362 int num_draws_;
363 }; 363 };
364 364
365 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit2); 365 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit2);
366 366
367 // Verify that we pass property values in PushPropertiesTo. 367 // Verify that we pass property values in PushPropertiesTo.
368 class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest { 368 class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest {
369 protected: 369 protected:
370 void SetupTree() override { 370 void SetupTree() override {
371 scoped_refptr<Layer> root = Layer::Create(); 371 scoped_refptr<Layer> root = Layer::Create(layer_settings());
372 root->CreateRenderSurface(); 372 root->CreateRenderSurface();
373 root->SetBounds(gfx::Size(10, 10)); 373 root->SetBounds(gfx::Size(10, 10));
374 layer_tree_host()->SetRootLayer(root); 374 layer_tree_host()->SetRootLayer(root);
375 LayerTreeHostTest::SetupTree(); 375 LayerTreeHostTest::SetupTree();
376 } 376 }
377 377
378 enum Properties { 378 enum Properties {
379 STARTUP, 379 STARTUP,
380 BOUNDS, 380 BOUNDS,
381 HIDE_LAYER_AND_SUBTREE, 381 HIDE_LAYER_AND_SUBTREE,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 496
497 // After setNeedsRedrawRect(invalid_rect) the final damage_rect 497 // After setNeedsRedrawRect(invalid_rect) the final damage_rect
498 // must contain invalid_rect. 498 // must contain invalid_rect.
499 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { 499 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest {
500 public: 500 public:
501 LayerTreeHostTestSetNeedsRedrawRect() 501 LayerTreeHostTestSetNeedsRedrawRect()
502 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} 502 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {}
503 503
504 void BeginTest() override { 504 void BeginTest() override {
505 if (layer_tree_host()->settings().impl_side_painting) 505 if (layer_tree_host()->settings().impl_side_painting)
506 root_layer_ = FakePictureLayer::Create(&client_); 506 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
507 else 507 else
508 root_layer_ = ContentLayer::Create(&client_); 508 root_layer_ = ContentLayer::Create(layer_settings(), &client_);
509 root_layer_->SetIsDrawable(true); 509 root_layer_->SetIsDrawable(true);
510 root_layer_->SetBounds(bounds_); 510 root_layer_->SetBounds(bounds_);
511 layer_tree_host()->SetRootLayer(root_layer_); 511 layer_tree_host()->SetRootLayer(root_layer_);
512 layer_tree_host()->SetViewportSize(bounds_); 512 layer_tree_host()->SetViewportSize(bounds_);
513 PostSetNeedsCommitToMainThread(); 513 PostSetNeedsCommitToMainThread();
514 } 514 }
515 515
516 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 516 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
517 LayerTreeHostImpl::FrameData* frame_data, 517 LayerTreeHostImpl::FrameData* frame_data,
518 DrawResult draw_result) override { 518 DrawResult draw_result) override {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 556
557 // Ensure the texture size of the pending and active trees are identical when a 557 // Ensure the texture size of the pending and active trees are identical when a
558 // layer is not in the viewport and a resize happens on the viewport 558 // layer is not in the viewport and a resize happens on the viewport
559 class LayerTreeHostTestGpuRasterDeviceSizeChanged : public LayerTreeHostTest { 559 class LayerTreeHostTestGpuRasterDeviceSizeChanged : public LayerTreeHostTest {
560 public: 560 public:
561 LayerTreeHostTestGpuRasterDeviceSizeChanged() 561 LayerTreeHostTestGpuRasterDeviceSizeChanged()
562 : num_draws_(0), bounds_(500, 64), invalid_rect_(10, 10, 20, 20) {} 562 : num_draws_(0), bounds_(500, 64), invalid_rect_(10, 10, 20, 20) {}
563 563
564 void BeginTest() override { 564 void BeginTest() override {
565 client_.set_fill_with_nonsolid_color(true); 565 client_.set_fill_with_nonsolid_color(true);
566 root_layer_ = FakePictureLayer::Create(&client_); 566 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
567 root_layer_->SetIsDrawable(true); 567 root_layer_->SetIsDrawable(true);
568 gfx::Transform transform; 568 gfx::Transform transform;
569 // Translate the layer out of the viewport to force it to not update its 569 // Translate the layer out of the viewport to force it to not update its
570 // tile size via PushProperties. 570 // tile size via PushProperties.
571 transform.Translate(10000.0, 10000.0); 571 transform.Translate(10000.0, 10000.0);
572 root_layer_->SetTransform(transform); 572 root_layer_->SetTransform(transform);
573 root_layer_->SetBounds(bounds_); 573 root_layer_->SetBounds(bounds_);
574 layer_tree_host()->SetRootLayer(root_layer_); 574 layer_tree_host()->SetRootLayer(root_layer_);
575 layer_tree_host()->SetViewportSize(bounds_); 575 layer_tree_host()->SetViewportSize(bounds_);
576 576
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 SINGLE_AND_MULTI_THREAD_IMPL_TEST_F( 634 SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(
635 LayerTreeHostTestGpuRasterDeviceSizeChanged); 635 LayerTreeHostTestGpuRasterDeviceSizeChanged);
636 636
637 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest { 637 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest {
638 public: 638 public:
639 void InitializeSettings(LayerTreeSettings* settings) override { 639 void InitializeSettings(LayerTreeSettings* settings) override {
640 settings->layer_transforms_should_scale_layer_contents = true; 640 settings->layer_transforms_should_scale_layer_contents = true;
641 } 641 }
642 642
643 void SetupTree() override { 643 void SetupTree() override {
644 root_layer_ = Layer::Create(); 644 root_layer_ = Layer::Create(layer_settings());
645 root_layer_->SetBounds(gfx::Size(10, 20)); 645 root_layer_->SetBounds(gfx::Size(10, 20));
646 root_layer_->CreateRenderSurface(); 646 root_layer_->CreateRenderSurface();
647 647
648 if (layer_tree_host()->settings().impl_side_painting) 648 if (layer_tree_host()->settings().impl_side_painting)
649 scaled_layer_ = FakePictureLayer::Create(&client_); 649 scaled_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
650 else 650 else
651 scaled_layer_ = FakeContentLayer::Create(&client_); 651 scaled_layer_ = FakeContentLayer::Create(layer_settings(), &client_);
652 scaled_layer_->SetBounds(gfx::Size(1, 1)); 652 scaled_layer_->SetBounds(gfx::Size(1, 1));
653 root_layer_->AddChild(scaled_layer_); 653 root_layer_->AddChild(scaled_layer_);
654 654
655 layer_tree_host()->SetRootLayer(root_layer_); 655 layer_tree_host()->SetRootLayer(root_layer_);
656 LayerTreeHostTest::SetupTree(); 656 LayerTreeHostTest::SetupTree();
657 } 657 }
658 658
659 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 659 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
660 660
661 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 661 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
(...skipping 26 matching lines...) Expand all
688 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate); 688 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate);
689 689
690 class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate 690 class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate
691 : public LayerTreeHostTest { 691 : public LayerTreeHostTest {
692 public: 692 public:
693 void InitializeSettings(LayerTreeSettings* settings) override { 693 void InitializeSettings(LayerTreeSettings* settings) override {
694 settings->layer_transforms_should_scale_layer_contents = true; 694 settings->layer_transforms_should_scale_layer_contents = true;
695 } 695 }
696 696
697 void SetupTree() override { 697 void SetupTree() override {
698 root_layer_ = Layer::Create(); 698 root_layer_ = Layer::Create(layer_settings());
699 root_layer_->SetBounds(gfx::Size(10, 20)); 699 root_layer_->SetBounds(gfx::Size(10, 20));
700 root_layer_->CreateRenderSurface(); 700 root_layer_->CreateRenderSurface();
701 701
702 bool paint_scrollbar = true; 702 bool paint_scrollbar = true;
703 bool has_thumb = false; 703 bool has_thumb = false;
704 scrollbar_ = FakePaintedScrollbarLayer::Create( 704 scrollbar_ = FakePaintedScrollbarLayer::Create(
705 paint_scrollbar, has_thumb, root_layer_->id()); 705 layer_settings(), paint_scrollbar, has_thumb, root_layer_->id());
706 scrollbar_->SetPosition(gfx::Point(0, 10)); 706 scrollbar_->SetPosition(gfx::Point(0, 10));
707 scrollbar_->SetBounds(gfx::Size(10, 10)); 707 scrollbar_->SetBounds(gfx::Size(10, 10));
708 708
709 root_layer_->AddChild(scrollbar_); 709 root_layer_->AddChild(scrollbar_);
710 710
711 layer_tree_host()->SetRootLayer(root_layer_); 711 layer_tree_host()->SetRootLayer(root_layer_);
712 LayerTreeHostTest::SetupTree(); 712 LayerTreeHostTest::SetupTree();
713 } 713 }
714 714
715 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 715 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
(...skipping 30 matching lines...) Expand all
746 SINGLE_AND_MULTI_THREAD_TEST_F( 746 SINGLE_AND_MULTI_THREAD_TEST_F(
747 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate); 747 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate);
748 748
749 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { 749 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest {
750 public: 750 public:
751 LayerTreeHostTestSetNextCommitForcesRedraw() 751 LayerTreeHostTestSetNextCommitForcesRedraw()
752 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} 752 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {}
753 753
754 void BeginTest() override { 754 void BeginTest() override {
755 if (layer_tree_host()->settings().impl_side_painting) 755 if (layer_tree_host()->settings().impl_side_painting)
756 root_layer_ = FakePictureLayer::Create(&client_); 756 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
757 else 757 else
758 root_layer_ = ContentLayer::Create(&client_); 758 root_layer_ = ContentLayer::Create(layer_settings(), &client_);
759 root_layer_->SetIsDrawable(true); 759 root_layer_->SetIsDrawable(true);
760 root_layer_->SetBounds(bounds_); 760 root_layer_->SetBounds(bounds_);
761 layer_tree_host()->SetRootLayer(root_layer_); 761 layer_tree_host()->SetRootLayer(root_layer_);
762 layer_tree_host()->SetViewportSize(bounds_); 762 layer_tree_host()->SetViewportSize(bounds_);
763 PostSetNeedsCommitToMainThread(); 763 PostSetNeedsCommitToMainThread();
764 } 764 }
765 765
766 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 766 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
767 if (num_draws_ == 3 && host_impl->settings().impl_side_painting) 767 if (num_draws_ == 3 && host_impl->settings().impl_side_painting)
768 host_impl->SetNeedsRedrawRect(invalid_rect_); 768 host_impl->SetNeedsRedrawRect(invalid_rect_);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 846
847 void InitializeSettings(LayerTreeSettings* settings) override { 847 void InitializeSettings(LayerTreeSettings* settings) override {
848 // If we don't set the minimum contents scale, it's harder to verify whether 848 // If we don't set the minimum contents scale, it's harder to verify whether
849 // the damage we get is correct. For other scale amounts, please see 849 // the damage we get is correct. For other scale amounts, please see
850 // LayerTreeHostTestDamageWithScale. 850 // LayerTreeHostTestDamageWithScale.
851 settings->minimum_contents_scale = 1.f; 851 settings->minimum_contents_scale = 1.f;
852 } 852 }
853 853
854 void SetupTree() override { 854 void SetupTree() override {
855 if (layer_tree_host()->settings().impl_side_painting) 855 if (layer_tree_host()->settings().impl_side_painting)
856 root_layer_ = FakePictureLayer::Create(&client_); 856 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
857 else 857 else
858 root_layer_ = ContentLayer::Create(&client_); 858 root_layer_ = ContentLayer::Create(layer_settings(), &client_);
859 root_layer_->SetIsDrawable(true); 859 root_layer_->SetIsDrawable(true);
860 root_layer_->SetBounds(gfx::Size(50, 50)); 860 root_layer_->SetBounds(gfx::Size(50, 50));
861 layer_tree_host()->SetRootLayer(root_layer_); 861 layer_tree_host()->SetRootLayer(root_layer_);
862 862
863 // The initially transparent layer has a larger child layer, which is 863 // The initially transparent layer has a larger child layer, which is
864 // not initially drawn because of the this (parent) layer. 864 // not initially drawn because of the this (parent) layer.
865 if (layer_tree_host()->settings().impl_side_painting) 865 if (layer_tree_host()->settings().impl_side_painting)
866 parent_layer_ = FakePictureLayer::Create(&client_); 866 parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
867 else 867 else
868 parent_layer_ = FakeContentLayer::Create(&client_); 868 parent_layer_ = FakeContentLayer::Create(layer_settings(), &client_);
869 parent_layer_->SetBounds(gfx::Size(15, 15)); 869 parent_layer_->SetBounds(gfx::Size(15, 15));
870 parent_layer_->SetOpacity(0.0f); 870 parent_layer_->SetOpacity(0.0f);
871 root_layer_->AddChild(parent_layer_); 871 root_layer_->AddChild(parent_layer_);
872 872
873 if (layer_tree_host()->settings().impl_side_painting) 873 if (layer_tree_host()->settings().impl_side_painting)
874 child_layer_ = FakePictureLayer::Create(&client_); 874 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
875 else 875 else
876 child_layer_ = FakeContentLayer::Create(&client_); 876 child_layer_ = FakeContentLayer::Create(layer_settings(), &client_);
877 child_layer_->SetBounds(gfx::Size(25, 25)); 877 child_layer_->SetBounds(gfx::Size(25, 25));
878 parent_layer_->AddChild(child_layer_); 878 parent_layer_->AddChild(child_layer_);
879 879
880 LayerTreeHostTest::SetupTree(); 880 LayerTreeHostTest::SetupTree();
881 } 881 }
882 882
883 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 883 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
884 884
885 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 885 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
886 LayerTreeHostImpl::FrameData* frame_data, 886 LayerTreeHostImpl::FrameData* frame_data,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 class LayerTreeHostTestDamageWithScale : public LayerTreeHostTest { 950 class LayerTreeHostTestDamageWithScale : public LayerTreeHostTest {
951 public: 951 public:
952 LayerTreeHostTestDamageWithScale() {} 952 LayerTreeHostTestDamageWithScale() {}
953 953
954 void SetupTree() override { 954 void SetupTree() override {
955 client_.set_fill_with_nonsolid_color(true); 955 client_.set_fill_with_nonsolid_color(true);
956 956
957 scoped_ptr<FakePicturePile> pile( 957 scoped_ptr<FakePicturePile> pile(
958 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 958 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
959 ImplSidePaintingSettings().default_tile_grid_size)); 959 ImplSidePaintingSettings().default_tile_grid_size));
960 root_layer_ = 960 root_layer_ = FakePictureLayer::CreateWithRecordingSource(
961 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 961 layer_settings(), &client_, pile.Pass());
962 root_layer_->SetBounds(gfx::Size(50, 50)); 962 root_layer_->SetBounds(gfx::Size(50, 50));
963 963
964 pile.reset( 964 pile.reset(
965 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 965 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
966 ImplSidePaintingSettings().default_tile_grid_size)); 966 ImplSidePaintingSettings().default_tile_grid_size));
967 child_layer_ = 967 child_layer_ = FakePictureLayer::CreateWithRecordingSource(
968 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 968 layer_settings(), &client_, pile.Pass());
969 child_layer_->SetBounds(gfx::Size(25, 25)); 969 child_layer_->SetBounds(gfx::Size(25, 25));
970 child_layer_->SetIsDrawable(true); 970 child_layer_->SetIsDrawable(true);
971 child_layer_->SetContentsOpaque(true); 971 child_layer_->SetContentsOpaque(true);
972 root_layer_->AddChild(child_layer_); 972 root_layer_->AddChild(child_layer_);
973 973
974 layer_tree_host()->SetRootLayer(root_layer_); 974 layer_tree_host()->SetRootLayer(root_layer_);
975 LayerTreeHostTest::SetupTree(); 975 LayerTreeHostTest::SetupTree();
976 } 976 }
977 977
978 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 978 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 1053
1054 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestDamageWithScale); 1054 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestDamageWithScale);
1055 1055
1056 // Tests that if a layer is not drawn because of some reason in the parent, 1056 // Tests that if a layer is not drawn because of some reason in the parent,
1057 // causing its content bounds to not be computed, then when it is later drawn, 1057 // causing its content bounds to not be computed, then when it is later drawn,
1058 // its content bounds get pushed. 1058 // its content bounds get pushed.
1059 class LayerTreeHostTestUndrawnLayersPushContentBoundsLater 1059 class LayerTreeHostTestUndrawnLayersPushContentBoundsLater
1060 : public LayerTreeHostTest { 1060 : public LayerTreeHostTest {
1061 public: 1061 public:
1062 LayerTreeHostTestUndrawnLayersPushContentBoundsLater() 1062 LayerTreeHostTestUndrawnLayersPushContentBoundsLater()
1063 : root_layer_(Layer::Create()) {} 1063 : root_layer_(Layer::Create(layer_settings())) {}
1064 1064
1065 void SetupTree() override { 1065 void SetupTree() override {
1066 root_layer_->CreateRenderSurface(); 1066 root_layer_->CreateRenderSurface();
1067 root_layer_->SetIsDrawable(true); 1067 root_layer_->SetIsDrawable(true);
1068 root_layer_->SetBounds(gfx::Size(20, 20)); 1068 root_layer_->SetBounds(gfx::Size(20, 20));
1069 layer_tree_host()->SetRootLayer(root_layer_); 1069 layer_tree_host()->SetRootLayer(root_layer_);
1070 1070
1071 parent_layer_ = Layer::Create(); 1071 parent_layer_ = Layer::Create(layer_settings());
1072 parent_layer_->SetBounds(gfx::Size(20, 20)); 1072 parent_layer_->SetBounds(gfx::Size(20, 20));
1073 parent_layer_->SetOpacity(0.0f); 1073 parent_layer_->SetOpacity(0.0f);
1074 root_layer_->AddChild(parent_layer_); 1074 root_layer_->AddChild(parent_layer_);
1075 1075
1076 child_layer_ = Layer::Create(); 1076 child_layer_ = Layer::Create(layer_settings());
1077 child_layer_->SetBounds(gfx::Size(15, 15)); 1077 child_layer_->SetBounds(gfx::Size(15, 15));
1078 parent_layer_->AddChild(child_layer_); 1078 parent_layer_->AddChild(child_layer_);
1079 1079
1080 LayerTreeHostTest::SetupTree(); 1080 LayerTreeHostTest::SetupTree();
1081 } 1081 }
1082 1082
1083 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1083 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1084 1084
1085 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 1085 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
1086 LayerImpl* root = host_impl->active_tree()->root_layer(); 1086 LayerImpl* root = host_impl->active_tree()->root_layer();
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 1264
1265 // Verifies that StartPageScaleAnimation events propagate correctly 1265 // Verifies that StartPageScaleAnimation events propagate correctly
1266 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. 1266 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor.
1267 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { 1267 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest {
1268 public: 1268 public:
1269 LayerTreeHostTestStartPageScaleAnimation() {} 1269 LayerTreeHostTestStartPageScaleAnimation() {}
1270 1270
1271 void SetupTree() override { 1271 void SetupTree() override {
1272 LayerTreeHostTest::SetupTree(); 1272 LayerTreeHostTest::SetupTree();
1273 1273
1274 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(&client_); 1274 scoped_refptr<FakePictureLayer> layer =
1275 FakePictureLayer::Create(layer_settings(), &client_);
1275 layer->set_always_update_resources(true); 1276 layer->set_always_update_resources(true);
1276 scroll_layer_ = layer; 1277 scroll_layer_ = layer;
1277 1278
1278 Layer* root_layer = layer_tree_host()->root_layer(); 1279 Layer* root_layer = layer_tree_host()->root_layer();
1279 scroll_layer_->SetScrollClipLayerId(root_layer->id()); 1280 scroll_layer_->SetScrollClipLayerId(root_layer->id());
1280 scroll_layer_->SetIsContainerForFixedPositionLayers(true); 1281 scroll_layer_->SetIsContainerForFixedPositionLayers(true);
1281 scroll_layer_->SetBounds(gfx::Size(2 * root_layer->bounds().width(), 1282 scroll_layer_->SetBounds(gfx::Size(2 * root_layer->bounds().width(),
1282 2 * root_layer->bounds().height())); 1283 2 * root_layer->bounds().height()));
1283 scroll_layer_->SetScrollOffset(gfx::ScrollOffset()); 1284 scroll_layer_->SetScrollOffset(gfx::ScrollOffset());
1284 layer_tree_host()->root_layer()->AddChild(scroll_layer_); 1285 layer_tree_host()->root_layer()->AddChild(scroll_layer_);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 } 1386 }
1386 bool FillsBoundsCompletely() const override { return false; } 1387 bool FillsBoundsCompletely() const override { return false; }
1387 1388
1388 private: 1389 private:
1389 Layer* test_layer_; 1390 Layer* test_layer_;
1390 }; 1391 };
1391 1392
1392 class ContentLayerWithUpdateTracking : public ContentLayer { 1393 class ContentLayerWithUpdateTracking : public ContentLayer {
1393 public: 1394 public:
1394 static scoped_refptr<ContentLayerWithUpdateTracking> Create( 1395 static scoped_refptr<ContentLayerWithUpdateTracking> Create(
1396 const LayerSettings& settings,
1395 ContentLayerClient* client) { 1397 ContentLayerClient* client) {
1396 return make_scoped_refptr(new ContentLayerWithUpdateTracking(client)); 1398 return make_scoped_refptr(
1399 new ContentLayerWithUpdateTracking(settings, client));
1397 } 1400 }
1398 1401
1399 int PaintContentsCount() { return paint_contents_count_; } 1402 int PaintContentsCount() { return paint_contents_count_; }
1400 void ResetPaintContentsCount() { paint_contents_count_ = 0; } 1403 void ResetPaintContentsCount() { paint_contents_count_ = 0; }
1401 1404
1402 bool Update(ResourceUpdateQueue* queue, 1405 bool Update(ResourceUpdateQueue* queue,
1403 const OcclusionTracker<Layer>* occlusion) override { 1406 const OcclusionTracker<Layer>* occlusion) override {
1404 bool updated = ContentLayer::Update(queue, occlusion); 1407 bool updated = ContentLayer::Update(queue, occlusion);
1405 paint_contents_count_++; 1408 paint_contents_count_++;
1406 return updated; 1409 return updated;
1407 } 1410 }
1408 1411
1409 private: 1412 private:
1410 explicit ContentLayerWithUpdateTracking(ContentLayerClient* client) 1413 ContentLayerWithUpdateTracking(const LayerSettings& settings,
1411 : ContentLayer(client), paint_contents_count_(0) { 1414 ContentLayerClient* client)
1415 : ContentLayer(settings, client), paint_contents_count_(0) {
1412 SetBounds(gfx::Size(10, 10)); 1416 SetBounds(gfx::Size(10, 10));
1413 SetIsDrawable(true); 1417 SetIsDrawable(true);
1414 } 1418 }
1415 ~ContentLayerWithUpdateTracking() override {} 1419 ~ContentLayerWithUpdateTracking() override {}
1416 1420
1417 int paint_contents_count_; 1421 int paint_contents_count_;
1418 }; 1422 };
1419 1423
1420 // Layer opacity change during paint should not prevent compositor resources 1424 // Layer opacity change during paint should not prevent compositor resources
1421 // from being updated during commit. 1425 // from being updated during commit.
1422 class LayerTreeHostTestOpacityChange : public LayerTreeHostTest { 1426 class LayerTreeHostTestOpacityChange : public LayerTreeHostTest {
1423 public: 1427 public:
1424 LayerTreeHostTestOpacityChange() : test_opacity_change_delegate_() {} 1428 LayerTreeHostTestOpacityChange() : test_opacity_change_delegate_() {}
1425 1429
1426 void BeginTest() override { 1430 void BeginTest() override {
1427 if (layer_tree_host()->settings().impl_side_painting) { 1431 if (layer_tree_host()->settings().impl_side_painting) {
1428 update_check_picture_layer_ = 1432 update_check_picture_layer_ = FakePictureLayer::Create(
1429 FakePictureLayer::Create(&test_opacity_change_delegate_); 1433 layer_settings(), &test_opacity_change_delegate_);
1430 test_opacity_change_delegate_.SetTestLayer( 1434 test_opacity_change_delegate_.SetTestLayer(
1431 update_check_picture_layer_.get()); 1435 update_check_picture_layer_.get());
1432 is_impl_paint_ = true; 1436 is_impl_paint_ = true;
1433 } else { 1437 } else {
1434 update_check_content_layer_ = ContentLayerWithUpdateTracking::Create( 1438 update_check_content_layer_ = ContentLayerWithUpdateTracking::Create(
1435 &test_opacity_change_delegate_); 1439 layer_settings(), &test_opacity_change_delegate_);
1436 test_opacity_change_delegate_.SetTestLayer( 1440 test_opacity_change_delegate_.SetTestLayer(
1437 update_check_content_layer_.get()); 1441 update_check_content_layer_.get());
1438 is_impl_paint_ = false; 1442 is_impl_paint_ = false;
1439 } 1443 }
1440 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); 1444 layer_tree_host()->SetViewportSize(gfx::Size(10, 10));
1441 if (layer_tree_host()->settings().impl_side_painting) 1445 if (layer_tree_host()->settings().impl_side_painting)
1442 layer_tree_host()->root_layer()->AddChild(update_check_picture_layer_); 1446 layer_tree_host()->root_layer()->AddChild(update_check_picture_layer_);
1443 else 1447 else
1444 layer_tree_host()->root_layer()->AddChild(update_check_content_layer_); 1448 layer_tree_host()->root_layer()->AddChild(update_check_content_layer_);
1445 1449
(...skipping 24 matching lines...) Expand all
1470 public: 1474 public:
1471 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {} 1475 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {}
1472 1476
1473 void InitializeSettings(LayerTreeSettings* settings) override { 1477 void InitializeSettings(LayerTreeSettings* settings) override {
1474 // PictureLayer can only be used with impl side painting enabled. 1478 // PictureLayer can only be used with impl side painting enabled.
1475 settings->impl_side_painting = true; 1479 settings->impl_side_painting = true;
1476 } 1480 }
1477 1481
1478 void BeginTest() override { 1482 void BeginTest() override {
1479 client_.set_fill_with_nonsolid_color(true); 1483 client_.set_fill_with_nonsolid_color(true);
1480 root_layer_ = FakePictureLayer::Create(&client_); 1484 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
1481 child_layer_ = FakePictureLayer::Create(&client_); 1485 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
1482 1486
1483 layer_tree_host()->SetViewportSize(gfx::Size(60, 60)); 1487 layer_tree_host()->SetViewportSize(gfx::Size(60, 60));
1484 layer_tree_host()->SetDeviceScaleFactor(1.5); 1488 layer_tree_host()->SetDeviceScaleFactor(1.5);
1485 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size()); 1489 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size());
1486 1490
1487 root_layer_->AddChild(child_layer_); 1491 root_layer_->AddChild(child_layer_);
1488 1492
1489 root_layer_->SetIsDrawable(true); 1493 root_layer_->SetIsDrawable(true);
1490 root_layer_->SetBounds(gfx::Size(30, 30)); 1494 root_layer_->SetBounds(gfx::Size(30, 30));
1491 1495
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 public: 1583 public:
1580 void InitializeSettings(LayerTreeSettings* settings) override { 1584 void InitializeSettings(LayerTreeSettings* settings) override {
1581 settings->renderer_settings.texture_id_allocation_chunk_size = 1; 1585 settings->renderer_settings.texture_id_allocation_chunk_size = 1;
1582 // Make sure partial texture updates are turned off. 1586 // Make sure partial texture updates are turned off.
1583 settings->max_partial_texture_updates = 0; 1587 settings->max_partial_texture_updates = 0;
1584 // Linear fade animator prevents scrollbars from drawing immediately. 1588 // Linear fade animator prevents scrollbars from drawing immediately.
1585 settings->scrollbar_animator = LayerTreeSettings::NO_ANIMATOR; 1589 settings->scrollbar_animator = LayerTreeSettings::NO_ANIMATOR;
1586 } 1590 }
1587 1591
1588 void SetupTree() override { 1592 void SetupTree() override {
1589 layer_ = FakeContentLayer::Create(&client_); 1593 layer_ = FakeContentLayer::Create(layer_settings(), &client_);
1590 layer_->SetBounds(gfx::Size(10, 20)); 1594 layer_->SetBounds(gfx::Size(10, 20));
1591 1595
1592 bool paint_scrollbar = true; 1596 bool paint_scrollbar = true;
1593 bool has_thumb = false; 1597 bool has_thumb = false;
1594 scrollbar_ = FakePaintedScrollbarLayer::Create( 1598 scrollbar_ = FakePaintedScrollbarLayer::Create(
1595 paint_scrollbar, has_thumb, layer_->id()); 1599 layer_settings(), paint_scrollbar, has_thumb, layer_->id());
1596 scrollbar_->SetPosition(gfx::Point(0, 10)); 1600 scrollbar_->SetPosition(gfx::Point(0, 10));
1597 scrollbar_->SetBounds(gfx::Size(10, 10)); 1601 scrollbar_->SetBounds(gfx::Size(10, 10));
1598 1602
1599 layer_->AddChild(scrollbar_); 1603 layer_->AddChild(scrollbar_);
1600 1604
1601 layer_tree_host()->SetRootLayer(layer_); 1605 layer_tree_host()->SetRootLayer(layer_);
1602 LayerTreeHostTest::SetupTree(); 1606 LayerTreeHostTest::SetupTree();
1603 } 1607 }
1604 1608
1605 void BeginTest() override { 1609 void BeginTest() override {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 public: 1758 public:
1755 void InitializeSettings(LayerTreeSettings* settings) override { 1759 void InitializeSettings(LayerTreeSettings* settings) override {
1756 settings->renderer_settings.texture_id_allocation_chunk_size = 1; 1760 settings->renderer_settings.texture_id_allocation_chunk_size = 1;
1757 // Allow one partial texture update. 1761 // Allow one partial texture update.
1758 settings->max_partial_texture_updates = 1; 1762 settings->max_partial_texture_updates = 1;
1759 // No partial updates when impl side painting is enabled. 1763 // No partial updates when impl side painting is enabled.
1760 settings->impl_side_painting = false; 1764 settings->impl_side_painting = false;
1761 } 1765 }
1762 1766
1763 void SetupTree() override { 1767 void SetupTree() override {
1764 parent_ = FakeContentLayer::Create(&client_); 1768 parent_ = FakeContentLayer::Create(layer_settings(), &client_);
1765 parent_->SetBounds(gfx::Size(10, 20)); 1769 parent_->SetBounds(gfx::Size(10, 20));
1766 1770
1767 child_ = FakeContentLayer::Create(&client_); 1771 child_ = FakeContentLayer::Create(layer_settings(), &client_);
1768 child_->SetPosition(gfx::Point(0, 10)); 1772 child_->SetPosition(gfx::Point(0, 10));
1769 child_->SetBounds(gfx::Size(3, 10)); 1773 child_->SetBounds(gfx::Size(3, 10));
1770 1774
1771 parent_->AddChild(child_); 1775 parent_->AddChild(child_);
1772 1776
1773 layer_tree_host()->SetRootLayer(parent_); 1777 layer_tree_host()->SetRootLayer(parent_);
1774 LayerTreeHostTest::SetupTree(); 1778 LayerTreeHostTest::SetupTree();
1775 } 1779 }
1776 1780
1777 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1781 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 1924
1921 // Partial updates are not possible with a delegating renderer. 1925 // Partial updates are not possible with a delegating renderer.
1922 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 1926 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
1923 LayerTreeHostTestAtomicCommitWithPartialUpdate); 1927 LayerTreeHostTestAtomicCommitWithPartialUpdate);
1924 1928
1925 // TODO(sohanjg) : Make it work with impl-side painting. 1929 // TODO(sohanjg) : Make it work with impl-side painting.
1926 class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit 1930 class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit
1927 : public LayerTreeHostTest { 1931 : public LayerTreeHostTest {
1928 protected: 1932 protected:
1929 void SetupTree() override { 1933 void SetupTree() override {
1930 root_layer_ = FakeContentLayer::Create(&client_); 1934 root_layer_ = FakeContentLayer::Create(layer_settings(), &client_);
1931 root_layer_->SetBounds(gfx::Size(100, 100)); 1935 root_layer_->SetBounds(gfx::Size(100, 100));
1932 1936
1933 surface_layer1_ = FakeContentLayer::Create(&client_); 1937 surface_layer1_ = FakeContentLayer::Create(layer_settings(), &client_);
1934 surface_layer1_->SetBounds(gfx::Size(100, 100)); 1938 surface_layer1_->SetBounds(gfx::Size(100, 100));
1935 surface_layer1_->SetForceRenderSurface(true); 1939 surface_layer1_->SetForceRenderSurface(true);
1936 surface_layer1_->SetOpacity(0.5f); 1940 surface_layer1_->SetOpacity(0.5f);
1937 root_layer_->AddChild(surface_layer1_); 1941 root_layer_->AddChild(surface_layer1_);
1938 1942
1939 surface_layer2_ = FakeContentLayer::Create(&client_); 1943 surface_layer2_ = FakeContentLayer::Create(layer_settings(), &client_);
1940 surface_layer2_->SetBounds(gfx::Size(100, 100)); 1944 surface_layer2_->SetBounds(gfx::Size(100, 100));
1941 surface_layer2_->SetForceRenderSurface(true); 1945 surface_layer2_->SetForceRenderSurface(true);
1942 surface_layer2_->SetOpacity(0.5f); 1946 surface_layer2_->SetOpacity(0.5f);
1943 surface_layer1_->AddChild(surface_layer2_); 1947 surface_layer1_->AddChild(surface_layer2_);
1944 1948
1945 replica_layer1_ = FakeContentLayer::Create(&client_); 1949 replica_layer1_ = FakeContentLayer::Create(layer_settings(), &client_);
1946 surface_layer1_->SetReplicaLayer(replica_layer1_.get()); 1950 surface_layer1_->SetReplicaLayer(replica_layer1_.get());
1947 1951
1948 replica_layer2_ = FakeContentLayer::Create(&client_); 1952 replica_layer2_ = FakeContentLayer::Create(layer_settings(), &client_);
1949 surface_layer2_->SetReplicaLayer(replica_layer2_.get()); 1953 surface_layer2_->SetReplicaLayer(replica_layer2_.get());
1950 1954
1951 layer_tree_host()->SetRootLayer(root_layer_); 1955 layer_tree_host()->SetRootLayer(root_layer_);
1952 LayerTreeHostTest::SetupTree(); 1956 LayerTreeHostTest::SetupTree();
1953 } 1957 }
1954 1958
1955 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1959 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1956 1960
1957 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 1961 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
1958 Renderer* renderer = host_impl->renderer(); 1962 Renderer* renderer = host_impl->renderer();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 scoped_refptr<FakeContentLayer> surface_layer2_; 2013 scoped_refptr<FakeContentLayer> surface_layer2_;
2010 scoped_refptr<FakeContentLayer> replica_layer2_; 2014 scoped_refptr<FakeContentLayer> replica_layer2_;
2011 }; 2015 };
2012 2016
2013 // Surfaces don't exist with a delegated renderer. 2017 // Surfaces don't exist with a delegated renderer.
2014 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F( 2018 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(
2015 LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit); 2019 LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit);
2016 2020
2017 class EvictionTestLayer : public Layer { 2021 class EvictionTestLayer : public Layer {
2018 public: 2022 public:
2019 static scoped_refptr<EvictionTestLayer> Create() { 2023 static scoped_refptr<EvictionTestLayer> Create(
2020 return make_scoped_refptr(new EvictionTestLayer()); 2024 const LayerSettings& settings) {
2025 return make_scoped_refptr(new EvictionTestLayer(settings));
2021 } 2026 }
2022 2027
2023 bool Update(ResourceUpdateQueue*, const OcclusionTracker<Layer>*) override; 2028 bool Update(ResourceUpdateQueue*, const OcclusionTracker<Layer>*) override;
2024 bool DrawsContent() const override { return true; } 2029 bool DrawsContent() const override { return true; }
2025 2030
2026 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; 2031 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
2027 void PushPropertiesTo(LayerImpl* impl) override; 2032 void PushPropertiesTo(LayerImpl* impl) override;
2028 void SetTexturePriorities(const PriorityCalculator&) override; 2033 void SetTexturePriorities(const PriorityCalculator&) override;
2029 2034
2030 bool HaveBackingTexture() const { 2035 bool HaveBackingTexture() const {
2031 return texture_.get() ? texture_->have_backing_texture() : false; 2036 return texture_.get() ? texture_->have_backing_texture() : false;
2032 } 2037 }
2033 2038
2034 private: 2039 private:
2035 EvictionTestLayer() : Layer() {} 2040 explicit EvictionTestLayer(const LayerSettings& settings) : Layer(settings) {}
2036 ~EvictionTestLayer() override {} 2041 ~EvictionTestLayer() override {}
2037 2042
2038 void CreateTextureIfNeeded() { 2043 void CreateTextureIfNeeded() {
2039 if (texture_) 2044 if (texture_)
2040 return; 2045 return;
2041 texture_ = PrioritizedResource::Create( 2046 texture_ = PrioritizedResource::Create(
2042 layer_tree_host()->contents_texture_manager()); 2047 layer_tree_host()->contents_texture_manager());
2043 texture_->SetDimensions(gfx::Size(10, 10), RGBA_8888); 2048 texture_->SetDimensions(gfx::Size(10, 10), RGBA_8888);
2044 bitmap_.allocN32Pixels(10, 10); 2049 bitmap_.allocN32Pixels(10, 10);
2045 } 2050 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2100 Layer::PushPropertiesTo(layer_impl); 2105 Layer::PushPropertiesTo(layer_impl);
2101 2106
2102 EvictionTestLayerImpl* test_layer_impl = 2107 EvictionTestLayerImpl* test_layer_impl =
2103 static_cast<EvictionTestLayerImpl*>(layer_impl); 2108 static_cast<EvictionTestLayerImpl*>(layer_impl);
2104 test_layer_impl->SetHasTexture(texture_->have_backing_texture()); 2109 test_layer_impl->SetHasTexture(texture_->have_backing_texture());
2105 } 2110 }
2106 2111
2107 class LayerTreeHostTestEvictTextures : public LayerTreeHostTest { 2112 class LayerTreeHostTestEvictTextures : public LayerTreeHostTest {
2108 public: 2113 public:
2109 LayerTreeHostTestEvictTextures() 2114 LayerTreeHostTestEvictTextures()
2110 : layer_(EvictionTestLayer::Create()), 2115 : layer_(EvictionTestLayer::Create(layer_settings())),
2111 impl_for_evict_textures_(0), 2116 impl_for_evict_textures_(0),
2112 num_commits_(0) {} 2117 num_commits_(0) {}
2113 2118
2114 void BeginTest() override { 2119 void BeginTest() override {
2115 layer_tree_host()->SetRootLayer(layer_); 2120 layer_tree_host()->SetRootLayer(layer_);
2116 layer_tree_host()->SetViewportSize(gfx::Size(10, 20)); 2121 layer_tree_host()->SetViewportSize(gfx::Size(10, 20));
2117 2122
2118 gfx::Transform identity_matrix; 2123 gfx::Transform identity_matrix;
2119 SetLayerPropertiesForTesting(layer_.get(), 2124 SetLayerPropertiesForTesting(layer_.get(),
2120 0, 2125 0,
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { 2241 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest {
2237 public: 2242 public:
2238 LayerTreeHostTestContinuousInvalidate() 2243 LayerTreeHostTestContinuousInvalidate()
2239 : num_commit_complete_(0), num_draw_layers_(0) {} 2244 : num_commit_complete_(0), num_draw_layers_(0) {}
2240 2245
2241 void BeginTest() override { 2246 void BeginTest() override {
2242 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); 2247 layer_tree_host()->SetViewportSize(gfx::Size(10, 10));
2243 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); 2248 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10));
2244 2249
2245 if (layer_tree_host()->settings().impl_side_painting) 2250 if (layer_tree_host()->settings().impl_side_painting)
2246 layer_ = FakePictureLayer::Create(&client_); 2251 layer_ = FakePictureLayer::Create(layer_settings(), &client_);
2247 else 2252 else
2248 layer_ = FakeContentLayer::Create(&client_); 2253 layer_ = FakeContentLayer::Create(layer_settings(), &client_);
2249 2254
2250 layer_->SetBounds(gfx::Size(10, 10)); 2255 layer_->SetBounds(gfx::Size(10, 10));
2251 layer_->SetPosition(gfx::PointF(0.f, 0.f)); 2256 layer_->SetPosition(gfx::PointF(0.f, 0.f));
2252 layer_->SetIsDrawable(true); 2257 layer_->SetIsDrawable(true);
2253 layer_tree_host()->root_layer()->AddChild(layer_); 2258 layer_tree_host()->root_layer()->AddChild(layer_);
2254 2259
2255 PostSetNeedsCommitToMainThread(); 2260 PostSetNeedsCommitToMainThread();
2256 } 2261 }
2257 2262
2258 void DidCommitAndDrawFrame() override { 2263 void DidCommitAndDrawFrame() override {
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
2582 host->Composite(base::TimeTicks::Now()); 2587 host->Composite(base::TimeTicks::Now());
2583 2588
2584 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); 2589 EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
2585 } 2590 }
2586 2591
2587 // TODO(sohanjg) : Remove it once impl-side painting ships everywhere. 2592 // TODO(sohanjg) : Remove it once impl-side painting ships everywhere.
2588 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted 2593 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted
2589 : public LayerTreeHostTest { 2594 : public LayerTreeHostTest {
2590 public: 2595 public:
2591 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() 2596 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted()
2592 : root_layer_(FakeContentLayer::Create(&client_)), 2597 : root_layer_(FakeContentLayer::Create(layer_settings(), &client_)),
2593 child_layer1_(FakeContentLayer::Create(&client_)), 2598 child_layer1_(FakeContentLayer::Create(layer_settings(), &client_)),
2594 child_layer2_(FakeContentLayer::Create(&client_)), 2599 child_layer2_(FakeContentLayer::Create(layer_settings(), &client_)),
2595 num_commits_(0) {} 2600 num_commits_(0) {}
2596 2601
2597 void BeginTest() override { 2602 void BeginTest() override {
2598 layer_tree_host()->SetViewportSize(gfx::Size(100, 100)); 2603 layer_tree_host()->SetViewportSize(gfx::Size(100, 100));
2599 root_layer_->SetBounds(gfx::Size(100, 100)); 2604 root_layer_->SetBounds(gfx::Size(100, 100));
2600 child_layer1_->SetBounds(gfx::Size(100, 100)); 2605 child_layer1_->SetBounds(gfx::Size(100, 100));
2601 child_layer2_->SetBounds(gfx::Size(100, 100)); 2606 child_layer2_->SetBounds(gfx::Size(100, 100));
2602 root_layer_->AddChild(child_layer1_); 2607 root_layer_->AddChild(child_layer1_);
2603 root_layer_->AddChild(child_layer2_); 2608 root_layer_->AddChild(child_layer2_);
2604 layer_tree_host()->SetRootLayer(root_layer_); 2609 layer_tree_host()->SetRootLayer(root_layer_);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2664 }; 2669 };
2665 2670
2666 SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F( 2671 SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(
2667 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted); 2672 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted);
2668 2673
2669 class LayerTreeHostTestLCDChange : public LayerTreeHostTest { 2674 class LayerTreeHostTestLCDChange : public LayerTreeHostTest {
2670 public: 2675 public:
2671 void SetupTree() override { 2676 void SetupTree() override {
2672 num_tiles_rastered_ = 0; 2677 num_tiles_rastered_ = 0;
2673 2678
2674 scoped_refptr<Layer> root_layer = PictureLayer::Create(&client_); 2679 scoped_refptr<Layer> root_layer =
2680 PictureLayer::Create(layer_settings(), &client_);
2675 client_.set_fill_with_nonsolid_color(true); 2681 client_.set_fill_with_nonsolid_color(true);
2676 root_layer->SetIsDrawable(true); 2682 root_layer->SetIsDrawable(true);
2677 root_layer->SetBounds(gfx::Size(10, 10)); 2683 root_layer->SetBounds(gfx::Size(10, 10));
2678 root_layer->SetContentsOpaque(true); 2684 root_layer->SetContentsOpaque(true);
2679 2685
2680 layer_tree_host()->SetRootLayer(root_layer); 2686 layer_tree_host()->SetRootLayer(root_layer);
2681 2687
2682 // The expectations are based on the assumption that the default 2688 // The expectations are based on the assumption that the default
2683 // LCD settings are: 2689 // LCD settings are:
2684 EXPECT_TRUE(layer_tree_host()->settings().can_use_lcd_text); 2690 EXPECT_TRUE(layer_tree_host()->settings().can_use_lcd_text);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2896 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation 2902 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation
2897 : public LayerTreeHostTest { 2903 : public LayerTreeHostTest {
2898 protected: 2904 protected:
2899 void InitializeSettings(LayerTreeSettings* settings) override { 2905 void InitializeSettings(LayerTreeSettings* settings) override {
2900 settings->impl_side_painting = true; 2906 settings->impl_side_painting = true;
2901 } 2907 }
2902 2908
2903 void SetupTree() override { 2909 void SetupTree() override {
2904 LayerTreeHostTest::SetupTree(); 2910 LayerTreeHostTest::SetupTree();
2905 2911
2906 scoped_refptr<Layer> layer = PictureLayer::Create(&client_); 2912 scoped_refptr<Layer> layer =
2913 PictureLayer::Create(layer_settings(), &client_);
2907 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); 2914 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
2908 layer->SetBounds(gfx::Size(10, 10)); 2915 layer->SetBounds(gfx::Size(10, 10));
2909 layer_tree_host()->root_layer()->AddChild(layer); 2916 layer_tree_host()->root_layer()->AddChild(layer);
2910 } 2917 }
2911 2918
2912 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 2919 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
2913 2920
2914 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 2921 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
2915 EndTest(); 2922 EndTest();
2916 } 2923 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2948 bool FillsBoundsCompletely() const override { return false; } 2955 bool FillsBoundsCompletely() const override { return false; }
2949 2956
2950 private: 2957 private:
2951 Layer* layer_; 2958 Layer* layer_;
2952 }; 2959 };
2953 2960
2954 LayerTreeHostTestChangeLayerPropertiesInPaintContents() : num_commits_(0) {} 2961 LayerTreeHostTestChangeLayerPropertiesInPaintContents() : num_commits_(0) {}
2955 2962
2956 void SetupTree() override { 2963 void SetupTree() override {
2957 if (layer_tree_host()->settings().impl_side_painting) { 2964 if (layer_tree_host()->settings().impl_side_painting) {
2958 scoped_refptr<PictureLayer> root_layer = PictureLayer::Create(&client_); 2965 scoped_refptr<PictureLayer> root_layer =
2966 PictureLayer::Create(layer_settings(), &client_);
2959 layer_tree_host()->SetRootLayer(root_layer); 2967 layer_tree_host()->SetRootLayer(root_layer);
2960 } else { 2968 } else {
2961 scoped_refptr<ContentLayer> root_layer = ContentLayer::Create(&client_); 2969 scoped_refptr<ContentLayer> root_layer =
2970 ContentLayer::Create(layer_settings(), &client_);
2962 layer_tree_host()->SetRootLayer(root_layer); 2971 layer_tree_host()->SetRootLayer(root_layer);
2963 } 2972 }
2964 Layer* root_layer = layer_tree_host()->root_layer(); 2973 Layer* root_layer = layer_tree_host()->root_layer();
2965 root_layer->SetIsDrawable(true); 2974 root_layer->SetIsDrawable(true);
2966 root_layer->SetBounds(gfx::Size(1, 1)); 2975 root_layer->SetBounds(gfx::Size(1, 1));
2967 2976
2968 client_.set_layer(root_layer); 2977 client_.set_layer(root_layer);
2969 2978
2970 LayerTreeHostTest::SetupTree(); 2979 LayerTreeHostTest::SetupTree();
2971 } 2980 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
3035 } 3044 }
3036 3045
3037 void SetupTree() override { 3046 void SetupTree() override {
3038 LayerTreeHostTest::SetupTree(); 3047 LayerTreeHostTest::SetupTree();
3039 3048
3040 layer_tree_host()->root_layer()->SetIsDrawable(false); 3049 layer_tree_host()->root_layer()->SetIsDrawable(false);
3041 3050
3042 io_surface_id_ = 9; 3051 io_surface_id_ = 9;
3043 io_surface_size_ = gfx::Size(6, 7); 3052 io_surface_size_ = gfx::Size(6, 7);
3044 3053
3045 scoped_refptr<IOSurfaceLayer> io_surface_layer = IOSurfaceLayer::Create(); 3054 scoped_refptr<IOSurfaceLayer> io_surface_layer =
3055 IOSurfaceLayer::Create(layer_settings());
3046 io_surface_layer->SetBounds(gfx::Size(10, 10)); 3056 io_surface_layer->SetBounds(gfx::Size(10, 10));
3047 io_surface_layer->SetIsDrawable(true); 3057 io_surface_layer->SetIsDrawable(true);
3048 io_surface_layer->SetContentsOpaque(true); 3058 io_surface_layer->SetContentsOpaque(true);
3049 io_surface_layer->SetIOSurfaceProperties(io_surface_id_, io_surface_size_); 3059 io_surface_layer->SetIOSurfaceProperties(io_surface_id_, io_surface_size_);
3050 layer_tree_host()->root_layer()->AddChild(io_surface_layer); 3060 layer_tree_host()->root_layer()->AddChild(io_surface_layer);
3051 } 3061 }
3052 3062
3053 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 3063 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
3054 3064
3055 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 3065 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3188 RunTest(true, true, true); 3198 RunTest(true, true, true);
3189 } 3199 }
3190 3200
3191 TEST_F(LayerTreeHostTestNumFramesPending, DISABLED_GLRenderer) { 3201 TEST_F(LayerTreeHostTestNumFramesPending, DISABLED_GLRenderer) {
3192 RunTest(true, false, true); 3202 RunTest(true, false, true);
3193 } 3203 }
3194 3204
3195 class LayerTreeHostTestResourcelessSoftwareDraw : public LayerTreeHostTest { 3205 class LayerTreeHostTestResourcelessSoftwareDraw : public LayerTreeHostTest {
3196 public: 3206 public:
3197 void SetupTree() override { 3207 void SetupTree() override {
3198 root_layer_ = FakePictureLayer::Create(&client_); 3208 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
3199 root_layer_->SetIsDrawable(true); 3209 root_layer_->SetIsDrawable(true);
3200 root_layer_->SetBounds(gfx::Size(50, 50)); 3210 root_layer_->SetBounds(gfx::Size(50, 50));
3201 3211
3202 parent_layer_ = FakePictureLayer::Create(&client_); 3212 parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
3203 parent_layer_->SetIsDrawable(true); 3213 parent_layer_->SetIsDrawable(true);
3204 parent_layer_->SetBounds(gfx::Size(50, 50)); 3214 parent_layer_->SetBounds(gfx::Size(50, 50));
3205 parent_layer_->SetForceRenderSurface(true); 3215 parent_layer_->SetForceRenderSurface(true);
3206 3216
3207 child_layer_ = FakePictureLayer::Create(&client_); 3217 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
3208 child_layer_->SetIsDrawable(true); 3218 child_layer_->SetIsDrawable(true);
3209 child_layer_->SetBounds(gfx::Size(50, 50)); 3219 child_layer_->SetBounds(gfx::Size(50, 50));
3210 3220
3211 root_layer_->AddChild(parent_layer_); 3221 root_layer_->AddChild(parent_layer_);
3212 parent_layer_->AddChild(child_layer_); 3222 parent_layer_->AddChild(child_layer_);
3213 layer_tree_host()->SetRootLayer(root_layer_); 3223 layer_tree_host()->SetRootLayer(root_layer_);
3214 3224
3215 LayerTreeHostTest::SetupTree(); 3225 LayerTreeHostTest::SetupTree();
3216 } 3226 }
3217 3227
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
3414 3424
3415 PushPropertiesCountingLayerImpl(LayerTreeImpl* tree_impl, int id) 3425 PushPropertiesCountingLayerImpl(LayerTreeImpl* tree_impl, int id)
3416 : LayerImpl(tree_impl, id), 3426 : LayerImpl(tree_impl, id),
3417 push_properties_count_(0) { 3427 push_properties_count_(0) {
3418 SetBounds(gfx::Size(1, 1)); 3428 SetBounds(gfx::Size(1, 1));
3419 } 3429 }
3420 }; 3430 };
3421 3431
3422 class PushPropertiesCountingLayer : public Layer { 3432 class PushPropertiesCountingLayer : public Layer {
3423 public: 3433 public:
3424 static scoped_refptr<PushPropertiesCountingLayer> Create() { 3434 static scoped_refptr<PushPropertiesCountingLayer> Create(
3425 return new PushPropertiesCountingLayer(); 3435 const LayerSettings& settings) {
3436 return new PushPropertiesCountingLayer(settings);
3426 } 3437 }
3427 3438
3428 void PushPropertiesTo(LayerImpl* layer) override { 3439 void PushPropertiesTo(LayerImpl* layer) override {
3429 Layer::PushPropertiesTo(layer); 3440 Layer::PushPropertiesTo(layer);
3430 push_properties_count_++; 3441 push_properties_count_++;
3431 if (persist_needs_push_properties_) 3442 if (persist_needs_push_properties_)
3432 needs_push_properties_ = true; 3443 needs_push_properties_ = true;
3433 } 3444 }
3434 3445
3435 // Something to make this layer push properties, but no other layer. 3446 // Something to make this layer push properties, but no other layer.
3436 void MakePushProperties() { SetContentsOpaque(!contents_opaque()); } 3447 void MakePushProperties() { SetContentsOpaque(!contents_opaque()); }
3437 3448
3438 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override { 3449 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override {
3439 return PushPropertiesCountingLayerImpl::Create(tree_impl, id()); 3450 return PushPropertiesCountingLayerImpl::Create(tree_impl, id());
3440 } 3451 }
3441 3452
3442 void SetDrawsContent(bool draws_content) { SetIsDrawable(draws_content); } 3453 void SetDrawsContent(bool draws_content) { SetIsDrawable(draws_content); }
3443 3454
3444 size_t push_properties_count() const { return push_properties_count_; } 3455 size_t push_properties_count() const { return push_properties_count_; }
3445 void reset_push_properties_count() { push_properties_count_ = 0; } 3456 void reset_push_properties_count() { push_properties_count_ = 0; }
3446 3457
3447 void set_persist_needs_push_properties(bool persist) { 3458 void set_persist_needs_push_properties(bool persist) {
3448 persist_needs_push_properties_ = persist; 3459 persist_needs_push_properties_ = persist;
3449 } 3460 }
3450 3461
3451 private: 3462 private:
3452 PushPropertiesCountingLayer() 3463 explicit PushPropertiesCountingLayer(const LayerSettings& settings)
3453 : push_properties_count_(0), persist_needs_push_properties_(false) { 3464 : Layer(settings),
3465 push_properties_count_(0),
3466 persist_needs_push_properties_(false) {
3454 SetBounds(gfx::Size(1, 1)); 3467 SetBounds(gfx::Size(1, 1));
3455 } 3468 }
3456 ~PushPropertiesCountingLayer() override {} 3469 ~PushPropertiesCountingLayer() override {}
3457 3470
3458 size_t push_properties_count_; 3471 size_t push_properties_count_;
3459 bool persist_needs_push_properties_; 3472 bool persist_needs_push_properties_;
3460 }; 3473 };
3461 3474
3462 class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest { 3475 class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest {
3463 protected: 3476 protected:
3464 void BeginTest() override { 3477 void BeginTest() override {
3465 num_commits_ = 0; 3478 num_commits_ = 0;
3466 expected_push_properties_root_ = 0; 3479 expected_push_properties_root_ = 0;
3467 expected_push_properties_child_ = 0; 3480 expected_push_properties_child_ = 0;
3468 expected_push_properties_grandchild_ = 0; 3481 expected_push_properties_grandchild_ = 0;
3469 expected_push_properties_child2_ = 0; 3482 expected_push_properties_child2_ = 0;
3470 expected_push_properties_other_root_ = 0; 3483 expected_push_properties_other_root_ = 0;
3471 expected_push_properties_leaf_layer_ = 0; 3484 expected_push_properties_leaf_layer_ = 0;
3472 PostSetNeedsCommitToMainThread(); 3485 PostSetNeedsCommitToMainThread();
3473 } 3486 }
3474 3487
3475 void SetupTree() override { 3488 void SetupTree() override {
3476 root_ = PushPropertiesCountingLayer::Create(); 3489 root_ = PushPropertiesCountingLayer::Create(layer_settings());
3477 root_->CreateRenderSurface(); 3490 root_->CreateRenderSurface();
3478 child_ = PushPropertiesCountingLayer::Create(); 3491 child_ = PushPropertiesCountingLayer::Create(layer_settings());
3479 child2_ = PushPropertiesCountingLayer::Create(); 3492 child2_ = PushPropertiesCountingLayer::Create(layer_settings());
3480 grandchild_ = PushPropertiesCountingLayer::Create(); 3493 grandchild_ = PushPropertiesCountingLayer::Create(layer_settings());
3481 leaf_always_pushing_layer_ = PushPropertiesCountingLayer::Create(); 3494 leaf_always_pushing_layer_ =
3495 PushPropertiesCountingLayer::Create(layer_settings());
3482 leaf_always_pushing_layer_->set_persist_needs_push_properties(true); 3496 leaf_always_pushing_layer_->set_persist_needs_push_properties(true);
3483 3497
3484 root_->AddChild(child_); 3498 root_->AddChild(child_);
3485 root_->AddChild(child2_); 3499 root_->AddChild(child2_);
3486 child_->AddChild(grandchild_); 3500 child_->AddChild(grandchild_);
3487 child2_->AddChild(leaf_always_pushing_layer_); 3501 child2_->AddChild(leaf_always_pushing_layer_);
3488 3502
3489 other_root_ = PushPropertiesCountingLayer::Create(); 3503 other_root_ = PushPropertiesCountingLayer::Create(layer_settings());
3490 other_root_->CreateRenderSurface(); 3504 other_root_->CreateRenderSurface();
3491 3505
3492 // Don't set the root layer here. 3506 // Don't set the root layer here.
3493 LayerTreeHostTest::SetupTree(); 3507 LayerTreeHostTest::SetupTree();
3494 } 3508 }
3495 3509
3496 void DidCommitAndDrawFrame() override { 3510 void DidCommitAndDrawFrame() override {
3497 EXPECT_EQ(expected_push_properties_root_, root_->push_properties_count()) 3511 EXPECT_EQ(expected_push_properties_root_, root_->push_properties_count())
3498 << "num_commits: " << num_commits_; 3512 << "num_commits: " << num_commits_;
3499 EXPECT_EQ(expected_push_properties_child_, child_->push_properties_count()) 3513 EXPECT_EQ(expected_push_properties_child_, child_->push_properties_count())
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
3858 TEST_F(LayerTreeHostTestImplLayersPushProperties, DelegatingRenderer) { 3872 TEST_F(LayerTreeHostTestImplLayersPushProperties, DelegatingRenderer) {
3859 RunTestWithImplSidePainting(); 3873 RunTestWithImplSidePainting();
3860 } 3874 }
3861 3875
3862 class LayerTreeHostTestPropertyChangesDuringUpdateArePushed 3876 class LayerTreeHostTestPropertyChangesDuringUpdateArePushed
3863 : public LayerTreeHostTest { 3877 : public LayerTreeHostTest {
3864 protected: 3878 protected:
3865 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 3879 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
3866 3880
3867 void SetupTree() override { 3881 void SetupTree() override {
3868 root_ = Layer::Create(); 3882 root_ = Layer::Create(layer_settings());
3869 root_->CreateRenderSurface(); 3883 root_->CreateRenderSurface();
3870 root_->SetBounds(gfx::Size(1, 1)); 3884 root_->SetBounds(gfx::Size(1, 1));
3871 3885
3872 bool paint_scrollbar = true; 3886 bool paint_scrollbar = true;
3873 bool has_thumb = false; 3887 bool has_thumb = false;
3874 scrollbar_layer_ = FakePaintedScrollbarLayer::Create( 3888 scrollbar_layer_ = FakePaintedScrollbarLayer::Create(
3875 paint_scrollbar, has_thumb, root_->id()); 3889 layer_settings(), paint_scrollbar, has_thumb, root_->id());
3876 3890
3877 root_->AddChild(scrollbar_layer_); 3891 root_->AddChild(scrollbar_layer_);
3878 3892
3879 layer_tree_host()->SetRootLayer(root_); 3893 layer_tree_host()->SetRootLayer(root_);
3880 LayerTreeHostTest::SetupTree(); 3894 LayerTreeHostTest::SetupTree();
3881 } 3895 }
3882 3896
3883 void DidCommitAndDrawFrame() override { 3897 void DidCommitAndDrawFrame() override {
3884 switch (layer_tree_host()->source_frame_number()) { 3898 switch (layer_tree_host()->source_frame_number()) {
3885 case 0: 3899 case 0:
(...skipping 29 matching lines...) Expand all
3915 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer_; 3929 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer_;
3916 }; 3930 };
3917 3931
3918 MULTI_THREAD_TEST_F(LayerTreeHostTestPropertyChangesDuringUpdateArePushed); 3932 MULTI_THREAD_TEST_F(LayerTreeHostTestPropertyChangesDuringUpdateArePushed);
3919 3933
3920 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { 3934 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest {
3921 protected: 3935 protected:
3922 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 3936 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
3923 3937
3924 void SetupTree() override { 3938 void SetupTree() override {
3925 root_ = PushPropertiesCountingLayer::Create(); 3939 root_ = PushPropertiesCountingLayer::Create(layer_settings());
3926 root_->CreateRenderSurface(); 3940 root_->CreateRenderSurface();
3927 child_ = PushPropertiesCountingLayer::Create(); 3941 child_ = PushPropertiesCountingLayer::Create(layer_settings());
3928 root_->AddChild(child_); 3942 root_->AddChild(child_);
3929 3943
3930 layer_tree_host()->SetRootLayer(root_); 3944 layer_tree_host()->SetRootLayer(root_);
3931 LayerTreeHostTest::SetupTree(); 3945 LayerTreeHostTest::SetupTree();
3932 } 3946 }
3933 3947
3934 void DidCommitAndDrawFrame() override { 3948 void DidCommitAndDrawFrame() override {
3935 switch (layer_tree_host()->source_frame_number()) { 3949 switch (layer_tree_host()->source_frame_number()) {
3936 case 0: 3950 case 0:
3937 break; 3951 break;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3977 void BeginTest() override { 3991 void BeginTest() override {
3978 expected_push_properties_root_ = 0; 3992 expected_push_properties_root_ = 0;
3979 expected_push_properties_child_ = 0; 3993 expected_push_properties_child_ = 0;
3980 expected_push_properties_grandchild1_ = 0; 3994 expected_push_properties_grandchild1_ = 0;
3981 expected_push_properties_grandchild2_ = 0; 3995 expected_push_properties_grandchild2_ = 0;
3982 expected_push_properties_grandchild3_ = 0; 3996 expected_push_properties_grandchild3_ = 0;
3983 PostSetNeedsCommitToMainThread(); 3997 PostSetNeedsCommitToMainThread();
3984 } 3998 }
3985 3999
3986 void SetupTree() override { 4000 void SetupTree() override {
3987 root_ = PushPropertiesCountingLayer::Create(); 4001 root_ = PushPropertiesCountingLayer::Create(layer_settings());
3988 root_->CreateRenderSurface(); 4002 root_->CreateRenderSurface();
3989 child_ = PushPropertiesCountingLayer::Create(); 4003 child_ = PushPropertiesCountingLayer::Create(layer_settings());
3990 grandchild1_ = PushPropertiesCountingLayer::Create(); 4004 grandchild1_ = PushPropertiesCountingLayer::Create(layer_settings());
3991 grandchild2_ = PushPropertiesCountingLayer::Create(); 4005 grandchild2_ = PushPropertiesCountingLayer::Create(layer_settings());
3992 grandchild3_ = PushPropertiesCountingLayer::Create(); 4006 grandchild3_ = PushPropertiesCountingLayer::Create(layer_settings());
3993 4007
3994 root_->AddChild(child_); 4008 root_->AddChild(child_);
3995 child_->AddChild(grandchild1_); 4009 child_->AddChild(grandchild1_);
3996 child_->AddChild(grandchild2_); 4010 child_->AddChild(grandchild2_);
3997 child_->AddChild(grandchild3_); 4011 child_->AddChild(grandchild3_);
3998 4012
3999 // Don't set the root layer here. 4013 // Don't set the root layer here.
4000 LayerTreeHostTest::SetupTree(); 4014 LayerTreeHostTest::SetupTree();
4001 } 4015 }
4002 4016
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
4490 int num_draws_; 4504 int num_draws_;
4491 }; 4505 };
4492 4506
4493 // VideoLayer must support being invalidated and then passing that along 4507 // VideoLayer must support being invalidated and then passing that along
4494 // to the compositor thread, even though no resources are updated in 4508 // to the compositor thread, even though no resources are updated in
4495 // response to that invalidation. 4509 // response to that invalidation.
4496 class LayerTreeHostTestVideoLayerInvalidate : public LayerInvalidateCausesDraw { 4510 class LayerTreeHostTestVideoLayerInvalidate : public LayerInvalidateCausesDraw {
4497 public: 4511 public:
4498 void SetupTree() override { 4512 void SetupTree() override {
4499 LayerTreeHostTest::SetupTree(); 4513 LayerTreeHostTest::SetupTree();
4500 scoped_refptr<VideoLayer> video_layer = 4514 scoped_refptr<VideoLayer> video_layer = VideoLayer::Create(
4501 VideoLayer::Create(&provider_, media::VIDEO_ROTATION_0); 4515 layer_settings(), &provider_, media::VIDEO_ROTATION_0);
4502 video_layer->SetBounds(gfx::Size(10, 10)); 4516 video_layer->SetBounds(gfx::Size(10, 10));
4503 video_layer->SetIsDrawable(true); 4517 video_layer->SetIsDrawable(true);
4504 layer_tree_host()->root_layer()->AddChild(video_layer); 4518 layer_tree_host()->root_layer()->AddChild(video_layer);
4505 4519
4506 invalidate_layer_ = video_layer; 4520 invalidate_layer_ = video_layer;
4507 } 4521 }
4508 4522
4509 private: 4523 private:
4510 FakeVideoFrameProvider provider_; 4524 FakeVideoFrameProvider provider_;
4511 }; 4525 };
4512 4526
4513 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate); 4527 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate);
4514 4528
4515 // IOSurfaceLayer must support being invalidated and then passing that along 4529 // IOSurfaceLayer must support being invalidated and then passing that along
4516 // to the compositor thread, even though no resources are updated in 4530 // to the compositor thread, even though no resources are updated in
4517 // response to that invalidation. 4531 // response to that invalidation.
4518 class LayerTreeHostTestIOSurfaceLayerInvalidate 4532 class LayerTreeHostTestIOSurfaceLayerInvalidate
4519 : public LayerInvalidateCausesDraw { 4533 : public LayerInvalidateCausesDraw {
4520 public: 4534 public:
4521 void SetupTree() override { 4535 void SetupTree() override {
4522 LayerTreeHostTest::SetupTree(); 4536 LayerTreeHostTest::SetupTree();
4523 scoped_refptr<IOSurfaceLayer> layer = IOSurfaceLayer::Create(); 4537 scoped_refptr<IOSurfaceLayer> layer =
4538 IOSurfaceLayer::Create(layer_settings());
4524 layer->SetBounds(gfx::Size(10, 10)); 4539 layer->SetBounds(gfx::Size(10, 10));
4525 uint32_t fake_io_surface_id = 7; 4540 uint32_t fake_io_surface_id = 7;
4526 layer->SetIOSurfaceProperties(fake_io_surface_id, layer->bounds()); 4541 layer->SetIOSurfaceProperties(fake_io_surface_id, layer->bounds());
4527 layer->SetIsDrawable(true); 4542 layer->SetIsDrawable(true);
4528 layer_tree_host()->root_layer()->AddChild(layer); 4543 layer_tree_host()->root_layer()->AddChild(layer);
4529 4544
4530 invalidate_layer_ = layer; 4545 invalidate_layer_ = layer;
4531 } 4546 }
4532 }; 4547 };
4533 4548
4534 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335 4549 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335
4535 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 4550 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
4536 LayerTreeHostTestIOSurfaceLayerInvalidate); 4551 LayerTreeHostTestIOSurfaceLayerInvalidate);
4537 4552
4538 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { 4553 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest {
4539 protected: 4554 protected:
4540 void SetupTree() override { 4555 void SetupTree() override {
4541 root_layer_ = Layer::Create(); 4556 root_layer_ = Layer::Create(layer_settings());
4542 root_layer_->CreateRenderSurface(); 4557 root_layer_->CreateRenderSurface();
4543 root_layer_->SetPosition(gfx::Point()); 4558 root_layer_->SetPosition(gfx::Point());
4544 root_layer_->SetBounds(gfx::Size(10, 10)); 4559 root_layer_->SetBounds(gfx::Size(10, 10));
4545 4560
4546 parent_layer_ = SolidColorLayer::Create(); 4561 parent_layer_ = SolidColorLayer::Create(layer_settings());
4547 parent_layer_->SetPosition(gfx::Point()); 4562 parent_layer_->SetPosition(gfx::Point());
4548 parent_layer_->SetBounds(gfx::Size(10, 10)); 4563 parent_layer_->SetBounds(gfx::Size(10, 10));
4549 parent_layer_->SetIsDrawable(true); 4564 parent_layer_->SetIsDrawable(true);
4550 root_layer_->AddChild(parent_layer_); 4565 root_layer_->AddChild(parent_layer_);
4551 4566
4552 child_layer_ = SolidColorLayer::Create(); 4567 child_layer_ = SolidColorLayer::Create(layer_settings());
4553 child_layer_->SetPosition(gfx::Point()); 4568 child_layer_->SetPosition(gfx::Point());
4554 child_layer_->SetBounds(gfx::Size(10, 10)); 4569 child_layer_->SetBounds(gfx::Size(10, 10));
4555 child_layer_->SetIsDrawable(true); 4570 child_layer_->SetIsDrawable(true);
4556 parent_layer_->AddChild(child_layer_); 4571 parent_layer_->AddChild(child_layer_);
4557 4572
4558 layer_tree_host()->SetRootLayer(root_layer_); 4573 layer_tree_host()->SetRootLayer(root_layer_);
4559 LayerTreeHostTest::SetupTree(); 4574 LayerTreeHostTest::SetupTree();
4560 } 4575 }
4561 4576
4562 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4577 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
4602 4617
4603 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer); 4618 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer);
4604 4619
4605 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { 4620 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest {
4606 protected: 4621 protected:
4607 void InitializeSettings(LayerTreeSettings* settings) override { 4622 void InitializeSettings(LayerTreeSettings* settings) override {
4608 settings->impl_side_painting = true; 4623 settings->impl_side_painting = true;
4609 } 4624 }
4610 4625
4611 void SetupTree() override { 4626 void SetupTree() override {
4612 root_layer_ = FakePictureLayer::Create(&client_); 4627 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
4613 root_layer_->SetBounds(gfx::Size(10, 10)); 4628 root_layer_->SetBounds(gfx::Size(10, 10));
4614 4629
4615 layer_tree_host()->SetRootLayer(root_layer_); 4630 layer_tree_host()->SetRootLayer(root_layer_);
4616 LayerTreeHostTest::SetupTree(); 4631 LayerTreeHostTest::SetupTree();
4617 } 4632 }
4618 4633
4619 void BeginTest() override { 4634 void BeginTest() override {
4620 // The viewport is empty, but we still need to update layers on the main 4635 // The viewport is empty, but we still need to update layers on the main
4621 // thread. 4636 // thread.
4622 layer_tree_host()->SetViewportSize(gfx::Size(0, 0)); 4637 layer_tree_host()->SetViewportSize(gfx::Size(0, 0));
(...skipping 15 matching lines...) Expand all
4638 4653
4639 MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateLayerInEmptyViewport); 4654 MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateLayerInEmptyViewport);
4640 4655
4641 class LayerTreeHostTestAbortEvictedTextures : public LayerTreeHostTest { 4656 class LayerTreeHostTestAbortEvictedTextures : public LayerTreeHostTest {
4642 public: 4657 public:
4643 LayerTreeHostTestAbortEvictedTextures() 4658 LayerTreeHostTestAbortEvictedTextures()
4644 : num_will_begin_main_frames_(0), num_impl_commits_(0) {} 4659 : num_will_begin_main_frames_(0), num_impl_commits_(0) {}
4645 4660
4646 protected: 4661 protected:
4647 void SetupTree() override { 4662 void SetupTree() override {
4648 scoped_refptr<SolidColorLayer> root_layer = SolidColorLayer::Create(); 4663 scoped_refptr<SolidColorLayer> root_layer =
4664 SolidColorLayer::Create(layer_settings());
4649 root_layer->SetBounds(gfx::Size(200, 200)); 4665 root_layer->SetBounds(gfx::Size(200, 200));
4650 root_layer->SetIsDrawable(true); 4666 root_layer->SetIsDrawable(true);
4651 root_layer->CreateRenderSurface(); 4667 root_layer->CreateRenderSurface();
4652 4668
4653 layer_tree_host()->SetRootLayer(root_layer); 4669 layer_tree_host()->SetRootLayer(root_layer);
4654 LayerTreeHostTest::SetupTree(); 4670 LayerTreeHostTest::SetupTree();
4655 } 4671 }
4656 4672
4657 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4673 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
4658 4674
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4714 context_provider->SetMaxTransferBufferUsageBytes(512 * 512); 4730 context_provider->SetMaxTransferBufferUsageBytes(512 * 512);
4715 if (delegating_renderer()) 4731 if (delegating_renderer())
4716 return FakeOutputSurface::CreateDelegating3d(context_provider); 4732 return FakeOutputSurface::CreateDelegating3d(context_provider);
4717 else 4733 else
4718 return FakeOutputSurface::Create3d(context_provider); 4734 return FakeOutputSurface::Create3d(context_provider);
4719 } 4735 }
4720 4736
4721 void SetupTree() override { 4737 void SetupTree() override {
4722 client_.set_fill_with_nonsolid_color(true); 4738 client_.set_fill_with_nonsolid_color(true);
4723 scoped_refptr<FakePictureLayer> root_layer = 4739 scoped_refptr<FakePictureLayer> root_layer =
4724 FakePictureLayer::Create(&client_); 4740 FakePictureLayer::Create(layer_settings(), &client_);
4725 root_layer->SetBounds(gfx::Size(1024, 1024)); 4741 root_layer->SetBounds(gfx::Size(1024, 1024));
4726 root_layer->SetIsDrawable(true); 4742 root_layer->SetIsDrawable(true);
4727 4743
4728 layer_tree_host()->SetRootLayer(root_layer); 4744 layer_tree_host()->SetRootLayer(root_layer);
4729 LayerTreeHostTest::SetupTree(); 4745 LayerTreeHostTest::SetupTree();
4730 } 4746 }
4731 4747
4732 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4748 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
4733 4749
4734 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { 4750 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
4869 make_scoped_ptr(new ManagedMemoryPolicy( 4885 make_scoped_ptr(new ManagedMemoryPolicy(
4870 second_context_provider_.get() ? second_output_surface_memory_limit_ 4886 second_context_provider_.get() ? second_output_surface_memory_limit_
4871 : first_output_surface_memory_limit_, 4887 : first_output_surface_memory_limit_,
4872 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, 4888 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
4873 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); 4889 ManagedMemoryPolicy::kDefaultNumResourcesLimit)));
4874 return output_surface.Pass(); 4890 return output_surface.Pass();
4875 } 4891 }
4876 4892
4877 void SetupTree() override { 4893 void SetupTree() override {
4878 if (layer_tree_host()->settings().impl_side_painting) 4894 if (layer_tree_host()->settings().impl_side_painting)
4879 root_ = FakePictureLayer::Create(&client_); 4895 root_ = FakePictureLayer::Create(layer_settings(), &client_);
4880 else 4896 else
4881 root_ = FakeContentLayer::Create(&client_); 4897 root_ = FakeContentLayer::Create(layer_settings(), &client_);
4882 root_->SetBounds(gfx::Size(20, 20)); 4898 root_->SetBounds(gfx::Size(20, 20));
4883 layer_tree_host()->SetRootLayer(root_); 4899 layer_tree_host()->SetRootLayer(root_);
4884 LayerTreeHostTest::SetupTree(); 4900 LayerTreeHostTest::SetupTree();
4885 } 4901 }
4886 4902
4887 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4903 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
4888 4904
4889 void DidCommitAndDrawFrame() override { 4905 void DidCommitAndDrawFrame() override {
4890 // Lost context sometimes takes two frames to recreate. The third frame 4906 // Lost context sometimes takes two frames to recreate. The third frame
4891 // is sometimes aborted, so wait until the fourth frame to verify that 4907 // is sometimes aborted, so wait until the fourth frame to verify that
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
5073 TestSwapPromiseResult swap_promise_result_[3]; 5089 TestSwapPromiseResult swap_promise_result_[3];
5074 }; 5090 };
5075 5091
5076 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); 5092 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise);
5077 5093
5078 class LayerTreeHostTestKeepSwapPromise : public LayerTreeTest { 5094 class LayerTreeHostTestKeepSwapPromise : public LayerTreeTest {
5079 public: 5095 public:
5080 LayerTreeHostTestKeepSwapPromise() {} 5096 LayerTreeHostTestKeepSwapPromise() {}
5081 5097
5082 void BeginTest() override { 5098 void BeginTest() override {
5083 layer_ = SolidColorLayer::Create(); 5099 layer_ = SolidColorLayer::Create(layer_settings());
5084 layer_->SetIsDrawable(true); 5100 layer_->SetIsDrawable(true);
5085 layer_->SetBounds(gfx::Size(10, 10)); 5101 layer_->SetBounds(gfx::Size(10, 10));
5086 layer_tree_host()->SetRootLayer(layer_); 5102 layer_tree_host()->SetRootLayer(layer_);
5087 gfx::Size bounds(100, 100); 5103 gfx::Size bounds(100, 100);
5088 layer_tree_host()->SetViewportSize(bounds); 5104 layer_tree_host()->SetViewportSize(bounds);
5089 PostSetNeedsCommitToMainThread(); 5105 PostSetNeedsCommitToMainThread();
5090 } 5106 }
5091 5107
5092 void DidCommit() override { 5108 void DidCommit() override {
5093 MainThreadTaskRunner()->PostTask( 5109 MainThreadTaskRunner()->PostTask(
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
5392 void InitializeSettings(LayerTreeSettings* settings) override { 5408 void InitializeSettings(LayerTreeSettings* settings) override {
5393 settings->impl_side_painting = true; 5409 settings->impl_side_painting = true;
5394 5410
5395 EXPECT_FALSE(settings->gpu_rasterization_enabled); 5411 EXPECT_FALSE(settings->gpu_rasterization_enabled);
5396 EXPECT_FALSE(settings->gpu_rasterization_forced); 5412 EXPECT_FALSE(settings->gpu_rasterization_forced);
5397 } 5413 }
5398 5414
5399 void SetupTree() override { 5415 void SetupTree() override {
5400 LayerTreeHostTest::SetupTree(); 5416 LayerTreeHostTest::SetupTree();
5401 5417
5402 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&layer_client_); 5418 scoped_refptr<PictureLayer> layer =
5419 PictureLayer::Create(layer_settings(), &layer_client_);
5403 layer->SetBounds(gfx::Size(10, 10)); 5420 layer->SetBounds(gfx::Size(10, 10));
5404 layer->SetIsDrawable(true); 5421 layer->SetIsDrawable(true);
5405 layer_tree_host()->root_layer()->AddChild(layer); 5422 layer_tree_host()->root_layer()->AddChild(layer);
5406 } 5423 }
5407 5424
5408 void BeginTest() override { 5425 void BeginTest() override {
5409 Layer* root = layer_tree_host()->root_layer(); 5426 Layer* root = layer_tree_host()->root_layer();
5410 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0)); 5427 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0));
5411 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); 5428 RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
5412 5429
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
5446 void InitializeSettings(LayerTreeSettings* settings) override { 5463 void InitializeSettings(LayerTreeSettings* settings) override {
5447 settings->impl_side_painting = true; 5464 settings->impl_side_painting = true;
5448 5465
5449 EXPECT_FALSE(settings->gpu_rasterization_enabled); 5466 EXPECT_FALSE(settings->gpu_rasterization_enabled);
5450 settings->gpu_rasterization_enabled = true; 5467 settings->gpu_rasterization_enabled = true;
5451 } 5468 }
5452 5469
5453 void SetupTree() override { 5470 void SetupTree() override {
5454 LayerTreeHostTest::SetupTree(); 5471 LayerTreeHostTest::SetupTree();
5455 5472
5456 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&layer_client_); 5473 scoped_refptr<PictureLayer> layer =
5474 PictureLayer::Create(layer_settings(), &layer_client_);
5457 layer->SetBounds(gfx::Size(10, 10)); 5475 layer->SetBounds(gfx::Size(10, 10));
5458 layer->SetIsDrawable(true); 5476 layer->SetIsDrawable(true);
5459 layer_tree_host()->root_layer()->AddChild(layer); 5477 layer_tree_host()->root_layer()->AddChild(layer);
5460 } 5478 }
5461 5479
5462 void BeginTest() override { 5480 void BeginTest() override {
5463 Layer* root = layer_tree_host()->root_layer(); 5481 Layer* root = layer_tree_host()->root_layer();
5464 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0)); 5482 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0));
5465 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); 5483 RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
5466 5484
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
5510 ASSERT_TRUE(settings->impl_side_painting); 5528 ASSERT_TRUE(settings->impl_side_painting);
5511 5529
5512 EXPECT_FALSE(settings->gpu_rasterization_forced); 5530 EXPECT_FALSE(settings->gpu_rasterization_forced);
5513 settings->gpu_rasterization_forced = true; 5531 settings->gpu_rasterization_forced = true;
5514 } 5532 }
5515 5533
5516 void SetupTree() override { 5534 void SetupTree() override {
5517 LayerTreeHostTest::SetupTree(); 5535 LayerTreeHostTest::SetupTree();
5518 5536
5519 scoped_refptr<FakePictureLayer> layer = 5537 scoped_refptr<FakePictureLayer> layer =
5520 FakePictureLayer::Create(&layer_client_); 5538 FakePictureLayer::Create(layer_settings(), &layer_client_);
5521 layer->SetBounds(gfx::Size(10, 10)); 5539 layer->SetBounds(gfx::Size(10, 10));
5522 layer->SetIsDrawable(true); 5540 layer->SetIsDrawable(true);
5523 layer_tree_host()->root_layer()->AddChild(layer); 5541 layer_tree_host()->root_layer()->AddChild(layer);
5524 } 5542 }
5525 5543
5526 void BeginTest() override { 5544 void BeginTest() override {
5527 Layer* root = layer_tree_host()->root_layer(); 5545 Layer* root = layer_tree_host()->root_layer();
5528 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0)); 5546 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0));
5529 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); 5547 RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
5530 5548
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
5570 5588
5571 class LayerTreeHostTestContinuousPainting : public LayerTreeHostTest { 5589 class LayerTreeHostTestContinuousPainting : public LayerTreeHostTest {
5572 public: 5590 public:
5573 LayerTreeHostTestContinuousPainting() 5591 LayerTreeHostTestContinuousPainting()
5574 : num_commits_(0), num_draws_(0), bounds_(20, 20), child_layer_(NULL) {} 5592 : num_commits_(0), num_draws_(0), bounds_(20, 20), child_layer_(NULL) {}
5575 5593
5576 protected: 5594 protected:
5577 enum { kExpectedNumCommits = 10 }; 5595 enum { kExpectedNumCommits = 10 };
5578 5596
5579 void SetupTree() override { 5597 void SetupTree() override {
5580 scoped_refptr<Layer> root_layer = Layer::Create(); 5598 scoped_refptr<Layer> root_layer = Layer::Create(layer_settings());
5581 root_layer->SetBounds(bounds_); 5599 root_layer->SetBounds(bounds_);
5582 root_layer->CreateRenderSurface(); 5600 root_layer->CreateRenderSurface();
5583 5601
5584 if (layer_tree_host()->settings().impl_side_painting) { 5602 if (layer_tree_host()->settings().impl_side_painting) {
5585 picture_layer_ = FakePictureLayer::Create(&client_); 5603 picture_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
5586 child_layer_ = picture_layer_.get(); 5604 child_layer_ = picture_layer_.get();
5587 } else { 5605 } else {
5588 content_layer_ = ContentLayerWithUpdateTracking::Create(&client_); 5606 content_layer_ =
5607 ContentLayerWithUpdateTracking::Create(layer_settings(), &client_);
5589 child_layer_ = content_layer_.get(); 5608 child_layer_ = content_layer_.get();
5590 } 5609 }
5591 child_layer_->SetBounds(bounds_); 5610 child_layer_->SetBounds(bounds_);
5592 child_layer_->SetIsDrawable(true); 5611 child_layer_->SetIsDrawable(true);
5593 root_layer->AddChild(child_layer_); 5612 root_layer->AddChild(child_layer_);
5594 5613
5595 layer_tree_host()->SetRootLayer(root_layer); 5614 layer_tree_host()->SetRootLayer(root_layer);
5596 layer_tree_host()->SetViewportSize(bounds_); 5615 layer_tree_host()->SetViewportSize(bounds_);
5597 LayerTreeHostTest::SetupTree(); 5616 LayerTreeHostTest::SetupTree();
5598 } 5617 }
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
5979 class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest { 5998 class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest {
5980 protected: 5999 protected:
5981 LayerTreeHostTestCrispUpAfterPinchEnds() 6000 LayerTreeHostTestCrispUpAfterPinchEnds()
5982 : playback_allowed_event_(true, true) {} 6001 : playback_allowed_event_(true, true) {}
5983 6002
5984 void SetupTree() override { 6003 void SetupTree() override {
5985 frame_ = 1; 6004 frame_ = 1;
5986 posted_ = false; 6005 posted_ = false;
5987 client_.set_fill_with_nonsolid_color(true); 6006 client_.set_fill_with_nonsolid_color(true);
5988 6007
5989 scoped_refptr<Layer> root = Layer::Create(); 6008 scoped_refptr<Layer> root = Layer::Create(layer_settings());
5990 root->SetBounds(gfx::Size(500, 500)); 6009 root->SetBounds(gfx::Size(500, 500));
5991 6010
5992 scoped_refptr<Layer> pinch = Layer::Create(); 6011 scoped_refptr<Layer> pinch = Layer::Create(layer_settings());
5993 pinch->SetBounds(gfx::Size(500, 500)); 6012 pinch->SetBounds(gfx::Size(500, 500));
5994 pinch->SetScrollClipLayerId(root->id()); 6013 pinch->SetScrollClipLayerId(root->id());
5995 pinch->SetIsContainerForFixedPositionLayers(true); 6014 pinch->SetIsContainerForFixedPositionLayers(true);
5996 root->AddChild(pinch); 6015 root->AddChild(pinch);
5997 6016
5998 scoped_ptr<FakePicturePile> pile( 6017 scoped_ptr<FakePicturePile> pile(
5999 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 6018 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
6000 ImplSidePaintingSettings().default_tile_grid_size)); 6019 ImplSidePaintingSettings().default_tile_grid_size));
6001 pile->SetPlaybackAllowedEvent(&playback_allowed_event_); 6020 pile->SetPlaybackAllowedEvent(&playback_allowed_event_);
6002 scoped_refptr<FakePictureLayer> layer = 6021 scoped_refptr<FakePictureLayer> layer =
6003 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 6022 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
6023 pile.Pass());
6004 layer->SetBounds(gfx::Size(500, 500)); 6024 layer->SetBounds(gfx::Size(500, 500));
6005 layer->SetContentsOpaque(true); 6025 layer->SetContentsOpaque(true);
6006 // Avoid LCD text on the layer so we don't cause extra commits when we 6026 // Avoid LCD text on the layer so we don't cause extra commits when we
6007 // pinch. 6027 // pinch.
6008 layer->disable_lcd_text(); 6028 layer->disable_lcd_text();
6009 pinch->AddChild(layer); 6029 pinch->AddChild(layer);
6010 6030
6011 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch); 6031 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch);
6012 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); 6032 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f);
6013 layer_tree_host()->SetRootLayer(root); 6033 layer_tree_host()->SetRootLayer(root);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
6190 RasterizeWithGpuRasterizationCreatesResources() {} 6210 RasterizeWithGpuRasterizationCreatesResources() {}
6191 6211
6192 void InitializeSettings(LayerTreeSettings* settings) override { 6212 void InitializeSettings(LayerTreeSettings* settings) override {
6193 settings->impl_side_painting = true; 6213 settings->impl_side_painting = true;
6194 settings->gpu_rasterization_forced = true; 6214 settings->gpu_rasterization_forced = true;
6195 } 6215 }
6196 6216
6197 void SetupTree() override { 6217 void SetupTree() override {
6198 client_.set_fill_with_nonsolid_color(true); 6218 client_.set_fill_with_nonsolid_color(true);
6199 6219
6200 scoped_refptr<Layer> root = Layer::Create(); 6220 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6201 root->SetBounds(gfx::Size(500, 500)); 6221 root->SetBounds(gfx::Size(500, 500));
6202 6222
6203 scoped_ptr<FakePicturePile> pile( 6223 scoped_ptr<FakePicturePile> pile(
6204 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 6224 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
6205 ImplSidePaintingSettings().default_tile_grid_size)); 6225 ImplSidePaintingSettings().default_tile_grid_size));
6206 scoped_refptr<FakePictureLayer> layer = 6226 scoped_refptr<FakePictureLayer> layer =
6207 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 6227 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
6228 pile.Pass());
6208 layer->SetBounds(gfx::Size(500, 500)); 6229 layer->SetBounds(gfx::Size(500, 500));
6209 layer->SetContentsOpaque(true); 6230 layer->SetContentsOpaque(true);
6210 root->AddChild(layer); 6231 root->AddChild(layer);
6211 6232
6212 layer_tree_host()->SetRootLayer(root); 6233 layer_tree_host()->SetRootLayer(root);
6213 LayerTreeHostTest::SetupTree(); 6234 LayerTreeHostTest::SetupTree();
6214 } 6235 }
6215 6236
6216 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6237 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6217 6238
(...skipping 21 matching lines...) Expand all
6239 settings->gpu_rasterization_forced = true; 6260 settings->gpu_rasterization_forced = true;
6240 } 6261 }
6241 6262
6242 void SetupTree() override { 6263 void SetupTree() override {
6243 client_.set_fill_with_nonsolid_color(true); 6264 client_.set_fill_with_nonsolid_color(true);
6244 6265
6245 scoped_ptr<FakePicturePile> pile( 6266 scoped_ptr<FakePicturePile> pile(
6246 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 6267 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
6247 ImplSidePaintingSettings().default_tile_grid_size)); 6268 ImplSidePaintingSettings().default_tile_grid_size));
6248 scoped_refptr<FakePictureLayer> root = 6269 scoped_refptr<FakePictureLayer> root =
6249 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 6270 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
6271 pile.Pass());
6250 root->SetBounds(gfx::Size(10000, 10000)); 6272 root->SetBounds(gfx::Size(10000, 10000));
6251 root->SetContentsOpaque(true); 6273 root->SetContentsOpaque(true);
6252 6274
6253 layer_tree_host()->SetRootLayer(root); 6275 layer_tree_host()->SetRootLayer(root);
6254 LayerTreeHostTest::SetupTree(); 6276 LayerTreeHostTest::SetupTree();
6255 layer_tree_host()->SetViewportSize(viewport_size_); 6277 layer_tree_host()->SetViewportSize(viewport_size_);
6256 } 6278 }
6257 6279
6258 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6280 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6259 6281
(...skipping 22 matching lines...) Expand all
6282 6304
6283 void InitializeSettings(LayerTreeSettings* settings) override { 6305 void InitializeSettings(LayerTreeSettings* settings) override {
6284 settings->impl_side_painting = true; 6306 settings->impl_side_painting = true;
6285 } 6307 }
6286 6308
6287 void SetupTree() override { 6309 void SetupTree() override {
6288 step_ = 1; 6310 step_ = 1;
6289 continuous_draws_ = 0; 6311 continuous_draws_ = 0;
6290 client_.set_fill_with_nonsolid_color(true); 6312 client_.set_fill_with_nonsolid_color(true);
6291 6313
6292 scoped_refptr<Layer> root = Layer::Create(); 6314 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6293 root->SetBounds(gfx::Size(500, 500)); 6315 root->SetBounds(gfx::Size(500, 500));
6294 6316
6295 scoped_refptr<Layer> pinch = Layer::Create(); 6317 scoped_refptr<Layer> pinch = Layer::Create(layer_settings());
6296 pinch->SetBounds(gfx::Size(500, 500)); 6318 pinch->SetBounds(gfx::Size(500, 500));
6297 pinch->SetScrollClipLayerId(root->id()); 6319 pinch->SetScrollClipLayerId(root->id());
6298 pinch->SetIsContainerForFixedPositionLayers(true); 6320 pinch->SetIsContainerForFixedPositionLayers(true);
6299 root->AddChild(pinch); 6321 root->AddChild(pinch);
6300 6322
6301 scoped_ptr<FakePicturePile> pile( 6323 scoped_ptr<FakePicturePile> pile(
6302 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 6324 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
6303 ImplSidePaintingSettings().default_tile_grid_size)); 6325 ImplSidePaintingSettings().default_tile_grid_size));
6304 pile->SetPlaybackAllowedEvent(&playback_allowed_event_); 6326 pile->SetPlaybackAllowedEvent(&playback_allowed_event_);
6305 scoped_refptr<FakePictureLayer> layer = 6327 scoped_refptr<FakePictureLayer> layer =
6306 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 6328 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
6329 pile.Pass());
6307 layer->SetBounds(gfx::Size(500, 500)); 6330 layer->SetBounds(gfx::Size(500, 500));
6308 layer->SetContentsOpaque(true); 6331 layer->SetContentsOpaque(true);
6309 // Avoid LCD text on the layer so we don't cause extra commits when we 6332 // Avoid LCD text on the layer so we don't cause extra commits when we
6310 // pinch. 6333 // pinch.
6311 layer->disable_lcd_text(); 6334 layer->disable_lcd_text();
6312 pinch->AddChild(layer); 6335 pinch->AddChild(layer);
6313 6336
6314 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch); 6337 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch);
6315 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); 6338 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f);
6316 layer_tree_host()->SetRootLayer(root); 6339 layer_tree_host()->SetRootLayer(root);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
6455 6478
6456 class LayerTreeHostTestOneActivatePerPrepareTiles : public LayerTreeHostTest { 6479 class LayerTreeHostTestOneActivatePerPrepareTiles : public LayerTreeHostTest {
6457 public: 6480 public:
6458 LayerTreeHostTestOneActivatePerPrepareTiles() 6481 LayerTreeHostTestOneActivatePerPrepareTiles()
6459 : notify_ready_to_activate_count_(0u), 6482 : notify_ready_to_activate_count_(0u),
6460 scheduled_prepare_tiles_count_(0) {} 6483 scheduled_prepare_tiles_count_(0) {}
6461 6484
6462 void SetupTree() override { 6485 void SetupTree() override {
6463 client_.set_fill_with_nonsolid_color(true); 6486 client_.set_fill_with_nonsolid_color(true);
6464 scoped_refptr<FakePictureLayer> root_layer = 6487 scoped_refptr<FakePictureLayer> root_layer =
6465 FakePictureLayer::Create(&client_); 6488 FakePictureLayer::Create(layer_settings(), &client_);
6466 root_layer->SetBounds(gfx::Size(1500, 1500)); 6489 root_layer->SetBounds(gfx::Size(1500, 1500));
6467 root_layer->SetIsDrawable(true); 6490 root_layer->SetIsDrawable(true);
6468 6491
6469 layer_tree_host()->SetRootLayer(root_layer); 6492 layer_tree_host()->SetRootLayer(root_layer);
6470 LayerTreeHostTest::SetupTree(); 6493 LayerTreeHostTest::SetupTree();
6471 } 6494 }
6472 6495
6473 void BeginTest() override { 6496 void BeginTest() override {
6474 layer_tree_host()->SetViewportSize(gfx::Size(16, 16)); 6497 layer_tree_host()->SetViewportSize(gfx::Size(16, 16));
6475 PostSetNeedsCommitToMainThread(); 6498 PostSetNeedsCommitToMainThread();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
6510 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestOneActivatePerPrepareTiles); 6533 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestOneActivatePerPrepareTiles);
6511 6534
6512 class LayerTreeHostTestFrameTimingRequestsSaveTimestamps 6535 class LayerTreeHostTestFrameTimingRequestsSaveTimestamps
6513 : public LayerTreeHostTest { 6536 : public LayerTreeHostTest {
6514 public: 6537 public:
6515 LayerTreeHostTestFrameTimingRequestsSaveTimestamps() 6538 LayerTreeHostTestFrameTimingRequestsSaveTimestamps()
6516 : check_results_on_commit_(false) {} 6539 : check_results_on_commit_(false) {}
6517 6540
6518 void SetupTree() override { 6541 void SetupTree() override {
6519 scoped_refptr<FakePictureLayer> root_layer = 6542 scoped_refptr<FakePictureLayer> root_layer =
6520 FakePictureLayer::Create(&client_); 6543 FakePictureLayer::Create(layer_settings(), &client_);
6521 root_layer->SetBounds(gfx::Size(200, 200)); 6544 root_layer->SetBounds(gfx::Size(200, 200));
6522 root_layer->SetIsDrawable(true); 6545 root_layer->SetIsDrawable(true);
6523 6546
6524 scoped_refptr<FakePictureLayer> child_layer = 6547 scoped_refptr<FakePictureLayer> child_layer =
6525 FakePictureLayer::Create(&client_); 6548 FakePictureLayer::Create(layer_settings(), &client_);
6526 child_layer->SetBounds(gfx::Size(1500, 1500)); 6549 child_layer->SetBounds(gfx::Size(1500, 1500));
6527 child_layer->SetIsDrawable(true); 6550 child_layer->SetIsDrawable(true);
6528 6551
6529 std::vector<FrameTimingRequest> requests; 6552 std::vector<FrameTimingRequest> requests;
6530 requests.push_back(FrameTimingRequest(1, gfx::Rect(0, 0, 100, 100))); 6553 requests.push_back(FrameTimingRequest(1, gfx::Rect(0, 0, 100, 100)));
6531 requests.push_back(FrameTimingRequest(2, gfx::Rect(300, 0, 100, 100))); 6554 requests.push_back(FrameTimingRequest(2, gfx::Rect(300, 0, 100, 100)));
6532 child_layer->SetFrameTimingRequests(requests); 6555 child_layer->SetFrameTimingRequests(requests);
6533 6556
6534 root_layer->AddChild(child_layer); 6557 root_layer->AddChild(child_layer);
6535 layer_tree_host()->SetRootLayer(root_layer); 6558 layer_tree_host()->SetRootLayer(root_layer);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
6596 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestFrameTimingRequestsSaveTimestamps); 6619 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestFrameTimingRequestsSaveTimestamps);
6597 6620
6598 class LayerTreeHostTestActivationCausesPrepareTiles : public LayerTreeHostTest { 6621 class LayerTreeHostTestActivationCausesPrepareTiles : public LayerTreeHostTest {
6599 public: 6622 public:
6600 LayerTreeHostTestActivationCausesPrepareTiles() 6623 LayerTreeHostTestActivationCausesPrepareTiles()
6601 : scheduled_prepare_tiles_count_(0) {} 6624 : scheduled_prepare_tiles_count_(0) {}
6602 6625
6603 void SetupTree() override { 6626 void SetupTree() override {
6604 client_.set_fill_with_nonsolid_color(true); 6627 client_.set_fill_with_nonsolid_color(true);
6605 scoped_refptr<FakePictureLayer> root_layer = 6628 scoped_refptr<FakePictureLayer> root_layer =
6606 FakePictureLayer::Create(&client_); 6629 FakePictureLayer::Create(layer_settings(), &client_);
6607 root_layer->SetBounds(gfx::Size(150, 150)); 6630 root_layer->SetBounds(gfx::Size(150, 150));
6608 root_layer->SetIsDrawable(true); 6631 root_layer->SetIsDrawable(true);
6609 6632
6610 layer_tree_host()->SetRootLayer(root_layer); 6633 layer_tree_host()->SetRootLayer(root_layer);
6611 LayerTreeHostTest::SetupTree(); 6634 LayerTreeHostTest::SetupTree();
6612 } 6635 }
6613 6636
6614 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6637 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6615 6638
6616 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { 6639 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6676 6699
6677 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); 6700 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit);
6678 6701
6679 // Verify that if a LayerImpl holds onto a copy request for multiple 6702 // Verify that if a LayerImpl holds onto a copy request for multiple
6680 // frames that it will continue to have a render surface through 6703 // frames that it will continue to have a render surface through
6681 // multiple commits, even though the Layer itself has no reason 6704 // multiple commits, even though the Layer itself has no reason
6682 // to have a render surface. 6705 // to have a render surface.
6683 class LayerPreserveRenderSurfaceFromOutputRequests : public LayerTreeHostTest { 6706 class LayerPreserveRenderSurfaceFromOutputRequests : public LayerTreeHostTest {
6684 protected: 6707 protected:
6685 void SetupTree() override { 6708 void SetupTree() override {
6686 scoped_refptr<Layer> root = Layer::Create(); 6709 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6687 root->CreateRenderSurface(); 6710 root->CreateRenderSurface();
6688 root->SetBounds(gfx::Size(10, 10)); 6711 root->SetBounds(gfx::Size(10, 10));
6689 child_ = Layer::Create(); 6712 child_ = Layer::Create(layer_settings());
6690 child_->SetBounds(gfx::Size(20, 20)); 6713 child_->SetBounds(gfx::Size(20, 20));
6691 root->AddChild(child_); 6714 root->AddChild(child_);
6692 6715
6693 layer_tree_host()->SetRootLayer(root); 6716 layer_tree_host()->SetRootLayer(root);
6694 LayerTreeHostTest::SetupTree(); 6717 LayerTreeHostTest::SetupTree();
6695 } 6718 }
6696 6719
6697 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} 6720 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {}
6698 6721
6699 void BeginTest() override { 6722 void BeginTest() override {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
6751 6774
6752 private: 6775 private:
6753 scoped_refptr<Layer> child_; 6776 scoped_refptr<Layer> child_;
6754 }; 6777 };
6755 6778
6756 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests); 6779 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests);
6757 6780
6758 class LayerTreeHostTestUpdateCopyRequests : public LayerTreeHostTest { 6781 class LayerTreeHostTestUpdateCopyRequests : public LayerTreeHostTest {
6759 protected: 6782 protected:
6760 void SetupTree() override { 6783 void SetupTree() override {
6761 root = Layer::Create(); 6784 root = Layer::Create(layer_settings());
6762 child = Layer::Create(); 6785 child = Layer::Create(layer_settings());
6763 root->AddChild(child); 6786 root->AddChild(child);
6764 layer_tree_host()->SetRootLayer(root); 6787 layer_tree_host()->SetRootLayer(root);
6765 LayerTreeHostTest::SetupTree(); 6788 LayerTreeHostTest::SetupTree();
6766 } 6789 }
6767 6790
6768 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} 6791 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {}
6769 6792
6770 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6793 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6771 6794
6772 void DidCommit() override { 6795 void DidCommit() override {
(...skipping 21 matching lines...) Expand all
6794 6817
6795 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateCopyRequests); 6818 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateCopyRequests);
6796 6819
6797 class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest { 6820 class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest {
6798 protected: 6821 protected:
6799 void SetupTree() override { 6822 void SetupTree() override {
6800 // The masked layer has bounds 50x50, but it has a child that causes 6823 // The masked layer has bounds 50x50, but it has a child that causes
6801 // the surface bounds to be larger. It also has a parent that clips the 6824 // the surface bounds to be larger. It also has a parent that clips the
6802 // masked layer and its surface. 6825 // masked layer and its surface.
6803 6826
6804 scoped_refptr<Layer> root = Layer::Create(); 6827 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6805 6828
6806 scoped_refptr<Layer> clipping_layer = Layer::Create(); 6829 scoped_refptr<Layer> clipping_layer = Layer::Create(layer_settings());
6807 root->AddChild(clipping_layer); 6830 root->AddChild(clipping_layer);
6808 6831
6809 scoped_refptr<FakePictureLayer> content_layer = 6832 scoped_refptr<FakePictureLayer> content_layer =
6810 FakePictureLayer::Create(&client_); 6833 FakePictureLayer::Create(layer_settings(), &client_);
6811 clipping_layer->AddChild(content_layer); 6834 clipping_layer->AddChild(content_layer);
6812 6835
6813 scoped_refptr<FakePictureLayer> content_child_layer = 6836 scoped_refptr<FakePictureLayer> content_child_layer =
6814 FakePictureLayer::Create(&client_); 6837 FakePictureLayer::Create(layer_settings(), &client_);
6815 content_layer->AddChild(content_child_layer); 6838 content_layer->AddChild(content_child_layer);
6816 6839
6817 scoped_refptr<FakePictureLayer> mask_layer = 6840 scoped_refptr<FakePictureLayer> mask_layer =
6818 FakePictureLayer::Create(&client_); 6841 FakePictureLayer::Create(layer_settings(), &client_);
6819 content_layer->SetMaskLayer(mask_layer.get()); 6842 content_layer->SetMaskLayer(mask_layer.get());
6820 6843
6821 gfx::Size root_size(100, 100); 6844 gfx::Size root_size(100, 100);
6822 root->SetBounds(root_size); 6845 root->SetBounds(root_size);
6823 6846
6824 gfx::Rect clipping_rect(20, 10, 10, 20); 6847 gfx::Rect clipping_rect(20, 10, 10, 20);
6825 clipping_layer->SetBounds(clipping_rect.size()); 6848 clipping_layer->SetBounds(clipping_rect.size());
6826 clipping_layer->SetPosition(clipping_rect.origin()); 6849 clipping_layer->SetPosition(clipping_rect.origin());
6827 clipping_layer->SetMasksToBounds(true); 6850 clipping_layer->SetMasksToBounds(true);
6828 6851
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6888 } 6911 }
6889 6912
6890 void SetupTree() override { 6913 void SetupTree() override {
6891 // Root 6914 // Root
6892 // | 6915 // |
6893 // +-- Scaling Layer (adds a 2x scale) 6916 // +-- Scaling Layer (adds a 2x scale)
6894 // | 6917 // |
6895 // +-- Content Layer 6918 // +-- Content Layer
6896 // +--Mask 6919 // +--Mask
6897 6920
6898 scoped_refptr<Layer> root = Layer::Create(); 6921 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6899 6922
6900 scoped_refptr<Layer> scaling_layer = Layer::Create(); 6923 scoped_refptr<Layer> scaling_layer = Layer::Create(layer_settings());
6901 root->AddChild(scaling_layer); 6924 root->AddChild(scaling_layer);
6902 6925
6903 scoped_refptr<FakePictureLayer> content_layer = 6926 scoped_refptr<FakePictureLayer> content_layer =
6904 FakePictureLayer::Create(&client_); 6927 FakePictureLayer::Create(layer_settings(), &client_);
6905 scaling_layer->AddChild(content_layer); 6928 scaling_layer->AddChild(content_layer);
6906 6929
6907 scoped_refptr<FakePictureLayer> mask_layer = 6930 scoped_refptr<FakePictureLayer> mask_layer =
6908 FakePictureLayer::Create(&client_); 6931 FakePictureLayer::Create(layer_settings(), &client_);
6909 content_layer->SetMaskLayer(mask_layer.get()); 6932 content_layer->SetMaskLayer(mask_layer.get());
6910 6933
6911 gfx::Size root_size(100, 100); 6934 gfx::Size root_size(100, 100);
6912 root->SetBounds(root_size); 6935 root->SetBounds(root_size);
6913 6936
6914 gfx::Size scaling_layer_size(50, 50); 6937 gfx::Size scaling_layer_size(50, 50);
6915 scaling_layer->SetBounds(scaling_layer_size); 6938 scaling_layer->SetBounds(scaling_layer_size);
6916 gfx::Transform scale; 6939 gfx::Transform scale;
6917 scale.Scale(2.f, 2.f); 6940 scale.Scale(2.f, 2.f);
6918 scaling_layer->SetTransform(scale); 6941 scaling_layer->SetTransform(scale);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
6983 }; 7006 };
6984 7007
6985 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling); 7008 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling);
6986 7009
6987 class LayerTreeTestMaskLayerWithDifferentBounds : public LayerTreeTest { 7010 class LayerTreeTestMaskLayerWithDifferentBounds : public LayerTreeTest {
6988 protected: 7011 protected:
6989 void SetupTree() override { 7012 void SetupTree() override {
6990 // The mask layer has bounds 100x100 but is attached to a layer with bounds 7013 // The mask layer has bounds 100x100 but is attached to a layer with bounds
6991 // 50x50. 7014 // 50x50.
6992 7015
6993 scoped_refptr<Layer> root = Layer::Create(); 7016 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6994 7017
6995 scoped_refptr<FakePictureLayer> content_layer = 7018 scoped_refptr<FakePictureLayer> content_layer =
6996 FakePictureLayer::Create(&client_); 7019 FakePictureLayer::Create(layer_settings(), &client_);
6997 root->AddChild(content_layer); 7020 root->AddChild(content_layer);
6998 7021
6999 scoped_refptr<FakePictureLayer> mask_layer = 7022 scoped_refptr<FakePictureLayer> mask_layer =
7000 FakePictureLayer::Create(&client_); 7023 FakePictureLayer::Create(layer_settings(), &client_);
7001 content_layer->SetMaskLayer(mask_layer.get()); 7024 content_layer->SetMaskLayer(mask_layer.get());
7002 7025
7003 gfx::Size root_size(100, 100); 7026 gfx::Size root_size(100, 100);
7004 root->SetBounds(root_size); 7027 root->SetBounds(root_size);
7005 7028
7006 gfx::Size layer_size(50, 50); 7029 gfx::Size layer_size(50, 50);
7007 content_layer->SetBounds(layer_size); 7030 content_layer->SetBounds(layer_size);
7008 7031
7009 gfx::Size mask_size(100, 100); 7032 gfx::Size mask_size(100, 100);
7010 mask_layer->SetBounds(mask_size); 7033 mask_layer->SetBounds(mask_size);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
7071 7094
7072 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds); 7095 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds);
7073 7096
7074 class LayerTreeTestReflectionMaskLayerWithDifferentBounds 7097 class LayerTreeTestReflectionMaskLayerWithDifferentBounds
7075 : public LayerTreeTest { 7098 : public LayerTreeTest {
7076 protected: 7099 protected:
7077 void SetupTree() override { 7100 void SetupTree() override {
7078 // The replica's mask layer has bounds 100x100 but the replica is of a 7101 // The replica's mask layer has bounds 100x100 but the replica is of a
7079 // layer with bounds 50x50. 7102 // layer with bounds 50x50.
7080 7103
7081 scoped_refptr<Layer> root = Layer::Create(); 7104 scoped_refptr<Layer> root = Layer::Create(layer_settings());
7082 7105
7083 scoped_refptr<FakePictureLayer> content_layer = 7106 scoped_refptr<FakePictureLayer> content_layer =
7084 FakePictureLayer::Create(&client_); 7107 FakePictureLayer::Create(layer_settings(), &client_);
7085 root->AddChild(content_layer); 7108 root->AddChild(content_layer);
7086 7109
7087 scoped_refptr<Layer> replica_layer = Layer::Create(); 7110 scoped_refptr<Layer> replica_layer = Layer::Create(layer_settings());
7088 content_layer->SetReplicaLayer(replica_layer.get()); 7111 content_layer->SetReplicaLayer(replica_layer.get());
7089 7112
7090 scoped_refptr<FakePictureLayer> mask_layer = 7113 scoped_refptr<FakePictureLayer> mask_layer =
7091 FakePictureLayer::Create(&client_); 7114 FakePictureLayer::Create(layer_settings(), &client_);
7092 replica_layer->SetMaskLayer(mask_layer.get()); 7115 replica_layer->SetMaskLayer(mask_layer.get());
7093 7116
7094 gfx::Size root_size(100, 100); 7117 gfx::Size root_size(100, 100);
7095 root->SetBounds(root_size); 7118 root->SetBounds(root_size);
7096 7119
7097 gfx::Size layer_size(50, 50); 7120 gfx::Size layer_size(50, 50);
7098 content_layer->SetBounds(layer_size); 7121 content_layer->SetBounds(layer_size);
7099 7122
7100 gfx::Size mask_size(100, 100); 7123 gfx::Size mask_size(100, 100);
7101 mask_layer->SetBounds(mask_size); 7124 mask_layer->SetBounds(mask_size);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
7164 SINGLE_AND_MULTI_THREAD_TEST_F( 7187 SINGLE_AND_MULTI_THREAD_TEST_F(
7165 LayerTreeTestReflectionMaskLayerWithDifferentBounds); 7188 LayerTreeTestReflectionMaskLayerWithDifferentBounds);
7166 7189
7167 class LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild 7190 class LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild
7168 : public LayerTreeTest { 7191 : public LayerTreeTest {
7169 protected: 7192 protected:
7170 void SetupTree() override { 7193 void SetupTree() override {
7171 // The replica is of a layer with bounds 50x50, but it has a child that 7194 // The replica is of a layer with bounds 50x50, but it has a child that
7172 // causes the surface bounds to be larger. 7195 // causes the surface bounds to be larger.
7173 7196
7174 scoped_refptr<Layer> root = Layer::Create(); 7197 scoped_refptr<Layer> root = Layer::Create(layer_settings());
7175 7198
7176 scoped_refptr<FakePictureLayer> content_layer = 7199 scoped_refptr<FakePictureLayer> content_layer =
7177 FakePictureLayer::Create(&client_); 7200 FakePictureLayer::Create(layer_settings(), &client_);
7178 root->AddChild(content_layer); 7201 root->AddChild(content_layer);
7179 7202
7180 content_child_layer_ = FakePictureLayer::Create(&client_); 7203 content_child_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
7181 content_layer->AddChild(content_child_layer_); 7204 content_layer->AddChild(content_child_layer_);
7182 7205
7183 scoped_refptr<Layer> replica_layer = Layer::Create(); 7206 scoped_refptr<Layer> replica_layer = Layer::Create(layer_settings());
7184 content_layer->SetReplicaLayer(replica_layer.get()); 7207 content_layer->SetReplicaLayer(replica_layer.get());
7185 7208
7186 scoped_refptr<FakePictureLayer> mask_layer = 7209 scoped_refptr<FakePictureLayer> mask_layer =
7187 FakePictureLayer::Create(&client_); 7210 FakePictureLayer::Create(layer_settings(), &client_);
7188 replica_layer->SetMaskLayer(mask_layer.get()); 7211 replica_layer->SetMaskLayer(mask_layer.get());
7189 7212
7190 gfx::Size root_size(100, 100); 7213 gfx::Size root_size(100, 100);
7191 root->SetBounds(root_size); 7214 root->SetBounds(root_size);
7192 7215
7193 gfx::Size layer_size(50, 50); 7216 gfx::Size layer_size(50, 50);
7194 content_layer->SetBounds(layer_size); 7217 content_layer->SetBounds(layer_size);
7195 content_child_layer_->SetBounds(layer_size); 7218 content_child_layer_->SetBounds(layer_size);
7196 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f)); 7219 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f));
7197 7220
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
7258 void AfterTest() override {} 7281 void AfterTest() override {}
7259 7282
7260 scoped_refptr<FakePictureLayer> content_child_layer_; 7283 scoped_refptr<FakePictureLayer> content_child_layer_;
7261 FakeContentLayerClient client_; 7284 FakeContentLayerClient client_;
7262 }; 7285 };
7263 7286
7264 SINGLE_AND_MULTI_THREAD_TEST_F( 7287 SINGLE_AND_MULTI_THREAD_TEST_F(
7265 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild); 7288 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild);
7266 7289
7267 } // namespace cc 7290 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_pixeltest_synchronous.cc ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698