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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
2581 host->Composite(base::TimeTicks::Now()); 2586 host->Composite(base::TimeTicks::Now());
2582 2587
2583 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); 2588 EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
2584 } 2589 }
2585 2590
2586 // TODO(sohanjg) : Remove it once impl-side painting ships everywhere. 2591 // TODO(sohanjg) : Remove it once impl-side painting ships everywhere.
2587 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted 2592 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted
2588 : public LayerTreeHostTest { 2593 : public LayerTreeHostTest {
2589 public: 2594 public:
2590 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() 2595 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted()
2591 : root_layer_(FakeContentLayer::Create(&client_)), 2596 : root_layer_(FakeContentLayer::Create(layer_settings(), &client_)),
2592 child_layer1_(FakeContentLayer::Create(&client_)), 2597 child_layer1_(FakeContentLayer::Create(layer_settings(), &client_)),
2593 child_layer2_(FakeContentLayer::Create(&client_)), 2598 child_layer2_(FakeContentLayer::Create(layer_settings(), &client_)),
2594 num_commits_(0) {} 2599 num_commits_(0) {}
2595 2600
2596 void BeginTest() override { 2601 void BeginTest() override {
2597 layer_tree_host()->SetViewportSize(gfx::Size(100, 100)); 2602 layer_tree_host()->SetViewportSize(gfx::Size(100, 100));
2598 root_layer_->SetBounds(gfx::Size(100, 100)); 2603 root_layer_->SetBounds(gfx::Size(100, 100));
2599 child_layer1_->SetBounds(gfx::Size(100, 100)); 2604 child_layer1_->SetBounds(gfx::Size(100, 100));
2600 child_layer2_->SetBounds(gfx::Size(100, 100)); 2605 child_layer2_->SetBounds(gfx::Size(100, 100));
2601 root_layer_->AddChild(child_layer1_); 2606 root_layer_->AddChild(child_layer1_);
2602 root_layer_->AddChild(child_layer2_); 2607 root_layer_->AddChild(child_layer2_);
2603 layer_tree_host()->SetRootLayer(root_layer_); 2608 layer_tree_host()->SetRootLayer(root_layer_);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2663 }; 2668 };
2664 2669
2665 SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F( 2670 SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(
2666 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted); 2671 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted);
2667 2672
2668 class LayerTreeHostTestLCDChange : public LayerTreeHostTest { 2673 class LayerTreeHostTestLCDChange : public LayerTreeHostTest {
2669 public: 2674 public:
2670 void SetupTree() override { 2675 void SetupTree() override {
2671 num_tiles_rastered_ = 0; 2676 num_tiles_rastered_ = 0;
2672 2677
2673 scoped_refptr<Layer> root_layer = PictureLayer::Create(&client_); 2678 scoped_refptr<Layer> root_layer =
2679 PictureLayer::Create(layer_settings(), &client_);
2674 client_.set_fill_with_nonsolid_color(true); 2680 client_.set_fill_with_nonsolid_color(true);
2675 root_layer->SetIsDrawable(true); 2681 root_layer->SetIsDrawable(true);
2676 root_layer->SetBounds(gfx::Size(10, 10)); 2682 root_layer->SetBounds(gfx::Size(10, 10));
2677 root_layer->SetContentsOpaque(true); 2683 root_layer->SetContentsOpaque(true);
2678 2684
2679 layer_tree_host()->SetRootLayer(root_layer); 2685 layer_tree_host()->SetRootLayer(root_layer);
2680 2686
2681 // The expectations are based on the assumption that the default 2687 // The expectations are based on the assumption that the default
2682 // LCD settings are: 2688 // LCD settings are:
2683 EXPECT_TRUE(layer_tree_host()->settings().can_use_lcd_text); 2689 EXPECT_TRUE(layer_tree_host()->settings().can_use_lcd_text);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2895 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation 2901 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation
2896 : public LayerTreeHostTest { 2902 : public LayerTreeHostTest {
2897 protected: 2903 protected:
2898 void InitializeSettings(LayerTreeSettings* settings) override { 2904 void InitializeSettings(LayerTreeSettings* settings) override {
2899 settings->impl_side_painting = true; 2905 settings->impl_side_painting = true;
2900 } 2906 }
2901 2907
2902 void SetupTree() override { 2908 void SetupTree() override {
2903 LayerTreeHostTest::SetupTree(); 2909 LayerTreeHostTest::SetupTree();
2904 2910
2905 scoped_refptr<Layer> layer = PictureLayer::Create(&client_); 2911 scoped_refptr<Layer> layer =
2912 PictureLayer::Create(layer_settings(), &client_);
2906 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); 2913 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
2907 layer->SetBounds(gfx::Size(10, 10)); 2914 layer->SetBounds(gfx::Size(10, 10));
2908 layer_tree_host()->root_layer()->AddChild(layer); 2915 layer_tree_host()->root_layer()->AddChild(layer);
2909 } 2916 }
2910 2917
2911 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 2918 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
2912 2919
2913 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 2920 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
2914 EndTest(); 2921 EndTest();
2915 } 2922 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2947 bool FillsBoundsCompletely() const override { return false; } 2954 bool FillsBoundsCompletely() const override { return false; }
2948 2955
2949 private: 2956 private:
2950 Layer* layer_; 2957 Layer* layer_;
2951 }; 2958 };
2952 2959
2953 LayerTreeHostTestChangeLayerPropertiesInPaintContents() : num_commits_(0) {} 2960 LayerTreeHostTestChangeLayerPropertiesInPaintContents() : num_commits_(0) {}
2954 2961
2955 void SetupTree() override { 2962 void SetupTree() override {
2956 if (layer_tree_host()->settings().impl_side_painting) { 2963 if (layer_tree_host()->settings().impl_side_painting) {
2957 scoped_refptr<PictureLayer> root_layer = PictureLayer::Create(&client_); 2964 scoped_refptr<PictureLayer> root_layer =
2965 PictureLayer::Create(layer_settings(), &client_);
2958 layer_tree_host()->SetRootLayer(root_layer); 2966 layer_tree_host()->SetRootLayer(root_layer);
2959 } else { 2967 } else {
2960 scoped_refptr<ContentLayer> root_layer = ContentLayer::Create(&client_); 2968 scoped_refptr<ContentLayer> root_layer =
2969 ContentLayer::Create(layer_settings(), &client_);
2961 layer_tree_host()->SetRootLayer(root_layer); 2970 layer_tree_host()->SetRootLayer(root_layer);
2962 } 2971 }
2963 Layer* root_layer = layer_tree_host()->root_layer(); 2972 Layer* root_layer = layer_tree_host()->root_layer();
2964 root_layer->SetIsDrawable(true); 2973 root_layer->SetIsDrawable(true);
2965 root_layer->SetBounds(gfx::Size(1, 1)); 2974 root_layer->SetBounds(gfx::Size(1, 1));
2966 2975
2967 client_.set_layer(root_layer); 2976 client_.set_layer(root_layer);
2968 2977
2969 LayerTreeHostTest::SetupTree(); 2978 LayerTreeHostTest::SetupTree();
2970 } 2979 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
3034 } 3043 }
3035 3044
3036 void SetupTree() override { 3045 void SetupTree() override {
3037 LayerTreeHostTest::SetupTree(); 3046 LayerTreeHostTest::SetupTree();
3038 3047
3039 layer_tree_host()->root_layer()->SetIsDrawable(false); 3048 layer_tree_host()->root_layer()->SetIsDrawable(false);
3040 3049
3041 io_surface_id_ = 9; 3050 io_surface_id_ = 9;
3042 io_surface_size_ = gfx::Size(6, 7); 3051 io_surface_size_ = gfx::Size(6, 7);
3043 3052
3044 scoped_refptr<IOSurfaceLayer> io_surface_layer = IOSurfaceLayer::Create(); 3053 scoped_refptr<IOSurfaceLayer> io_surface_layer =
3054 IOSurfaceLayer::Create(layer_settings());
3045 io_surface_layer->SetBounds(gfx::Size(10, 10)); 3055 io_surface_layer->SetBounds(gfx::Size(10, 10));
3046 io_surface_layer->SetIsDrawable(true); 3056 io_surface_layer->SetIsDrawable(true);
3047 io_surface_layer->SetContentsOpaque(true); 3057 io_surface_layer->SetContentsOpaque(true);
3048 io_surface_layer->SetIOSurfaceProperties(io_surface_id_, io_surface_size_); 3058 io_surface_layer->SetIOSurfaceProperties(io_surface_id_, io_surface_size_);
3049 layer_tree_host()->root_layer()->AddChild(io_surface_layer); 3059 layer_tree_host()->root_layer()->AddChild(io_surface_layer);
3050 } 3060 }
3051 3061
3052 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 3062 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
3053 3063
3054 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 3064 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3187 RunTest(true, true, true); 3197 RunTest(true, true, true);
3188 } 3198 }
3189 3199
3190 TEST_F(LayerTreeHostTestNumFramesPending, DISABLED_GLRenderer) { 3200 TEST_F(LayerTreeHostTestNumFramesPending, DISABLED_GLRenderer) {
3191 RunTest(true, false, true); 3201 RunTest(true, false, true);
3192 } 3202 }
3193 3203
3194 class LayerTreeHostTestResourcelessSoftwareDraw : public LayerTreeHostTest { 3204 class LayerTreeHostTestResourcelessSoftwareDraw : public LayerTreeHostTest {
3195 public: 3205 public:
3196 void SetupTree() override { 3206 void SetupTree() override {
3197 root_layer_ = FakePictureLayer::Create(&client_); 3207 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
3198 root_layer_->SetIsDrawable(true); 3208 root_layer_->SetIsDrawable(true);
3199 root_layer_->SetBounds(gfx::Size(50, 50)); 3209 root_layer_->SetBounds(gfx::Size(50, 50));
3200 3210
3201 parent_layer_ = FakePictureLayer::Create(&client_); 3211 parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
3202 parent_layer_->SetIsDrawable(true); 3212 parent_layer_->SetIsDrawable(true);
3203 parent_layer_->SetBounds(gfx::Size(50, 50)); 3213 parent_layer_->SetBounds(gfx::Size(50, 50));
3204 parent_layer_->SetForceRenderSurface(true); 3214 parent_layer_->SetForceRenderSurface(true);
3205 3215
3206 child_layer_ = FakePictureLayer::Create(&client_); 3216 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
3207 child_layer_->SetIsDrawable(true); 3217 child_layer_->SetIsDrawable(true);
3208 child_layer_->SetBounds(gfx::Size(50, 50)); 3218 child_layer_->SetBounds(gfx::Size(50, 50));
3209 3219
3210 root_layer_->AddChild(parent_layer_); 3220 root_layer_->AddChild(parent_layer_);
3211 parent_layer_->AddChild(child_layer_); 3221 parent_layer_->AddChild(child_layer_);
3212 layer_tree_host()->SetRootLayer(root_layer_); 3222 layer_tree_host()->SetRootLayer(root_layer_);
3213 3223
3214 LayerTreeHostTest::SetupTree(); 3224 LayerTreeHostTest::SetupTree();
3215 } 3225 }
3216 3226
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
3413 3423
3414 PushPropertiesCountingLayerImpl(LayerTreeImpl* tree_impl, int id) 3424 PushPropertiesCountingLayerImpl(LayerTreeImpl* tree_impl, int id)
3415 : LayerImpl(tree_impl, id), 3425 : LayerImpl(tree_impl, id),
3416 push_properties_count_(0) { 3426 push_properties_count_(0) {
3417 SetBounds(gfx::Size(1, 1)); 3427 SetBounds(gfx::Size(1, 1));
3418 } 3428 }
3419 }; 3429 };
3420 3430
3421 class PushPropertiesCountingLayer : public Layer { 3431 class PushPropertiesCountingLayer : public Layer {
3422 public: 3432 public:
3423 static scoped_refptr<PushPropertiesCountingLayer> Create() { 3433 static scoped_refptr<PushPropertiesCountingLayer> Create(
3424 return new PushPropertiesCountingLayer(); 3434 const LayerSettings& settings) {
3435 return new PushPropertiesCountingLayer(settings);
3425 } 3436 }
3426 3437
3427 void PushPropertiesTo(LayerImpl* layer) override { 3438 void PushPropertiesTo(LayerImpl* layer) override {
3428 Layer::PushPropertiesTo(layer); 3439 Layer::PushPropertiesTo(layer);
3429 push_properties_count_++; 3440 push_properties_count_++;
3430 if (persist_needs_push_properties_) 3441 if (persist_needs_push_properties_)
3431 needs_push_properties_ = true; 3442 needs_push_properties_ = true;
3432 } 3443 }
3433 3444
3434 // Something to make this layer push properties, but no other layer. 3445 // Something to make this layer push properties, but no other layer.
3435 void MakePushProperties() { SetContentsOpaque(!contents_opaque()); } 3446 void MakePushProperties() { SetContentsOpaque(!contents_opaque()); }
3436 3447
3437 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override { 3448 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override {
3438 return PushPropertiesCountingLayerImpl::Create(tree_impl, id()); 3449 return PushPropertiesCountingLayerImpl::Create(tree_impl, id());
3439 } 3450 }
3440 3451
3441 void SetDrawsContent(bool draws_content) { SetIsDrawable(draws_content); } 3452 void SetDrawsContent(bool draws_content) { SetIsDrawable(draws_content); }
3442 3453
3443 size_t push_properties_count() const { return push_properties_count_; } 3454 size_t push_properties_count() const { return push_properties_count_; }
3444 void reset_push_properties_count() { push_properties_count_ = 0; } 3455 void reset_push_properties_count() { push_properties_count_ = 0; }
3445 3456
3446 void set_persist_needs_push_properties(bool persist) { 3457 void set_persist_needs_push_properties(bool persist) {
3447 persist_needs_push_properties_ = persist; 3458 persist_needs_push_properties_ = persist;
3448 } 3459 }
3449 3460
3450 private: 3461 private:
3451 PushPropertiesCountingLayer() 3462 explicit PushPropertiesCountingLayer(const LayerSettings& settings)
3452 : push_properties_count_(0), persist_needs_push_properties_(false) { 3463 : Layer(settings),
3464 push_properties_count_(0),
3465 persist_needs_push_properties_(false) {
3453 SetBounds(gfx::Size(1, 1)); 3466 SetBounds(gfx::Size(1, 1));
3454 } 3467 }
3455 ~PushPropertiesCountingLayer() override {} 3468 ~PushPropertiesCountingLayer() override {}
3456 3469
3457 size_t push_properties_count_; 3470 size_t push_properties_count_;
3458 bool persist_needs_push_properties_; 3471 bool persist_needs_push_properties_;
3459 }; 3472 };
3460 3473
3461 class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest { 3474 class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest {
3462 protected: 3475 protected:
3463 void BeginTest() override { 3476 void BeginTest() override {
3464 num_commits_ = 0; 3477 num_commits_ = 0;
3465 expected_push_properties_root_ = 0; 3478 expected_push_properties_root_ = 0;
3466 expected_push_properties_child_ = 0; 3479 expected_push_properties_child_ = 0;
3467 expected_push_properties_grandchild_ = 0; 3480 expected_push_properties_grandchild_ = 0;
3468 expected_push_properties_child2_ = 0; 3481 expected_push_properties_child2_ = 0;
3469 expected_push_properties_other_root_ = 0; 3482 expected_push_properties_other_root_ = 0;
3470 expected_push_properties_leaf_layer_ = 0; 3483 expected_push_properties_leaf_layer_ = 0;
3471 PostSetNeedsCommitToMainThread(); 3484 PostSetNeedsCommitToMainThread();
3472 } 3485 }
3473 3486
3474 void SetupTree() override { 3487 void SetupTree() override {
3475 root_ = PushPropertiesCountingLayer::Create(); 3488 root_ = PushPropertiesCountingLayer::Create(layer_settings());
3476 root_->CreateRenderSurface(); 3489 root_->CreateRenderSurface();
3477 child_ = PushPropertiesCountingLayer::Create(); 3490 child_ = PushPropertiesCountingLayer::Create(layer_settings());
3478 child2_ = PushPropertiesCountingLayer::Create(); 3491 child2_ = PushPropertiesCountingLayer::Create(layer_settings());
3479 grandchild_ = PushPropertiesCountingLayer::Create(); 3492 grandchild_ = PushPropertiesCountingLayer::Create(layer_settings());
3480 leaf_always_pushing_layer_ = PushPropertiesCountingLayer::Create(); 3493 leaf_always_pushing_layer_ =
3494 PushPropertiesCountingLayer::Create(layer_settings());
3481 leaf_always_pushing_layer_->set_persist_needs_push_properties(true); 3495 leaf_always_pushing_layer_->set_persist_needs_push_properties(true);
3482 3496
3483 root_->AddChild(child_); 3497 root_->AddChild(child_);
3484 root_->AddChild(child2_); 3498 root_->AddChild(child2_);
3485 child_->AddChild(grandchild_); 3499 child_->AddChild(grandchild_);
3486 child2_->AddChild(leaf_always_pushing_layer_); 3500 child2_->AddChild(leaf_always_pushing_layer_);
3487 3501
3488 other_root_ = PushPropertiesCountingLayer::Create(); 3502 other_root_ = PushPropertiesCountingLayer::Create(layer_settings());
3489 other_root_->CreateRenderSurface(); 3503 other_root_->CreateRenderSurface();
3490 3504
3491 // Don't set the root layer here. 3505 // Don't set the root layer here.
3492 LayerTreeHostTest::SetupTree(); 3506 LayerTreeHostTest::SetupTree();
3493 } 3507 }
3494 3508
3495 void DidCommitAndDrawFrame() override { 3509 void DidCommitAndDrawFrame() override {
3496 EXPECT_EQ(expected_push_properties_root_, root_->push_properties_count()) 3510 EXPECT_EQ(expected_push_properties_root_, root_->push_properties_count())
3497 << "num_commits: " << num_commits_; 3511 << "num_commits: " << num_commits_;
3498 EXPECT_EQ(expected_push_properties_child_, child_->push_properties_count()) 3512 EXPECT_EQ(expected_push_properties_child_, child_->push_properties_count())
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
3857 TEST_F(LayerTreeHostTestImplLayersPushProperties, DelegatingRenderer) { 3871 TEST_F(LayerTreeHostTestImplLayersPushProperties, DelegatingRenderer) {
3858 RunTestWithImplSidePainting(); 3872 RunTestWithImplSidePainting();
3859 } 3873 }
3860 3874
3861 class LayerTreeHostTestPropertyChangesDuringUpdateArePushed 3875 class LayerTreeHostTestPropertyChangesDuringUpdateArePushed
3862 : public LayerTreeHostTest { 3876 : public LayerTreeHostTest {
3863 protected: 3877 protected:
3864 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 3878 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
3865 3879
3866 void SetupTree() override { 3880 void SetupTree() override {
3867 root_ = Layer::Create(); 3881 root_ = Layer::Create(layer_settings());
3868 root_->CreateRenderSurface(); 3882 root_->CreateRenderSurface();
3869 root_->SetBounds(gfx::Size(1, 1)); 3883 root_->SetBounds(gfx::Size(1, 1));
3870 3884
3871 bool paint_scrollbar = true; 3885 bool paint_scrollbar = true;
3872 bool has_thumb = false; 3886 bool has_thumb = false;
3873 scrollbar_layer_ = FakePaintedScrollbarLayer::Create( 3887 scrollbar_layer_ = FakePaintedScrollbarLayer::Create(
3874 paint_scrollbar, has_thumb, root_->id()); 3888 layer_settings(), paint_scrollbar, has_thumb, root_->id());
3875 3889
3876 root_->AddChild(scrollbar_layer_); 3890 root_->AddChild(scrollbar_layer_);
3877 3891
3878 layer_tree_host()->SetRootLayer(root_); 3892 layer_tree_host()->SetRootLayer(root_);
3879 LayerTreeHostTest::SetupTree(); 3893 LayerTreeHostTest::SetupTree();
3880 } 3894 }
3881 3895
3882 void DidCommitAndDrawFrame() override { 3896 void DidCommitAndDrawFrame() override {
3883 switch (layer_tree_host()->source_frame_number()) { 3897 switch (layer_tree_host()->source_frame_number()) {
3884 case 0: 3898 case 0:
(...skipping 29 matching lines...) Expand all
3914 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer_; 3928 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer_;
3915 }; 3929 };
3916 3930
3917 MULTI_THREAD_TEST_F(LayerTreeHostTestPropertyChangesDuringUpdateArePushed); 3931 MULTI_THREAD_TEST_F(LayerTreeHostTestPropertyChangesDuringUpdateArePushed);
3918 3932
3919 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { 3933 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest {
3920 protected: 3934 protected:
3921 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 3935 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
3922 3936
3923 void SetupTree() override { 3937 void SetupTree() override {
3924 root_ = PushPropertiesCountingLayer::Create(); 3938 root_ = PushPropertiesCountingLayer::Create(layer_settings());
3925 root_->CreateRenderSurface(); 3939 root_->CreateRenderSurface();
3926 child_ = PushPropertiesCountingLayer::Create(); 3940 child_ = PushPropertiesCountingLayer::Create(layer_settings());
3927 root_->AddChild(child_); 3941 root_->AddChild(child_);
3928 3942
3929 layer_tree_host()->SetRootLayer(root_); 3943 layer_tree_host()->SetRootLayer(root_);
3930 LayerTreeHostTest::SetupTree(); 3944 LayerTreeHostTest::SetupTree();
3931 } 3945 }
3932 3946
3933 void DidCommitAndDrawFrame() override { 3947 void DidCommitAndDrawFrame() override {
3934 switch (layer_tree_host()->source_frame_number()) { 3948 switch (layer_tree_host()->source_frame_number()) {
3935 case 0: 3949 case 0:
3936 break; 3950 break;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3976 void BeginTest() override { 3990 void BeginTest() override {
3977 expected_push_properties_root_ = 0; 3991 expected_push_properties_root_ = 0;
3978 expected_push_properties_child_ = 0; 3992 expected_push_properties_child_ = 0;
3979 expected_push_properties_grandchild1_ = 0; 3993 expected_push_properties_grandchild1_ = 0;
3980 expected_push_properties_grandchild2_ = 0; 3994 expected_push_properties_grandchild2_ = 0;
3981 expected_push_properties_grandchild3_ = 0; 3995 expected_push_properties_grandchild3_ = 0;
3982 PostSetNeedsCommitToMainThread(); 3996 PostSetNeedsCommitToMainThread();
3983 } 3997 }
3984 3998
3985 void SetupTree() override { 3999 void SetupTree() override {
3986 root_ = PushPropertiesCountingLayer::Create(); 4000 root_ = PushPropertiesCountingLayer::Create(layer_settings());
3987 root_->CreateRenderSurface(); 4001 root_->CreateRenderSurface();
3988 child_ = PushPropertiesCountingLayer::Create(); 4002 child_ = PushPropertiesCountingLayer::Create(layer_settings());
3989 grandchild1_ = PushPropertiesCountingLayer::Create(); 4003 grandchild1_ = PushPropertiesCountingLayer::Create(layer_settings());
3990 grandchild2_ = PushPropertiesCountingLayer::Create(); 4004 grandchild2_ = PushPropertiesCountingLayer::Create(layer_settings());
3991 grandchild3_ = PushPropertiesCountingLayer::Create(); 4005 grandchild3_ = PushPropertiesCountingLayer::Create(layer_settings());
3992 4006
3993 root_->AddChild(child_); 4007 root_->AddChild(child_);
3994 child_->AddChild(grandchild1_); 4008 child_->AddChild(grandchild1_);
3995 child_->AddChild(grandchild2_); 4009 child_->AddChild(grandchild2_);
3996 child_->AddChild(grandchild3_); 4010 child_->AddChild(grandchild3_);
3997 4011
3998 // Don't set the root layer here. 4012 // Don't set the root layer here.
3999 LayerTreeHostTest::SetupTree(); 4013 LayerTreeHostTest::SetupTree();
4000 } 4014 }
4001 4015
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
4489 int num_draws_; 4503 int num_draws_;
4490 }; 4504 };
4491 4505
4492 // VideoLayer must support being invalidated and then passing that along 4506 // VideoLayer must support being invalidated and then passing that along
4493 // to the compositor thread, even though no resources are updated in 4507 // to the compositor thread, even though no resources are updated in
4494 // response to that invalidation. 4508 // response to that invalidation.
4495 class LayerTreeHostTestVideoLayerInvalidate : public LayerInvalidateCausesDraw { 4509 class LayerTreeHostTestVideoLayerInvalidate : public LayerInvalidateCausesDraw {
4496 public: 4510 public:
4497 void SetupTree() override { 4511 void SetupTree() override {
4498 LayerTreeHostTest::SetupTree(); 4512 LayerTreeHostTest::SetupTree();
4499 scoped_refptr<VideoLayer> video_layer = 4513 scoped_refptr<VideoLayer> video_layer = VideoLayer::Create(
4500 VideoLayer::Create(&provider_, media::VIDEO_ROTATION_0); 4514 layer_settings(), &provider_, media::VIDEO_ROTATION_0);
4501 video_layer->SetBounds(gfx::Size(10, 10)); 4515 video_layer->SetBounds(gfx::Size(10, 10));
4502 video_layer->SetIsDrawable(true); 4516 video_layer->SetIsDrawable(true);
4503 layer_tree_host()->root_layer()->AddChild(video_layer); 4517 layer_tree_host()->root_layer()->AddChild(video_layer);
4504 4518
4505 invalidate_layer_ = video_layer; 4519 invalidate_layer_ = video_layer;
4506 } 4520 }
4507 4521
4508 private: 4522 private:
4509 FakeVideoFrameProvider provider_; 4523 FakeVideoFrameProvider provider_;
4510 }; 4524 };
4511 4525
4512 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate); 4526 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate);
4513 4527
4514 // IOSurfaceLayer must support being invalidated and then passing that along 4528 // IOSurfaceLayer must support being invalidated and then passing that along
4515 // to the compositor thread, even though no resources are updated in 4529 // to the compositor thread, even though no resources are updated in
4516 // response to that invalidation. 4530 // response to that invalidation.
4517 class LayerTreeHostTestIOSurfaceLayerInvalidate 4531 class LayerTreeHostTestIOSurfaceLayerInvalidate
4518 : public LayerInvalidateCausesDraw { 4532 : public LayerInvalidateCausesDraw {
4519 public: 4533 public:
4520 void SetupTree() override { 4534 void SetupTree() override {
4521 LayerTreeHostTest::SetupTree(); 4535 LayerTreeHostTest::SetupTree();
4522 scoped_refptr<IOSurfaceLayer> layer = IOSurfaceLayer::Create(); 4536 scoped_refptr<IOSurfaceLayer> layer =
4537 IOSurfaceLayer::Create(layer_settings());
4523 layer->SetBounds(gfx::Size(10, 10)); 4538 layer->SetBounds(gfx::Size(10, 10));
4524 uint32_t fake_io_surface_id = 7; 4539 uint32_t fake_io_surface_id = 7;
4525 layer->SetIOSurfaceProperties(fake_io_surface_id, layer->bounds()); 4540 layer->SetIOSurfaceProperties(fake_io_surface_id, layer->bounds());
4526 layer->SetIsDrawable(true); 4541 layer->SetIsDrawable(true);
4527 layer_tree_host()->root_layer()->AddChild(layer); 4542 layer_tree_host()->root_layer()->AddChild(layer);
4528 4543
4529 invalidate_layer_ = layer; 4544 invalidate_layer_ = layer;
4530 } 4545 }
4531 }; 4546 };
4532 4547
4533 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335 4548 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335
4534 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 4549 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
4535 LayerTreeHostTestIOSurfaceLayerInvalidate); 4550 LayerTreeHostTestIOSurfaceLayerInvalidate);
4536 4551
4537 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { 4552 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest {
4538 protected: 4553 protected:
4539 void SetupTree() override { 4554 void SetupTree() override {
4540 root_layer_ = Layer::Create(); 4555 root_layer_ = Layer::Create(layer_settings());
4541 root_layer_->CreateRenderSurface(); 4556 root_layer_->CreateRenderSurface();
4542 root_layer_->SetPosition(gfx::Point()); 4557 root_layer_->SetPosition(gfx::Point());
4543 root_layer_->SetBounds(gfx::Size(10, 10)); 4558 root_layer_->SetBounds(gfx::Size(10, 10));
4544 4559
4545 parent_layer_ = SolidColorLayer::Create(); 4560 parent_layer_ = SolidColorLayer::Create(layer_settings());
4546 parent_layer_->SetPosition(gfx::Point()); 4561 parent_layer_->SetPosition(gfx::Point());
4547 parent_layer_->SetBounds(gfx::Size(10, 10)); 4562 parent_layer_->SetBounds(gfx::Size(10, 10));
4548 parent_layer_->SetIsDrawable(true); 4563 parent_layer_->SetIsDrawable(true);
4549 root_layer_->AddChild(parent_layer_); 4564 root_layer_->AddChild(parent_layer_);
4550 4565
4551 child_layer_ = SolidColorLayer::Create(); 4566 child_layer_ = SolidColorLayer::Create(layer_settings());
4552 child_layer_->SetPosition(gfx::Point()); 4567 child_layer_->SetPosition(gfx::Point());
4553 child_layer_->SetBounds(gfx::Size(10, 10)); 4568 child_layer_->SetBounds(gfx::Size(10, 10));
4554 child_layer_->SetIsDrawable(true); 4569 child_layer_->SetIsDrawable(true);
4555 parent_layer_->AddChild(child_layer_); 4570 parent_layer_->AddChild(child_layer_);
4556 4571
4557 layer_tree_host()->SetRootLayer(root_layer_); 4572 layer_tree_host()->SetRootLayer(root_layer_);
4558 LayerTreeHostTest::SetupTree(); 4573 LayerTreeHostTest::SetupTree();
4559 } 4574 }
4560 4575
4561 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4576 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
4601 4616
4602 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer); 4617 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer);
4603 4618
4604 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { 4619 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest {
4605 protected: 4620 protected:
4606 void InitializeSettings(LayerTreeSettings* settings) override { 4621 void InitializeSettings(LayerTreeSettings* settings) override {
4607 settings->impl_side_painting = true; 4622 settings->impl_side_painting = true;
4608 } 4623 }
4609 4624
4610 void SetupTree() override { 4625 void SetupTree() override {
4611 root_layer_ = FakePictureLayer::Create(&client_); 4626 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
4612 root_layer_->SetBounds(gfx::Size(10, 10)); 4627 root_layer_->SetBounds(gfx::Size(10, 10));
4613 4628
4614 layer_tree_host()->SetRootLayer(root_layer_); 4629 layer_tree_host()->SetRootLayer(root_layer_);
4615 LayerTreeHostTest::SetupTree(); 4630 LayerTreeHostTest::SetupTree();
4616 } 4631 }
4617 4632
4618 void BeginTest() override { 4633 void BeginTest() override {
4619 // The viewport is empty, but we still need to update layers on the main 4634 // The viewport is empty, but we still need to update layers on the main
4620 // thread. 4635 // thread.
4621 layer_tree_host()->SetViewportSize(gfx::Size(0, 0)); 4636 layer_tree_host()->SetViewportSize(gfx::Size(0, 0));
(...skipping 15 matching lines...) Expand all
4637 4652
4638 MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateLayerInEmptyViewport); 4653 MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateLayerInEmptyViewport);
4639 4654
4640 class LayerTreeHostTestAbortEvictedTextures : public LayerTreeHostTest { 4655 class LayerTreeHostTestAbortEvictedTextures : public LayerTreeHostTest {
4641 public: 4656 public:
4642 LayerTreeHostTestAbortEvictedTextures() 4657 LayerTreeHostTestAbortEvictedTextures()
4643 : num_will_begin_main_frames_(0), num_impl_commits_(0) {} 4658 : num_will_begin_main_frames_(0), num_impl_commits_(0) {}
4644 4659
4645 protected: 4660 protected:
4646 void SetupTree() override { 4661 void SetupTree() override {
4647 scoped_refptr<SolidColorLayer> root_layer = SolidColorLayer::Create(); 4662 scoped_refptr<SolidColorLayer> root_layer =
4663 SolidColorLayer::Create(layer_settings());
4648 root_layer->SetBounds(gfx::Size(200, 200)); 4664 root_layer->SetBounds(gfx::Size(200, 200));
4649 root_layer->SetIsDrawable(true); 4665 root_layer->SetIsDrawable(true);
4650 root_layer->CreateRenderSurface(); 4666 root_layer->CreateRenderSurface();
4651 4667
4652 layer_tree_host()->SetRootLayer(root_layer); 4668 layer_tree_host()->SetRootLayer(root_layer);
4653 LayerTreeHostTest::SetupTree(); 4669 LayerTreeHostTest::SetupTree();
4654 } 4670 }
4655 4671
4656 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4672 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
4657 4673
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4713 context_provider->SetMaxTransferBufferUsageBytes(512 * 512); 4729 context_provider->SetMaxTransferBufferUsageBytes(512 * 512);
4714 if (delegating_renderer()) 4730 if (delegating_renderer())
4715 return FakeOutputSurface::CreateDelegating3d(context_provider); 4731 return FakeOutputSurface::CreateDelegating3d(context_provider);
4716 else 4732 else
4717 return FakeOutputSurface::Create3d(context_provider); 4733 return FakeOutputSurface::Create3d(context_provider);
4718 } 4734 }
4719 4735
4720 void SetupTree() override { 4736 void SetupTree() override {
4721 client_.set_fill_with_nonsolid_color(true); 4737 client_.set_fill_with_nonsolid_color(true);
4722 scoped_refptr<FakePictureLayer> root_layer = 4738 scoped_refptr<FakePictureLayer> root_layer =
4723 FakePictureLayer::Create(&client_); 4739 FakePictureLayer::Create(layer_settings(), &client_);
4724 root_layer->SetBounds(gfx::Size(1024, 1024)); 4740 root_layer->SetBounds(gfx::Size(1024, 1024));
4725 root_layer->SetIsDrawable(true); 4741 root_layer->SetIsDrawable(true);
4726 4742
4727 layer_tree_host()->SetRootLayer(root_layer); 4743 layer_tree_host()->SetRootLayer(root_layer);
4728 LayerTreeHostTest::SetupTree(); 4744 LayerTreeHostTest::SetupTree();
4729 } 4745 }
4730 4746
4731 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4747 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
4732 4748
4733 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { 4749 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
4868 make_scoped_ptr(new ManagedMemoryPolicy( 4884 make_scoped_ptr(new ManagedMemoryPolicy(
4869 second_context_provider_.get() ? second_output_surface_memory_limit_ 4885 second_context_provider_.get() ? second_output_surface_memory_limit_
4870 : first_output_surface_memory_limit_, 4886 : first_output_surface_memory_limit_,
4871 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, 4887 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
4872 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); 4888 ManagedMemoryPolicy::kDefaultNumResourcesLimit)));
4873 return output_surface.Pass(); 4889 return output_surface.Pass();
4874 } 4890 }
4875 4891
4876 void SetupTree() override { 4892 void SetupTree() override {
4877 if (layer_tree_host()->settings().impl_side_painting) 4893 if (layer_tree_host()->settings().impl_side_painting)
4878 root_ = FakePictureLayer::Create(&client_); 4894 root_ = FakePictureLayer::Create(layer_settings(), &client_);
4879 else 4895 else
4880 root_ = FakeContentLayer::Create(&client_); 4896 root_ = FakeContentLayer::Create(layer_settings(), &client_);
4881 root_->SetBounds(gfx::Size(20, 20)); 4897 root_->SetBounds(gfx::Size(20, 20));
4882 layer_tree_host()->SetRootLayer(root_); 4898 layer_tree_host()->SetRootLayer(root_);
4883 LayerTreeHostTest::SetupTree(); 4899 LayerTreeHostTest::SetupTree();
4884 } 4900 }
4885 4901
4886 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4902 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
4887 4903
4888 void DidCommitAndDrawFrame() override { 4904 void DidCommitAndDrawFrame() override {
4889 // Lost context sometimes takes two frames to recreate. The third frame 4905 // Lost context sometimes takes two frames to recreate. The third frame
4890 // is sometimes aborted, so wait until the fourth frame to verify that 4906 // is sometimes aborted, so wait until the fourth frame to verify that
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
5072 TestSwapPromiseResult swap_promise_result_[3]; 5088 TestSwapPromiseResult swap_promise_result_[3];
5073 }; 5089 };
5074 5090
5075 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); 5091 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise);
5076 5092
5077 class LayerTreeHostTestKeepSwapPromise : public LayerTreeTest { 5093 class LayerTreeHostTestKeepSwapPromise : public LayerTreeTest {
5078 public: 5094 public:
5079 LayerTreeHostTestKeepSwapPromise() {} 5095 LayerTreeHostTestKeepSwapPromise() {}
5080 5096
5081 void BeginTest() override { 5097 void BeginTest() override {
5082 layer_ = SolidColorLayer::Create(); 5098 layer_ = SolidColorLayer::Create(layer_settings());
5083 layer_->SetIsDrawable(true); 5099 layer_->SetIsDrawable(true);
5084 layer_->SetBounds(gfx::Size(10, 10)); 5100 layer_->SetBounds(gfx::Size(10, 10));
5085 layer_tree_host()->SetRootLayer(layer_); 5101 layer_tree_host()->SetRootLayer(layer_);
5086 gfx::Size bounds(100, 100); 5102 gfx::Size bounds(100, 100);
5087 layer_tree_host()->SetViewportSize(bounds); 5103 layer_tree_host()->SetViewportSize(bounds);
5088 PostSetNeedsCommitToMainThread(); 5104 PostSetNeedsCommitToMainThread();
5089 } 5105 }
5090 5106
5091 void DidCommit() override { 5107 void DidCommit() override {
5092 MainThreadTaskRunner()->PostTask( 5108 MainThreadTaskRunner()->PostTask(
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
5391 void InitializeSettings(LayerTreeSettings* settings) override { 5407 void InitializeSettings(LayerTreeSettings* settings) override {
5392 settings->impl_side_painting = true; 5408 settings->impl_side_painting = true;
5393 5409
5394 EXPECT_FALSE(settings->gpu_rasterization_enabled); 5410 EXPECT_FALSE(settings->gpu_rasterization_enabled);
5395 EXPECT_FALSE(settings->gpu_rasterization_forced); 5411 EXPECT_FALSE(settings->gpu_rasterization_forced);
5396 } 5412 }
5397 5413
5398 void SetupTree() override { 5414 void SetupTree() override {
5399 LayerTreeHostTest::SetupTree(); 5415 LayerTreeHostTest::SetupTree();
5400 5416
5401 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&layer_client_); 5417 scoped_refptr<PictureLayer> layer =
5418 PictureLayer::Create(layer_settings(), &layer_client_);
5402 layer->SetBounds(gfx::Size(10, 10)); 5419 layer->SetBounds(gfx::Size(10, 10));
5403 layer->SetIsDrawable(true); 5420 layer->SetIsDrawable(true);
5404 layer_tree_host()->root_layer()->AddChild(layer); 5421 layer_tree_host()->root_layer()->AddChild(layer);
5405 } 5422 }
5406 5423
5407 void BeginTest() override { 5424 void BeginTest() override {
5408 Layer* root = layer_tree_host()->root_layer(); 5425 Layer* root = layer_tree_host()->root_layer();
5409 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0)); 5426 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0));
5410 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); 5427 RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
5411 5428
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
5445 void InitializeSettings(LayerTreeSettings* settings) override { 5462 void InitializeSettings(LayerTreeSettings* settings) override {
5446 settings->impl_side_painting = true; 5463 settings->impl_side_painting = true;
5447 5464
5448 EXPECT_FALSE(settings->gpu_rasterization_enabled); 5465 EXPECT_FALSE(settings->gpu_rasterization_enabled);
5449 settings->gpu_rasterization_enabled = true; 5466 settings->gpu_rasterization_enabled = true;
5450 } 5467 }
5451 5468
5452 void SetupTree() override { 5469 void SetupTree() override {
5453 LayerTreeHostTest::SetupTree(); 5470 LayerTreeHostTest::SetupTree();
5454 5471
5455 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&layer_client_); 5472 scoped_refptr<PictureLayer> layer =
5473 PictureLayer::Create(layer_settings(), &layer_client_);
5456 layer->SetBounds(gfx::Size(10, 10)); 5474 layer->SetBounds(gfx::Size(10, 10));
5457 layer->SetIsDrawable(true); 5475 layer->SetIsDrawable(true);
5458 layer_tree_host()->root_layer()->AddChild(layer); 5476 layer_tree_host()->root_layer()->AddChild(layer);
5459 } 5477 }
5460 5478
5461 void BeginTest() override { 5479 void BeginTest() override {
5462 Layer* root = layer_tree_host()->root_layer(); 5480 Layer* root = layer_tree_host()->root_layer();
5463 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0)); 5481 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0));
5464 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); 5482 RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
5465 5483
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
5509 ASSERT_TRUE(settings->impl_side_painting); 5527 ASSERT_TRUE(settings->impl_side_painting);
5510 5528
5511 EXPECT_FALSE(settings->gpu_rasterization_forced); 5529 EXPECT_FALSE(settings->gpu_rasterization_forced);
5512 settings->gpu_rasterization_forced = true; 5530 settings->gpu_rasterization_forced = true;
5513 } 5531 }
5514 5532
5515 void SetupTree() override { 5533 void SetupTree() override {
5516 LayerTreeHostTest::SetupTree(); 5534 LayerTreeHostTest::SetupTree();
5517 5535
5518 scoped_refptr<FakePictureLayer> layer = 5536 scoped_refptr<FakePictureLayer> layer =
5519 FakePictureLayer::Create(&layer_client_); 5537 FakePictureLayer::Create(layer_settings(), &layer_client_);
5520 layer->SetBounds(gfx::Size(10, 10)); 5538 layer->SetBounds(gfx::Size(10, 10));
5521 layer->SetIsDrawable(true); 5539 layer->SetIsDrawable(true);
5522 layer_tree_host()->root_layer()->AddChild(layer); 5540 layer_tree_host()->root_layer()->AddChild(layer);
5523 } 5541 }
5524 5542
5525 void BeginTest() override { 5543 void BeginTest() override {
5526 Layer* root = layer_tree_host()->root_layer(); 5544 Layer* root = layer_tree_host()->root_layer();
5527 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0)); 5545 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0));
5528 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); 5546 RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
5529 5547
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
5569 5587
5570 class LayerTreeHostTestContinuousPainting : public LayerTreeHostTest { 5588 class LayerTreeHostTestContinuousPainting : public LayerTreeHostTest {
5571 public: 5589 public:
5572 LayerTreeHostTestContinuousPainting() 5590 LayerTreeHostTestContinuousPainting()
5573 : num_commits_(0), num_draws_(0), bounds_(20, 20), child_layer_(NULL) {} 5591 : num_commits_(0), num_draws_(0), bounds_(20, 20), child_layer_(NULL) {}
5574 5592
5575 protected: 5593 protected:
5576 enum { kExpectedNumCommits = 10 }; 5594 enum { kExpectedNumCommits = 10 };
5577 5595
5578 void SetupTree() override { 5596 void SetupTree() override {
5579 scoped_refptr<Layer> root_layer = Layer::Create(); 5597 scoped_refptr<Layer> root_layer = Layer::Create(layer_settings());
5580 root_layer->SetBounds(bounds_); 5598 root_layer->SetBounds(bounds_);
5581 root_layer->CreateRenderSurface(); 5599 root_layer->CreateRenderSurface();
5582 5600
5583 if (layer_tree_host()->settings().impl_side_painting) { 5601 if (layer_tree_host()->settings().impl_side_painting) {
5584 picture_layer_ = FakePictureLayer::Create(&client_); 5602 picture_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
5585 child_layer_ = picture_layer_.get(); 5603 child_layer_ = picture_layer_.get();
5586 } else { 5604 } else {
5587 content_layer_ = ContentLayerWithUpdateTracking::Create(&client_); 5605 content_layer_ =
5606 ContentLayerWithUpdateTracking::Create(layer_settings(), &client_);
5588 child_layer_ = content_layer_.get(); 5607 child_layer_ = content_layer_.get();
5589 } 5608 }
5590 child_layer_->SetBounds(bounds_); 5609 child_layer_->SetBounds(bounds_);
5591 child_layer_->SetIsDrawable(true); 5610 child_layer_->SetIsDrawable(true);
5592 root_layer->AddChild(child_layer_); 5611 root_layer->AddChild(child_layer_);
5593 5612
5594 layer_tree_host()->SetRootLayer(root_layer); 5613 layer_tree_host()->SetRootLayer(root_layer);
5595 layer_tree_host()->SetViewportSize(bounds_); 5614 layer_tree_host()->SetViewportSize(bounds_);
5596 LayerTreeHostTest::SetupTree(); 5615 LayerTreeHostTest::SetupTree();
5597 } 5616 }
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
5977 class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest { 5996 class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest {
5978 protected: 5997 protected:
5979 LayerTreeHostTestCrispUpAfterPinchEnds() 5998 LayerTreeHostTestCrispUpAfterPinchEnds()
5980 : playback_allowed_event_(true, true) {} 5999 : playback_allowed_event_(true, true) {}
5981 6000
5982 void SetupTree() override { 6001 void SetupTree() override {
5983 frame_ = 1; 6002 frame_ = 1;
5984 posted_ = false; 6003 posted_ = false;
5985 client_.set_fill_with_nonsolid_color(true); 6004 client_.set_fill_with_nonsolid_color(true);
5986 6005
5987 scoped_refptr<Layer> root = Layer::Create(); 6006 scoped_refptr<Layer> root = Layer::Create(layer_settings());
5988 root->SetBounds(gfx::Size(500, 500)); 6007 root->SetBounds(gfx::Size(500, 500));
5989 6008
5990 scoped_refptr<Layer> pinch = Layer::Create(); 6009 scoped_refptr<Layer> pinch = Layer::Create(layer_settings());
5991 pinch->SetBounds(gfx::Size(500, 500)); 6010 pinch->SetBounds(gfx::Size(500, 500));
5992 pinch->SetScrollClipLayerId(root->id()); 6011 pinch->SetScrollClipLayerId(root->id());
5993 pinch->SetIsContainerForFixedPositionLayers(true); 6012 pinch->SetIsContainerForFixedPositionLayers(true);
5994 root->AddChild(pinch); 6013 root->AddChild(pinch);
5995 6014
5996 scoped_ptr<FakePicturePile> pile( 6015 scoped_ptr<FakePicturePile> pile(
5997 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 6016 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
5998 ImplSidePaintingSettings().default_tile_grid_size)); 6017 ImplSidePaintingSettings().default_tile_grid_size));
5999 pile->SetPlaybackAllowedEvent(&playback_allowed_event_); 6018 pile->SetPlaybackAllowedEvent(&playback_allowed_event_);
6000 scoped_refptr<FakePictureLayer> layer = 6019 scoped_refptr<FakePictureLayer> layer =
6001 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 6020 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
6021 pile.Pass());
6002 layer->SetBounds(gfx::Size(500, 500)); 6022 layer->SetBounds(gfx::Size(500, 500));
6003 layer->SetContentsOpaque(true); 6023 layer->SetContentsOpaque(true);
6004 // Avoid LCD text on the layer so we don't cause extra commits when we 6024 // Avoid LCD text on the layer so we don't cause extra commits when we
6005 // pinch. 6025 // pinch.
6006 layer->disable_lcd_text(); 6026 layer->disable_lcd_text();
6007 pinch->AddChild(layer); 6027 pinch->AddChild(layer);
6008 6028
6009 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch); 6029 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch);
6010 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); 6030 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f);
6011 layer_tree_host()->SetRootLayer(root); 6031 layer_tree_host()->SetRootLayer(root);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
6188 RasterizeWithGpuRasterizationCreatesResources() {} 6208 RasterizeWithGpuRasterizationCreatesResources() {}
6189 6209
6190 void InitializeSettings(LayerTreeSettings* settings) override { 6210 void InitializeSettings(LayerTreeSettings* settings) override {
6191 settings->impl_side_painting = true; 6211 settings->impl_side_painting = true;
6192 settings->gpu_rasterization_forced = true; 6212 settings->gpu_rasterization_forced = true;
6193 } 6213 }
6194 6214
6195 void SetupTree() override { 6215 void SetupTree() override {
6196 client_.set_fill_with_nonsolid_color(true); 6216 client_.set_fill_with_nonsolid_color(true);
6197 6217
6198 scoped_refptr<Layer> root = Layer::Create(); 6218 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6199 root->SetBounds(gfx::Size(500, 500)); 6219 root->SetBounds(gfx::Size(500, 500));
6200 6220
6201 scoped_ptr<FakePicturePile> pile( 6221 scoped_ptr<FakePicturePile> pile(
6202 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 6222 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
6203 ImplSidePaintingSettings().default_tile_grid_size)); 6223 ImplSidePaintingSettings().default_tile_grid_size));
6204 scoped_refptr<FakePictureLayer> layer = 6224 scoped_refptr<FakePictureLayer> layer =
6205 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 6225 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
6226 pile.Pass());
6206 layer->SetBounds(gfx::Size(500, 500)); 6227 layer->SetBounds(gfx::Size(500, 500));
6207 layer->SetContentsOpaque(true); 6228 layer->SetContentsOpaque(true);
6208 root->AddChild(layer); 6229 root->AddChild(layer);
6209 6230
6210 layer_tree_host()->SetRootLayer(root); 6231 layer_tree_host()->SetRootLayer(root);
6211 LayerTreeHostTest::SetupTree(); 6232 LayerTreeHostTest::SetupTree();
6212 } 6233 }
6213 6234
6214 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6235 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6215 6236
(...skipping 21 matching lines...) Expand all
6237 settings->gpu_rasterization_forced = true; 6258 settings->gpu_rasterization_forced = true;
6238 } 6259 }
6239 6260
6240 void SetupTree() override { 6261 void SetupTree() override {
6241 client_.set_fill_with_nonsolid_color(true); 6262 client_.set_fill_with_nonsolid_color(true);
6242 6263
6243 scoped_ptr<FakePicturePile> pile( 6264 scoped_ptr<FakePicturePile> pile(
6244 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 6265 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
6245 ImplSidePaintingSettings().default_tile_grid_size)); 6266 ImplSidePaintingSettings().default_tile_grid_size));
6246 scoped_refptr<FakePictureLayer> root = 6267 scoped_refptr<FakePictureLayer> root =
6247 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 6268 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
6269 pile.Pass());
6248 root->SetBounds(gfx::Size(10000, 10000)); 6270 root->SetBounds(gfx::Size(10000, 10000));
6249 root->SetContentsOpaque(true); 6271 root->SetContentsOpaque(true);
6250 6272
6251 layer_tree_host()->SetRootLayer(root); 6273 layer_tree_host()->SetRootLayer(root);
6252 LayerTreeHostTest::SetupTree(); 6274 LayerTreeHostTest::SetupTree();
6253 layer_tree_host()->SetViewportSize(viewport_size_); 6275 layer_tree_host()->SetViewportSize(viewport_size_);
6254 } 6276 }
6255 6277
6256 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6278 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6257 6279
(...skipping 22 matching lines...) Expand all
6280 6302
6281 void InitializeSettings(LayerTreeSettings* settings) override { 6303 void InitializeSettings(LayerTreeSettings* settings) override {
6282 settings->impl_side_painting = true; 6304 settings->impl_side_painting = true;
6283 } 6305 }
6284 6306
6285 void SetupTree() override { 6307 void SetupTree() override {
6286 step_ = 1; 6308 step_ = 1;
6287 continuous_draws_ = 0; 6309 continuous_draws_ = 0;
6288 client_.set_fill_with_nonsolid_color(true); 6310 client_.set_fill_with_nonsolid_color(true);
6289 6311
6290 scoped_refptr<Layer> root = Layer::Create(); 6312 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6291 root->SetBounds(gfx::Size(500, 500)); 6313 root->SetBounds(gfx::Size(500, 500));
6292 6314
6293 scoped_refptr<Layer> pinch = Layer::Create(); 6315 scoped_refptr<Layer> pinch = Layer::Create(layer_settings());
6294 pinch->SetBounds(gfx::Size(500, 500)); 6316 pinch->SetBounds(gfx::Size(500, 500));
6295 pinch->SetScrollClipLayerId(root->id()); 6317 pinch->SetScrollClipLayerId(root->id());
6296 pinch->SetIsContainerForFixedPositionLayers(true); 6318 pinch->SetIsContainerForFixedPositionLayers(true);
6297 root->AddChild(pinch); 6319 root->AddChild(pinch);
6298 6320
6299 scoped_ptr<FakePicturePile> pile( 6321 scoped_ptr<FakePicturePile> pile(
6300 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 6322 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
6301 ImplSidePaintingSettings().default_tile_grid_size)); 6323 ImplSidePaintingSettings().default_tile_grid_size));
6302 pile->SetPlaybackAllowedEvent(&playback_allowed_event_); 6324 pile->SetPlaybackAllowedEvent(&playback_allowed_event_);
6303 scoped_refptr<FakePictureLayer> layer = 6325 scoped_refptr<FakePictureLayer> layer =
6304 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 6326 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
6327 pile.Pass());
6305 layer->SetBounds(gfx::Size(500, 500)); 6328 layer->SetBounds(gfx::Size(500, 500));
6306 layer->SetContentsOpaque(true); 6329 layer->SetContentsOpaque(true);
6307 // Avoid LCD text on the layer so we don't cause extra commits when we 6330 // Avoid LCD text on the layer so we don't cause extra commits when we
6308 // pinch. 6331 // pinch.
6309 layer->disable_lcd_text(); 6332 layer->disable_lcd_text();
6310 pinch->AddChild(layer); 6333 pinch->AddChild(layer);
6311 6334
6312 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch); 6335 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch);
6313 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); 6336 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f);
6314 layer_tree_host()->SetRootLayer(root); 6337 layer_tree_host()->SetRootLayer(root);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
6453 6476
6454 class LayerTreeHostTestOneActivatePerPrepareTiles : public LayerTreeHostTest { 6477 class LayerTreeHostTestOneActivatePerPrepareTiles : public LayerTreeHostTest {
6455 public: 6478 public:
6456 LayerTreeHostTestOneActivatePerPrepareTiles() 6479 LayerTreeHostTestOneActivatePerPrepareTiles()
6457 : notify_ready_to_activate_count_(0u), 6480 : notify_ready_to_activate_count_(0u),
6458 scheduled_prepare_tiles_count_(0) {} 6481 scheduled_prepare_tiles_count_(0) {}
6459 6482
6460 void SetupTree() override { 6483 void SetupTree() override {
6461 client_.set_fill_with_nonsolid_color(true); 6484 client_.set_fill_with_nonsolid_color(true);
6462 scoped_refptr<FakePictureLayer> root_layer = 6485 scoped_refptr<FakePictureLayer> root_layer =
6463 FakePictureLayer::Create(&client_); 6486 FakePictureLayer::Create(layer_settings(), &client_);
6464 root_layer->SetBounds(gfx::Size(1500, 1500)); 6487 root_layer->SetBounds(gfx::Size(1500, 1500));
6465 root_layer->SetIsDrawable(true); 6488 root_layer->SetIsDrawable(true);
6466 6489
6467 layer_tree_host()->SetRootLayer(root_layer); 6490 layer_tree_host()->SetRootLayer(root_layer);
6468 LayerTreeHostTest::SetupTree(); 6491 LayerTreeHostTest::SetupTree();
6469 } 6492 }
6470 6493
6471 void BeginTest() override { 6494 void BeginTest() override {
6472 layer_tree_host()->SetViewportSize(gfx::Size(16, 16)); 6495 layer_tree_host()->SetViewportSize(gfx::Size(16, 16));
6473 PostSetNeedsCommitToMainThread(); 6496 PostSetNeedsCommitToMainThread();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
6508 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestOneActivatePerPrepareTiles); 6531 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestOneActivatePerPrepareTiles);
6509 6532
6510 class LayerTreeHostTestFrameTimingRequestsSaveTimestamps 6533 class LayerTreeHostTestFrameTimingRequestsSaveTimestamps
6511 : public LayerTreeHostTest { 6534 : public LayerTreeHostTest {
6512 public: 6535 public:
6513 LayerTreeHostTestFrameTimingRequestsSaveTimestamps() 6536 LayerTreeHostTestFrameTimingRequestsSaveTimestamps()
6514 : check_results_on_commit_(false) {} 6537 : check_results_on_commit_(false) {}
6515 6538
6516 void SetupTree() override { 6539 void SetupTree() override {
6517 scoped_refptr<FakePictureLayer> root_layer = 6540 scoped_refptr<FakePictureLayer> root_layer =
6518 FakePictureLayer::Create(&client_); 6541 FakePictureLayer::Create(layer_settings(), &client_);
6519 root_layer->SetBounds(gfx::Size(200, 200)); 6542 root_layer->SetBounds(gfx::Size(200, 200));
6520 root_layer->SetIsDrawable(true); 6543 root_layer->SetIsDrawable(true);
6521 6544
6522 scoped_refptr<FakePictureLayer> child_layer = 6545 scoped_refptr<FakePictureLayer> child_layer =
6523 FakePictureLayer::Create(&client_); 6546 FakePictureLayer::Create(layer_settings(), &client_);
6524 child_layer->SetBounds(gfx::Size(1500, 1500)); 6547 child_layer->SetBounds(gfx::Size(1500, 1500));
6525 child_layer->SetIsDrawable(true); 6548 child_layer->SetIsDrawable(true);
6526 6549
6527 std::vector<FrameTimingRequest> requests; 6550 std::vector<FrameTimingRequest> requests;
6528 requests.push_back(FrameTimingRequest(1, gfx::Rect(0, 0, 100, 100))); 6551 requests.push_back(FrameTimingRequest(1, gfx::Rect(0, 0, 100, 100)));
6529 requests.push_back(FrameTimingRequest(2, gfx::Rect(300, 0, 100, 100))); 6552 requests.push_back(FrameTimingRequest(2, gfx::Rect(300, 0, 100, 100)));
6530 child_layer->SetFrameTimingRequests(requests); 6553 child_layer->SetFrameTimingRequests(requests);
6531 6554
6532 root_layer->AddChild(child_layer); 6555 root_layer->AddChild(child_layer);
6533 layer_tree_host()->SetRootLayer(root_layer); 6556 layer_tree_host()->SetRootLayer(root_layer);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
6594 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestFrameTimingRequestsSaveTimestamps); 6617 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestFrameTimingRequestsSaveTimestamps);
6595 6618
6596 class LayerTreeHostTestActivationCausesPrepareTiles : public LayerTreeHostTest { 6619 class LayerTreeHostTestActivationCausesPrepareTiles : public LayerTreeHostTest {
6597 public: 6620 public:
6598 LayerTreeHostTestActivationCausesPrepareTiles() 6621 LayerTreeHostTestActivationCausesPrepareTiles()
6599 : scheduled_prepare_tiles_count_(0) {} 6622 : scheduled_prepare_tiles_count_(0) {}
6600 6623
6601 void SetupTree() override { 6624 void SetupTree() override {
6602 client_.set_fill_with_nonsolid_color(true); 6625 client_.set_fill_with_nonsolid_color(true);
6603 scoped_refptr<FakePictureLayer> root_layer = 6626 scoped_refptr<FakePictureLayer> root_layer =
6604 FakePictureLayer::Create(&client_); 6627 FakePictureLayer::Create(layer_settings(), &client_);
6605 root_layer->SetBounds(gfx::Size(150, 150)); 6628 root_layer->SetBounds(gfx::Size(150, 150));
6606 root_layer->SetIsDrawable(true); 6629 root_layer->SetIsDrawable(true);
6607 6630
6608 layer_tree_host()->SetRootLayer(root_layer); 6631 layer_tree_host()->SetRootLayer(root_layer);
6609 LayerTreeHostTest::SetupTree(); 6632 LayerTreeHostTest::SetupTree();
6610 } 6633 }
6611 6634
6612 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6635 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6613 6636
6614 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { 6637 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6674 6697
6675 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); 6698 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit);
6676 6699
6677 // Verify that if a LayerImpl holds onto a copy request for multiple 6700 // Verify that if a LayerImpl holds onto a copy request for multiple
6678 // frames that it will continue to have a render surface through 6701 // frames that it will continue to have a render surface through
6679 // multiple commits, even though the Layer itself has no reason 6702 // multiple commits, even though the Layer itself has no reason
6680 // to have a render surface. 6703 // to have a render surface.
6681 class LayerPreserveRenderSurfaceFromOutputRequests : public LayerTreeHostTest { 6704 class LayerPreserveRenderSurfaceFromOutputRequests : public LayerTreeHostTest {
6682 protected: 6705 protected:
6683 void SetupTree() override { 6706 void SetupTree() override {
6684 scoped_refptr<Layer> root = Layer::Create(); 6707 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6685 root->CreateRenderSurface(); 6708 root->CreateRenderSurface();
6686 root->SetBounds(gfx::Size(10, 10)); 6709 root->SetBounds(gfx::Size(10, 10));
6687 child_ = Layer::Create(); 6710 child_ = Layer::Create(layer_settings());
6688 child_->SetBounds(gfx::Size(20, 20)); 6711 child_->SetBounds(gfx::Size(20, 20));
6689 root->AddChild(child_); 6712 root->AddChild(child_);
6690 6713
6691 layer_tree_host()->SetRootLayer(root); 6714 layer_tree_host()->SetRootLayer(root);
6692 LayerTreeHostTest::SetupTree(); 6715 LayerTreeHostTest::SetupTree();
6693 } 6716 }
6694 6717
6695 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} 6718 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {}
6696 6719
6697 void BeginTest() override { 6720 void BeginTest() override {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
6749 6772
6750 private: 6773 private:
6751 scoped_refptr<Layer> child_; 6774 scoped_refptr<Layer> child_;
6752 }; 6775 };
6753 6776
6754 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests); 6777 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests);
6755 6778
6756 class LayerTreeHostTestUpdateCopyRequests : public LayerTreeHostTest { 6779 class LayerTreeHostTestUpdateCopyRequests : public LayerTreeHostTest {
6757 protected: 6780 protected:
6758 void SetupTree() override { 6781 void SetupTree() override {
6759 root = Layer::Create(); 6782 root = Layer::Create(layer_settings());
6760 child = Layer::Create(); 6783 child = Layer::Create(layer_settings());
6761 root->AddChild(child); 6784 root->AddChild(child);
6762 layer_tree_host()->SetRootLayer(root); 6785 layer_tree_host()->SetRootLayer(root);
6763 LayerTreeHostTest::SetupTree(); 6786 LayerTreeHostTest::SetupTree();
6764 } 6787 }
6765 6788
6766 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} 6789 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {}
6767 6790
6768 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6791 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6769 6792
6770 void DidCommit() override { 6793 void DidCommit() override {
(...skipping 21 matching lines...) Expand all
6792 6815
6793 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateCopyRequests); 6816 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateCopyRequests);
6794 6817
6795 class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest { 6818 class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest {
6796 protected: 6819 protected:
6797 void SetupTree() override { 6820 void SetupTree() override {
6798 // The masked layer has bounds 50x50, but it has a child that causes 6821 // The masked layer has bounds 50x50, but it has a child that causes
6799 // the surface bounds to be larger. It also has a parent that clips the 6822 // the surface bounds to be larger. It also has a parent that clips the
6800 // masked layer and its surface. 6823 // masked layer and its surface.
6801 6824
6802 scoped_refptr<Layer> root = Layer::Create(); 6825 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6803 6826
6804 scoped_refptr<Layer> clipping_layer = Layer::Create(); 6827 scoped_refptr<Layer> clipping_layer = Layer::Create(layer_settings());
6805 root->AddChild(clipping_layer); 6828 root->AddChild(clipping_layer);
6806 6829
6807 scoped_refptr<FakePictureLayer> content_layer = 6830 scoped_refptr<FakePictureLayer> content_layer =
6808 FakePictureLayer::Create(&client_); 6831 FakePictureLayer::Create(layer_settings(), &client_);
6809 clipping_layer->AddChild(content_layer); 6832 clipping_layer->AddChild(content_layer);
6810 6833
6811 scoped_refptr<FakePictureLayer> content_child_layer = 6834 scoped_refptr<FakePictureLayer> content_child_layer =
6812 FakePictureLayer::Create(&client_); 6835 FakePictureLayer::Create(layer_settings(), &client_);
6813 content_layer->AddChild(content_child_layer); 6836 content_layer->AddChild(content_child_layer);
6814 6837
6815 scoped_refptr<FakePictureLayer> mask_layer = 6838 scoped_refptr<FakePictureLayer> mask_layer =
6816 FakePictureLayer::Create(&client_); 6839 FakePictureLayer::Create(layer_settings(), &client_);
6817 content_layer->SetMaskLayer(mask_layer.get()); 6840 content_layer->SetMaskLayer(mask_layer.get());
6818 6841
6819 gfx::Size root_size(100, 100); 6842 gfx::Size root_size(100, 100);
6820 root->SetBounds(root_size); 6843 root->SetBounds(root_size);
6821 6844
6822 gfx::Rect clipping_rect(20, 10, 10, 20); 6845 gfx::Rect clipping_rect(20, 10, 10, 20);
6823 clipping_layer->SetBounds(clipping_rect.size()); 6846 clipping_layer->SetBounds(clipping_rect.size());
6824 clipping_layer->SetPosition(clipping_rect.origin()); 6847 clipping_layer->SetPosition(clipping_rect.origin());
6825 clipping_layer->SetMasksToBounds(true); 6848 clipping_layer->SetMasksToBounds(true);
6826 6849
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6886 } 6909 }
6887 6910
6888 void SetupTree() override { 6911 void SetupTree() override {
6889 // Root 6912 // Root
6890 // | 6913 // |
6891 // +-- Scaling Layer (adds a 2x scale) 6914 // +-- Scaling Layer (adds a 2x scale)
6892 // | 6915 // |
6893 // +-- Content Layer 6916 // +-- Content Layer
6894 // +--Mask 6917 // +--Mask
6895 6918
6896 scoped_refptr<Layer> root = Layer::Create(); 6919 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6897 6920
6898 scoped_refptr<Layer> scaling_layer = Layer::Create(); 6921 scoped_refptr<Layer> scaling_layer = Layer::Create(layer_settings());
6899 root->AddChild(scaling_layer); 6922 root->AddChild(scaling_layer);
6900 6923
6901 scoped_refptr<FakePictureLayer> content_layer = 6924 scoped_refptr<FakePictureLayer> content_layer =
6902 FakePictureLayer::Create(&client_); 6925 FakePictureLayer::Create(layer_settings(), &client_);
6903 scaling_layer->AddChild(content_layer); 6926 scaling_layer->AddChild(content_layer);
6904 6927
6905 scoped_refptr<FakePictureLayer> mask_layer = 6928 scoped_refptr<FakePictureLayer> mask_layer =
6906 FakePictureLayer::Create(&client_); 6929 FakePictureLayer::Create(layer_settings(), &client_);
6907 content_layer->SetMaskLayer(mask_layer.get()); 6930 content_layer->SetMaskLayer(mask_layer.get());
6908 6931
6909 gfx::Size root_size(100, 100); 6932 gfx::Size root_size(100, 100);
6910 root->SetBounds(root_size); 6933 root->SetBounds(root_size);
6911 6934
6912 gfx::Size scaling_layer_size(50, 50); 6935 gfx::Size scaling_layer_size(50, 50);
6913 scaling_layer->SetBounds(scaling_layer_size); 6936 scaling_layer->SetBounds(scaling_layer_size);
6914 gfx::Transform scale; 6937 gfx::Transform scale;
6915 scale.Scale(2.f, 2.f); 6938 scale.Scale(2.f, 2.f);
6916 scaling_layer->SetTransform(scale); 6939 scaling_layer->SetTransform(scale);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
6981 }; 7004 };
6982 7005
6983 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling); 7006 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling);
6984 7007
6985 class LayerTreeTestMaskLayerWithDifferentBounds : public LayerTreeTest { 7008 class LayerTreeTestMaskLayerWithDifferentBounds : public LayerTreeTest {
6986 protected: 7009 protected:
6987 void SetupTree() override { 7010 void SetupTree() override {
6988 // The mask layer has bounds 100x100 but is attached to a layer with bounds 7011 // The mask layer has bounds 100x100 but is attached to a layer with bounds
6989 // 50x50. 7012 // 50x50.
6990 7013
6991 scoped_refptr<Layer> root = Layer::Create(); 7014 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6992 7015
6993 scoped_refptr<FakePictureLayer> content_layer = 7016 scoped_refptr<FakePictureLayer> content_layer =
6994 FakePictureLayer::Create(&client_); 7017 FakePictureLayer::Create(layer_settings(), &client_);
6995 root->AddChild(content_layer); 7018 root->AddChild(content_layer);
6996 7019
6997 scoped_refptr<FakePictureLayer> mask_layer = 7020 scoped_refptr<FakePictureLayer> mask_layer =
6998 FakePictureLayer::Create(&client_); 7021 FakePictureLayer::Create(layer_settings(), &client_);
6999 content_layer->SetMaskLayer(mask_layer.get()); 7022 content_layer->SetMaskLayer(mask_layer.get());
7000 7023
7001 gfx::Size root_size(100, 100); 7024 gfx::Size root_size(100, 100);
7002 root->SetBounds(root_size); 7025 root->SetBounds(root_size);
7003 7026
7004 gfx::Size layer_size(50, 50); 7027 gfx::Size layer_size(50, 50);
7005 content_layer->SetBounds(layer_size); 7028 content_layer->SetBounds(layer_size);
7006 7029
7007 gfx::Size mask_size(100, 100); 7030 gfx::Size mask_size(100, 100);
7008 mask_layer->SetBounds(mask_size); 7031 mask_layer->SetBounds(mask_size);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
7069 7092
7070 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds); 7093 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds);
7071 7094
7072 class LayerTreeTestReflectionMaskLayerWithDifferentBounds 7095 class LayerTreeTestReflectionMaskLayerWithDifferentBounds
7073 : public LayerTreeTest { 7096 : public LayerTreeTest {
7074 protected: 7097 protected:
7075 void SetupTree() override { 7098 void SetupTree() override {
7076 // The replica's mask layer has bounds 100x100 but the replica is of a 7099 // The replica's mask layer has bounds 100x100 but the replica is of a
7077 // layer with bounds 50x50. 7100 // layer with bounds 50x50.
7078 7101
7079 scoped_refptr<Layer> root = Layer::Create(); 7102 scoped_refptr<Layer> root = Layer::Create(layer_settings());
7080 7103
7081 scoped_refptr<FakePictureLayer> content_layer = 7104 scoped_refptr<FakePictureLayer> content_layer =
7082 FakePictureLayer::Create(&client_); 7105 FakePictureLayer::Create(layer_settings(), &client_);
7083 root->AddChild(content_layer); 7106 root->AddChild(content_layer);
7084 7107
7085 scoped_refptr<Layer> replica_layer = Layer::Create(); 7108 scoped_refptr<Layer> replica_layer = Layer::Create(layer_settings());
7086 content_layer->SetReplicaLayer(replica_layer.get()); 7109 content_layer->SetReplicaLayer(replica_layer.get());
7087 7110
7088 scoped_refptr<FakePictureLayer> mask_layer = 7111 scoped_refptr<FakePictureLayer> mask_layer =
7089 FakePictureLayer::Create(&client_); 7112 FakePictureLayer::Create(layer_settings(), &client_);
7090 replica_layer->SetMaskLayer(mask_layer.get()); 7113 replica_layer->SetMaskLayer(mask_layer.get());
7091 7114
7092 gfx::Size root_size(100, 100); 7115 gfx::Size root_size(100, 100);
7093 root->SetBounds(root_size); 7116 root->SetBounds(root_size);
7094 7117
7095 gfx::Size layer_size(50, 50); 7118 gfx::Size layer_size(50, 50);
7096 content_layer->SetBounds(layer_size); 7119 content_layer->SetBounds(layer_size);
7097 7120
7098 gfx::Size mask_size(100, 100); 7121 gfx::Size mask_size(100, 100);
7099 mask_layer->SetBounds(mask_size); 7122 mask_layer->SetBounds(mask_size);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
7162 SINGLE_AND_MULTI_THREAD_TEST_F( 7185 SINGLE_AND_MULTI_THREAD_TEST_F(
7163 LayerTreeTestReflectionMaskLayerWithDifferentBounds); 7186 LayerTreeTestReflectionMaskLayerWithDifferentBounds);
7164 7187
7165 class LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild 7188 class LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild
7166 : public LayerTreeTest { 7189 : public LayerTreeTest {
7167 protected: 7190 protected:
7168 void SetupTree() override { 7191 void SetupTree() override {
7169 // The replica is of a layer with bounds 50x50, but it has a child that 7192 // The replica is of a layer with bounds 50x50, but it has a child that
7170 // causes the surface bounds to be larger. 7193 // causes the surface bounds to be larger.
7171 7194
7172 scoped_refptr<Layer> root = Layer::Create(); 7195 scoped_refptr<Layer> root = Layer::Create(layer_settings());
7173 7196
7174 scoped_refptr<FakePictureLayer> content_layer = 7197 scoped_refptr<FakePictureLayer> content_layer =
7175 FakePictureLayer::Create(&client_); 7198 FakePictureLayer::Create(layer_settings(), &client_);
7176 root->AddChild(content_layer); 7199 root->AddChild(content_layer);
7177 7200
7178 content_child_layer_ = FakePictureLayer::Create(&client_); 7201 content_child_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
7179 content_layer->AddChild(content_child_layer_); 7202 content_layer->AddChild(content_child_layer_);
7180 7203
7181 scoped_refptr<Layer> replica_layer = Layer::Create(); 7204 scoped_refptr<Layer> replica_layer = Layer::Create(layer_settings());
7182 content_layer->SetReplicaLayer(replica_layer.get()); 7205 content_layer->SetReplicaLayer(replica_layer.get());
7183 7206
7184 scoped_refptr<FakePictureLayer> mask_layer = 7207 scoped_refptr<FakePictureLayer> mask_layer =
7185 FakePictureLayer::Create(&client_); 7208 FakePictureLayer::Create(layer_settings(), &client_);
7186 replica_layer->SetMaskLayer(mask_layer.get()); 7209 replica_layer->SetMaskLayer(mask_layer.get());
7187 7210
7188 gfx::Size root_size(100, 100); 7211 gfx::Size root_size(100, 100);
7189 root->SetBounds(root_size); 7212 root->SetBounds(root_size);
7190 7213
7191 gfx::Size layer_size(50, 50); 7214 gfx::Size layer_size(50, 50);
7192 content_layer->SetBounds(layer_size); 7215 content_layer->SetBounds(layer_size);
7193 content_child_layer_->SetBounds(layer_size); 7216 content_child_layer_->SetBounds(layer_size);
7194 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f)); 7217 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f));
7195 7218
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
7256 void AfterTest() override {} 7279 void AfterTest() override {}
7257 7280
7258 scoped_refptr<FakePictureLayer> content_child_layer_; 7281 scoped_refptr<FakePictureLayer> content_child_layer_;
7259 FakeContentLayerClient client_; 7282 FakeContentLayerClient client_;
7260 }; 7283 };
7261 7284
7262 SINGLE_AND_MULTI_THREAD_TEST_F( 7285 SINGLE_AND_MULTI_THREAD_TEST_F(
7263 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild); 7286 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild);
7264 7287
7265 } // namespace cc 7288 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698