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

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: Re-work Android LayerSettings. 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
5041 TestSwapPromiseResult swap_promise_result_[3]; 5057 TestSwapPromiseResult swap_promise_result_[3];
5042 }; 5058 };
5043 5059
5044 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); 5060 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise);
5045 5061
5046 class LayerTreeHostTestKeepSwapPromise : public LayerTreeTest { 5062 class LayerTreeHostTestKeepSwapPromise : public LayerTreeTest {
5047 public: 5063 public:
5048 LayerTreeHostTestKeepSwapPromise() {} 5064 LayerTreeHostTestKeepSwapPromise() {}
5049 5065
5050 void BeginTest() override { 5066 void BeginTest() override {
5051 layer_ = SolidColorLayer::Create(); 5067 layer_ = SolidColorLayer::Create(layer_settings());
5052 layer_->SetIsDrawable(true); 5068 layer_->SetIsDrawable(true);
5053 layer_->SetBounds(gfx::Size(10, 10)); 5069 layer_->SetBounds(gfx::Size(10, 10));
5054 layer_tree_host()->SetRootLayer(layer_); 5070 layer_tree_host()->SetRootLayer(layer_);
5055 gfx::Size bounds(100, 100); 5071 gfx::Size bounds(100, 100);
5056 layer_tree_host()->SetViewportSize(bounds); 5072 layer_tree_host()->SetViewportSize(bounds);
5057 PostSetNeedsCommitToMainThread(); 5073 PostSetNeedsCommitToMainThread();
5058 } 5074 }
5059 5075
5060 void DidCommit() override { 5076 void DidCommit() override {
5061 MainThreadTaskRunner()->PostTask( 5077 MainThreadTaskRunner()->PostTask(
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
5323 void InitializeSettings(LayerTreeSettings* settings) override { 5339 void InitializeSettings(LayerTreeSettings* settings) override {
5324 settings->impl_side_painting = true; 5340 settings->impl_side_painting = true;
5325 5341
5326 EXPECT_FALSE(settings->gpu_rasterization_enabled); 5342 EXPECT_FALSE(settings->gpu_rasterization_enabled);
5327 EXPECT_FALSE(settings->gpu_rasterization_forced); 5343 EXPECT_FALSE(settings->gpu_rasterization_forced);
5328 } 5344 }
5329 5345
5330 void SetupTree() override { 5346 void SetupTree() override {
5331 LayerTreeHostTest::SetupTree(); 5347 LayerTreeHostTest::SetupTree();
5332 5348
5333 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&layer_client_); 5349 scoped_refptr<PictureLayer> layer =
5350 PictureLayer::Create(layer_settings(), &layer_client_);
5334 layer->SetBounds(gfx::Size(10, 10)); 5351 layer->SetBounds(gfx::Size(10, 10));
5335 layer->SetIsDrawable(true); 5352 layer->SetIsDrawable(true);
5336 layer_tree_host()->root_layer()->AddChild(layer); 5353 layer_tree_host()->root_layer()->AddChild(layer);
5337 } 5354 }
5338 5355
5339 void BeginTest() override { 5356 void BeginTest() override {
5340 Layer* root = layer_tree_host()->root_layer(); 5357 Layer* root = layer_tree_host()->root_layer();
5341 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0)); 5358 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0));
5342 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); 5359 RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
5343 5360
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
5377 void InitializeSettings(LayerTreeSettings* settings) override { 5394 void InitializeSettings(LayerTreeSettings* settings) override {
5378 settings->impl_side_painting = true; 5395 settings->impl_side_painting = true;
5379 5396
5380 EXPECT_FALSE(settings->gpu_rasterization_enabled); 5397 EXPECT_FALSE(settings->gpu_rasterization_enabled);
5381 settings->gpu_rasterization_enabled = true; 5398 settings->gpu_rasterization_enabled = true;
5382 } 5399 }
5383 5400
5384 void SetupTree() override { 5401 void SetupTree() override {
5385 LayerTreeHostTest::SetupTree(); 5402 LayerTreeHostTest::SetupTree();
5386 5403
5387 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&layer_client_); 5404 scoped_refptr<PictureLayer> layer =
5405 PictureLayer::Create(layer_settings(), &layer_client_);
5388 layer->SetBounds(gfx::Size(10, 10)); 5406 layer->SetBounds(gfx::Size(10, 10));
5389 layer->SetIsDrawable(true); 5407 layer->SetIsDrawable(true);
5390 layer_tree_host()->root_layer()->AddChild(layer); 5408 layer_tree_host()->root_layer()->AddChild(layer);
5391 } 5409 }
5392 5410
5393 void BeginTest() override { 5411 void BeginTest() override {
5394 Layer* root = layer_tree_host()->root_layer(); 5412 Layer* root = layer_tree_host()->root_layer();
5395 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0)); 5413 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0));
5396 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); 5414 RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
5397 5415
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
5441 ASSERT_TRUE(settings->impl_side_painting); 5459 ASSERT_TRUE(settings->impl_side_painting);
5442 5460
5443 EXPECT_FALSE(settings->gpu_rasterization_forced); 5461 EXPECT_FALSE(settings->gpu_rasterization_forced);
5444 settings->gpu_rasterization_forced = true; 5462 settings->gpu_rasterization_forced = true;
5445 } 5463 }
5446 5464
5447 void SetupTree() override { 5465 void SetupTree() override {
5448 LayerTreeHostTest::SetupTree(); 5466 LayerTreeHostTest::SetupTree();
5449 5467
5450 scoped_refptr<FakePictureLayer> layer = 5468 scoped_refptr<FakePictureLayer> layer =
5451 FakePictureLayer::Create(&layer_client_); 5469 FakePictureLayer::Create(layer_settings(), &layer_client_);
5452 layer->SetBounds(gfx::Size(10, 10)); 5470 layer->SetBounds(gfx::Size(10, 10));
5453 layer->SetIsDrawable(true); 5471 layer->SetIsDrawable(true);
5454 layer_tree_host()->root_layer()->AddChild(layer); 5472 layer_tree_host()->root_layer()->AddChild(layer);
5455 } 5473 }
5456 5474
5457 void BeginTest() override { 5475 void BeginTest() override {
5458 Layer* root = layer_tree_host()->root_layer(); 5476 Layer* root = layer_tree_host()->root_layer();
5459 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0)); 5477 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0));
5460 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); 5478 RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
5461 5479
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
5501 5519
5502 class LayerTreeHostTestContinuousPainting : public LayerTreeHostTest { 5520 class LayerTreeHostTestContinuousPainting : public LayerTreeHostTest {
5503 public: 5521 public:
5504 LayerTreeHostTestContinuousPainting() 5522 LayerTreeHostTestContinuousPainting()
5505 : num_commits_(0), num_draws_(0), bounds_(20, 20), child_layer_(NULL) {} 5523 : num_commits_(0), num_draws_(0), bounds_(20, 20), child_layer_(NULL) {}
5506 5524
5507 protected: 5525 protected:
5508 enum { kExpectedNumCommits = 10 }; 5526 enum { kExpectedNumCommits = 10 };
5509 5527
5510 void SetupTree() override { 5528 void SetupTree() override {
5511 scoped_refptr<Layer> root_layer = Layer::Create(); 5529 scoped_refptr<Layer> root_layer = Layer::Create(layer_settings());
5512 root_layer->SetBounds(bounds_); 5530 root_layer->SetBounds(bounds_);
5513 root_layer->CreateRenderSurface(); 5531 root_layer->CreateRenderSurface();
5514 5532
5515 if (layer_tree_host()->settings().impl_side_painting) { 5533 if (layer_tree_host()->settings().impl_side_painting) {
5516 picture_layer_ = FakePictureLayer::Create(&client_); 5534 picture_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
5517 child_layer_ = picture_layer_.get(); 5535 child_layer_ = picture_layer_.get();
5518 } else { 5536 } else {
5519 content_layer_ = ContentLayerWithUpdateTracking::Create(&client_); 5537 content_layer_ =
5538 ContentLayerWithUpdateTracking::Create(layer_settings(), &client_);
5520 child_layer_ = content_layer_.get(); 5539 child_layer_ = content_layer_.get();
5521 } 5540 }
5522 child_layer_->SetBounds(bounds_); 5541 child_layer_->SetBounds(bounds_);
5523 child_layer_->SetIsDrawable(true); 5542 child_layer_->SetIsDrawable(true);
5524 root_layer->AddChild(child_layer_); 5543 root_layer->AddChild(child_layer_);
5525 5544
5526 layer_tree_host()->SetRootLayer(root_layer); 5545 layer_tree_host()->SetRootLayer(root_layer);
5527 layer_tree_host()->SetViewportSize(bounds_); 5546 layer_tree_host()->SetViewportSize(bounds_);
5528 LayerTreeHostTest::SetupTree(); 5547 LayerTreeHostTest::SetupTree();
5529 } 5548 }
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
5907 class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest { 5926 class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest {
5908 protected: 5927 protected:
5909 LayerTreeHostTestCrispUpAfterPinchEnds() 5928 LayerTreeHostTestCrispUpAfterPinchEnds()
5910 : playback_allowed_event_(true, true) {} 5929 : playback_allowed_event_(true, true) {}
5911 5930
5912 void SetupTree() override { 5931 void SetupTree() override {
5913 frame_ = 1; 5932 frame_ = 1;
5914 posted_ = false; 5933 posted_ = false;
5915 client_.set_fill_with_nonsolid_color(true); 5934 client_.set_fill_with_nonsolid_color(true);
5916 5935
5917 scoped_refptr<Layer> root = Layer::Create(); 5936 scoped_refptr<Layer> root = Layer::Create(layer_settings());
5918 root->SetBounds(gfx::Size(500, 500)); 5937 root->SetBounds(gfx::Size(500, 500));
5919 5938
5920 scoped_refptr<Layer> pinch = Layer::Create(); 5939 scoped_refptr<Layer> pinch = Layer::Create(layer_settings());
5921 pinch->SetBounds(gfx::Size(500, 500)); 5940 pinch->SetBounds(gfx::Size(500, 500));
5922 pinch->SetScrollClipLayerId(root->id()); 5941 pinch->SetScrollClipLayerId(root->id());
5923 pinch->SetIsContainerForFixedPositionLayers(true); 5942 pinch->SetIsContainerForFixedPositionLayers(true);
5924 root->AddChild(pinch); 5943 root->AddChild(pinch);
5925 5944
5926 scoped_ptr<FakePicturePile> pile( 5945 scoped_ptr<FakePicturePile> pile(
5927 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 5946 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
5928 ImplSidePaintingSettings().default_tile_grid_size)); 5947 ImplSidePaintingSettings().default_tile_grid_size));
5929 pile->SetPlaybackAllowedEvent(&playback_allowed_event_); 5948 pile->SetPlaybackAllowedEvent(&playback_allowed_event_);
5930 scoped_refptr<FakePictureLayer> layer = 5949 scoped_refptr<FakePictureLayer> layer =
5931 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 5950 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
5951 pile.Pass());
5932 layer->SetBounds(gfx::Size(500, 500)); 5952 layer->SetBounds(gfx::Size(500, 500));
5933 layer->SetContentsOpaque(true); 5953 layer->SetContentsOpaque(true);
5934 // Avoid LCD text on the layer so we don't cause extra commits when we 5954 // Avoid LCD text on the layer so we don't cause extra commits when we
5935 // pinch. 5955 // pinch.
5936 layer->disable_lcd_text(); 5956 layer->disable_lcd_text();
5937 pinch->AddChild(layer); 5957 pinch->AddChild(layer);
5938 5958
5939 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch); 5959 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch);
5940 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); 5960 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f);
5941 layer_tree_host()->SetRootLayer(root); 5961 layer_tree_host()->SetRootLayer(root);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
6118 RasterizeWithGpuRasterizationCreatesResources() {} 6138 RasterizeWithGpuRasterizationCreatesResources() {}
6119 6139
6120 void InitializeSettings(LayerTreeSettings* settings) override { 6140 void InitializeSettings(LayerTreeSettings* settings) override {
6121 settings->impl_side_painting = true; 6141 settings->impl_side_painting = true;
6122 settings->gpu_rasterization_forced = true; 6142 settings->gpu_rasterization_forced = true;
6123 } 6143 }
6124 6144
6125 void SetupTree() override { 6145 void SetupTree() override {
6126 client_.set_fill_with_nonsolid_color(true); 6146 client_.set_fill_with_nonsolid_color(true);
6127 6147
6128 scoped_refptr<Layer> root = Layer::Create(); 6148 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6129 root->SetBounds(gfx::Size(500, 500)); 6149 root->SetBounds(gfx::Size(500, 500));
6130 6150
6131 scoped_ptr<FakePicturePile> pile( 6151 scoped_ptr<FakePicturePile> pile(
6132 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 6152 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
6133 ImplSidePaintingSettings().default_tile_grid_size)); 6153 ImplSidePaintingSettings().default_tile_grid_size));
6134 scoped_refptr<FakePictureLayer> layer = 6154 scoped_refptr<FakePictureLayer> layer =
6135 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 6155 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
6156 pile.Pass());
6136 layer->SetBounds(gfx::Size(500, 500)); 6157 layer->SetBounds(gfx::Size(500, 500));
6137 layer->SetContentsOpaque(true); 6158 layer->SetContentsOpaque(true);
6138 root->AddChild(layer); 6159 root->AddChild(layer);
6139 6160
6140 layer_tree_host()->SetRootLayer(root); 6161 layer_tree_host()->SetRootLayer(root);
6141 LayerTreeHostTest::SetupTree(); 6162 LayerTreeHostTest::SetupTree();
6142 } 6163 }
6143 6164
6144 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6165 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6145 6166
(...skipping 21 matching lines...) Expand all
6167 settings->gpu_rasterization_forced = true; 6188 settings->gpu_rasterization_forced = true;
6168 } 6189 }
6169 6190
6170 void SetupTree() override { 6191 void SetupTree() override {
6171 client_.set_fill_with_nonsolid_color(true); 6192 client_.set_fill_with_nonsolid_color(true);
6172 6193
6173 scoped_ptr<FakePicturePile> pile( 6194 scoped_ptr<FakePicturePile> pile(
6174 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 6195 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
6175 ImplSidePaintingSettings().default_tile_grid_size)); 6196 ImplSidePaintingSettings().default_tile_grid_size));
6176 scoped_refptr<FakePictureLayer> root = 6197 scoped_refptr<FakePictureLayer> root =
6177 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 6198 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
6199 pile.Pass());
6178 root->SetBounds(gfx::Size(10000, 10000)); 6200 root->SetBounds(gfx::Size(10000, 10000));
6179 root->SetContentsOpaque(true); 6201 root->SetContentsOpaque(true);
6180 6202
6181 layer_tree_host()->SetRootLayer(root); 6203 layer_tree_host()->SetRootLayer(root);
6182 LayerTreeHostTest::SetupTree(); 6204 LayerTreeHostTest::SetupTree();
6183 layer_tree_host()->SetViewportSize(viewport_size_); 6205 layer_tree_host()->SetViewportSize(viewport_size_);
6184 } 6206 }
6185 6207
6186 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6208 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6187 6209
(...skipping 22 matching lines...) Expand all
6210 6232
6211 void InitializeSettings(LayerTreeSettings* settings) override { 6233 void InitializeSettings(LayerTreeSettings* settings) override {
6212 settings->impl_side_painting = true; 6234 settings->impl_side_painting = true;
6213 } 6235 }
6214 6236
6215 void SetupTree() override { 6237 void SetupTree() override {
6216 step_ = 1; 6238 step_ = 1;
6217 continuous_draws_ = 0; 6239 continuous_draws_ = 0;
6218 client_.set_fill_with_nonsolid_color(true); 6240 client_.set_fill_with_nonsolid_color(true);
6219 6241
6220 scoped_refptr<Layer> root = Layer::Create(); 6242 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6221 root->SetBounds(gfx::Size(500, 500)); 6243 root->SetBounds(gfx::Size(500, 500));
6222 6244
6223 scoped_refptr<Layer> pinch = Layer::Create(); 6245 scoped_refptr<Layer> pinch = Layer::Create(layer_settings());
6224 pinch->SetBounds(gfx::Size(500, 500)); 6246 pinch->SetBounds(gfx::Size(500, 500));
6225 pinch->SetScrollClipLayerId(root->id()); 6247 pinch->SetScrollClipLayerId(root->id());
6226 pinch->SetIsContainerForFixedPositionLayers(true); 6248 pinch->SetIsContainerForFixedPositionLayers(true);
6227 root->AddChild(pinch); 6249 root->AddChild(pinch);
6228 6250
6229 scoped_ptr<FakePicturePile> pile( 6251 scoped_ptr<FakePicturePile> pile(
6230 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 6252 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
6231 ImplSidePaintingSettings().default_tile_grid_size)); 6253 ImplSidePaintingSettings().default_tile_grid_size));
6232 pile->SetPlaybackAllowedEvent(&playback_allowed_event_); 6254 pile->SetPlaybackAllowedEvent(&playback_allowed_event_);
6233 scoped_refptr<FakePictureLayer> layer = 6255 scoped_refptr<FakePictureLayer> layer =
6234 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 6256 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
6257 pile.Pass());
6235 layer->SetBounds(gfx::Size(500, 500)); 6258 layer->SetBounds(gfx::Size(500, 500));
6236 layer->SetContentsOpaque(true); 6259 layer->SetContentsOpaque(true);
6237 // Avoid LCD text on the layer so we don't cause extra commits when we 6260 // Avoid LCD text on the layer so we don't cause extra commits when we
6238 // pinch. 6261 // pinch.
6239 layer->disable_lcd_text(); 6262 layer->disable_lcd_text();
6240 pinch->AddChild(layer); 6263 pinch->AddChild(layer);
6241 6264
6242 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch); 6265 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch);
6243 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); 6266 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f);
6244 layer_tree_host()->SetRootLayer(root); 6267 layer_tree_host()->SetRootLayer(root);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
6383 6406
6384 class LayerTreeHostTestOneActivatePerPrepareTiles : public LayerTreeHostTest { 6407 class LayerTreeHostTestOneActivatePerPrepareTiles : public LayerTreeHostTest {
6385 public: 6408 public:
6386 LayerTreeHostTestOneActivatePerPrepareTiles() 6409 LayerTreeHostTestOneActivatePerPrepareTiles()
6387 : notify_ready_to_activate_count_(0u), 6410 : notify_ready_to_activate_count_(0u),
6388 scheduled_prepare_tiles_count_(0) {} 6411 scheduled_prepare_tiles_count_(0) {}
6389 6412
6390 void SetupTree() override { 6413 void SetupTree() override {
6391 client_.set_fill_with_nonsolid_color(true); 6414 client_.set_fill_with_nonsolid_color(true);
6392 scoped_refptr<FakePictureLayer> root_layer = 6415 scoped_refptr<FakePictureLayer> root_layer =
6393 FakePictureLayer::Create(&client_); 6416 FakePictureLayer::Create(layer_settings(), &client_);
6394 root_layer->SetBounds(gfx::Size(1500, 1500)); 6417 root_layer->SetBounds(gfx::Size(1500, 1500));
6395 root_layer->SetIsDrawable(true); 6418 root_layer->SetIsDrawable(true);
6396 6419
6397 layer_tree_host()->SetRootLayer(root_layer); 6420 layer_tree_host()->SetRootLayer(root_layer);
6398 LayerTreeHostTest::SetupTree(); 6421 LayerTreeHostTest::SetupTree();
6399 } 6422 }
6400 6423
6401 void BeginTest() override { 6424 void BeginTest() override {
6402 layer_tree_host()->SetViewportSize(gfx::Size(16, 16)); 6425 layer_tree_host()->SetViewportSize(gfx::Size(16, 16));
6403 PostSetNeedsCommitToMainThread(); 6426 PostSetNeedsCommitToMainThread();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
6438 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestOneActivatePerPrepareTiles); 6461 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestOneActivatePerPrepareTiles);
6439 6462
6440 class LayerTreeHostTestFrameTimingRequestsSaveTimestamps 6463 class LayerTreeHostTestFrameTimingRequestsSaveTimestamps
6441 : public LayerTreeHostTest { 6464 : public LayerTreeHostTest {
6442 public: 6465 public:
6443 LayerTreeHostTestFrameTimingRequestsSaveTimestamps() 6466 LayerTreeHostTestFrameTimingRequestsSaveTimestamps()
6444 : check_results_on_commit_(false) {} 6467 : check_results_on_commit_(false) {}
6445 6468
6446 void SetupTree() override { 6469 void SetupTree() override {
6447 scoped_refptr<FakePictureLayer> root_layer = 6470 scoped_refptr<FakePictureLayer> root_layer =
6448 FakePictureLayer::Create(&client_); 6471 FakePictureLayer::Create(layer_settings(), &client_);
6449 root_layer->SetBounds(gfx::Size(200, 200)); 6472 root_layer->SetBounds(gfx::Size(200, 200));
6450 root_layer->SetIsDrawable(true); 6473 root_layer->SetIsDrawable(true);
6451 6474
6452 scoped_refptr<FakePictureLayer> child_layer = 6475 scoped_refptr<FakePictureLayer> child_layer =
6453 FakePictureLayer::Create(&client_); 6476 FakePictureLayer::Create(layer_settings(), &client_);
6454 child_layer->SetBounds(gfx::Size(1500, 1500)); 6477 child_layer->SetBounds(gfx::Size(1500, 1500));
6455 child_layer->SetIsDrawable(true); 6478 child_layer->SetIsDrawable(true);
6456 6479
6457 std::vector<FrameTimingRequest> requests; 6480 std::vector<FrameTimingRequest> requests;
6458 requests.push_back(FrameTimingRequest(1, gfx::Rect(0, 0, 100, 100))); 6481 requests.push_back(FrameTimingRequest(1, gfx::Rect(0, 0, 100, 100)));
6459 requests.push_back(FrameTimingRequest(2, gfx::Rect(300, 0, 100, 100))); 6482 requests.push_back(FrameTimingRequest(2, gfx::Rect(300, 0, 100, 100)));
6460 child_layer->SetFrameTimingRequests(requests); 6483 child_layer->SetFrameTimingRequests(requests);
6461 6484
6462 root_layer->AddChild(child_layer); 6485 root_layer->AddChild(child_layer);
6463 layer_tree_host()->SetRootLayer(root_layer); 6486 layer_tree_host()->SetRootLayer(root_layer);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
6524 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestFrameTimingRequestsSaveTimestamps); 6547 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestFrameTimingRequestsSaveTimestamps);
6525 6548
6526 class LayerTreeHostTestActivationCausesPrepareTiles : public LayerTreeHostTest { 6549 class LayerTreeHostTestActivationCausesPrepareTiles : public LayerTreeHostTest {
6527 public: 6550 public:
6528 LayerTreeHostTestActivationCausesPrepareTiles() 6551 LayerTreeHostTestActivationCausesPrepareTiles()
6529 : scheduled_prepare_tiles_count_(0) {} 6552 : scheduled_prepare_tiles_count_(0) {}
6530 6553
6531 void SetupTree() override { 6554 void SetupTree() override {
6532 client_.set_fill_with_nonsolid_color(true); 6555 client_.set_fill_with_nonsolid_color(true);
6533 scoped_refptr<FakePictureLayer> root_layer = 6556 scoped_refptr<FakePictureLayer> root_layer =
6534 FakePictureLayer::Create(&client_); 6557 FakePictureLayer::Create(layer_settings(), &client_);
6535 root_layer->SetBounds(gfx::Size(150, 150)); 6558 root_layer->SetBounds(gfx::Size(150, 150));
6536 root_layer->SetIsDrawable(true); 6559 root_layer->SetIsDrawable(true);
6537 6560
6538 layer_tree_host()->SetRootLayer(root_layer); 6561 layer_tree_host()->SetRootLayer(root_layer);
6539 LayerTreeHostTest::SetupTree(); 6562 LayerTreeHostTest::SetupTree();
6540 } 6563 }
6541 6564
6542 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6565 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6543 6566
6544 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { 6567 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6604 6627
6605 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); 6628 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit);
6606 6629
6607 // Verify that if a LayerImpl holds onto a copy request for multiple 6630 // Verify that if a LayerImpl holds onto a copy request for multiple
6608 // frames that it will continue to have a render surface through 6631 // frames that it will continue to have a render surface through
6609 // multiple commits, even though the Layer itself has no reason 6632 // multiple commits, even though the Layer itself has no reason
6610 // to have a render surface. 6633 // to have a render surface.
6611 class LayerPreserveRenderSurfaceFromOutputRequests : public LayerTreeHostTest { 6634 class LayerPreserveRenderSurfaceFromOutputRequests : public LayerTreeHostTest {
6612 protected: 6635 protected:
6613 void SetupTree() override { 6636 void SetupTree() override {
6614 scoped_refptr<Layer> root = Layer::Create(); 6637 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6615 root->CreateRenderSurface(); 6638 root->CreateRenderSurface();
6616 root->SetBounds(gfx::Size(10, 10)); 6639 root->SetBounds(gfx::Size(10, 10));
6617 child_ = Layer::Create(); 6640 child_ = Layer::Create(layer_settings());
6618 child_->SetBounds(gfx::Size(20, 20)); 6641 child_->SetBounds(gfx::Size(20, 20));
6619 root->AddChild(child_); 6642 root->AddChild(child_);
6620 6643
6621 layer_tree_host()->SetRootLayer(root); 6644 layer_tree_host()->SetRootLayer(root);
6622 LayerTreeHostTest::SetupTree(); 6645 LayerTreeHostTest::SetupTree();
6623 } 6646 }
6624 6647
6625 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} 6648 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {}
6626 6649
6627 void BeginTest() override { 6650 void BeginTest() override {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
6679 6702
6680 private: 6703 private:
6681 scoped_refptr<Layer> child_; 6704 scoped_refptr<Layer> child_;
6682 }; 6705 };
6683 6706
6684 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests); 6707 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests);
6685 6708
6686 class LayerTreeHostTestUpdateCopyRequests : public LayerTreeHostTest { 6709 class LayerTreeHostTestUpdateCopyRequests : public LayerTreeHostTest {
6687 protected: 6710 protected:
6688 void SetupTree() override { 6711 void SetupTree() override {
6689 root = Layer::Create(); 6712 root = Layer::Create(layer_settings());
6690 child = Layer::Create(); 6713 child = Layer::Create(layer_settings());
6691 root->AddChild(child); 6714 root->AddChild(child);
6692 layer_tree_host()->SetRootLayer(root); 6715 layer_tree_host()->SetRootLayer(root);
6693 LayerTreeHostTest::SetupTree(); 6716 LayerTreeHostTest::SetupTree();
6694 } 6717 }
6695 6718
6696 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} 6719 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {}
6697 6720
6698 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6721 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6699 6722
6700 void DidCommit() override { 6723 void DidCommit() override {
(...skipping 21 matching lines...) Expand all
6722 6745
6723 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateCopyRequests); 6746 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateCopyRequests);
6724 6747
6725 class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest { 6748 class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest {
6726 protected: 6749 protected:
6727 void SetupTree() override { 6750 void SetupTree() override {
6728 // The masked layer has bounds 50x50, but it has a child that causes 6751 // The masked layer has bounds 50x50, but it has a child that causes
6729 // the surface bounds to be larger. It also has a parent that clips the 6752 // the surface bounds to be larger. It also has a parent that clips the
6730 // masked layer and its surface. 6753 // masked layer and its surface.
6731 6754
6732 scoped_refptr<Layer> root = Layer::Create(); 6755 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6733 6756
6734 scoped_refptr<Layer> clipping_layer = Layer::Create(); 6757 scoped_refptr<Layer> clipping_layer = Layer::Create(layer_settings());
6735 root->AddChild(clipping_layer); 6758 root->AddChild(clipping_layer);
6736 6759
6737 scoped_refptr<FakePictureLayer> content_layer = 6760 scoped_refptr<FakePictureLayer> content_layer =
6738 FakePictureLayer::Create(&client_); 6761 FakePictureLayer::Create(layer_settings(), &client_);
6739 clipping_layer->AddChild(content_layer); 6762 clipping_layer->AddChild(content_layer);
6740 6763
6741 scoped_refptr<FakePictureLayer> content_child_layer = 6764 scoped_refptr<FakePictureLayer> content_child_layer =
6742 FakePictureLayer::Create(&client_); 6765 FakePictureLayer::Create(layer_settings(), &client_);
6743 content_layer->AddChild(content_child_layer); 6766 content_layer->AddChild(content_child_layer);
6744 6767
6745 scoped_refptr<FakePictureLayer> mask_layer = 6768 scoped_refptr<FakePictureLayer> mask_layer =
6746 FakePictureLayer::Create(&client_); 6769 FakePictureLayer::Create(layer_settings(), &client_);
6747 content_layer->SetMaskLayer(mask_layer.get()); 6770 content_layer->SetMaskLayer(mask_layer.get());
6748 6771
6749 gfx::Size root_size(100, 100); 6772 gfx::Size root_size(100, 100);
6750 root->SetBounds(root_size); 6773 root->SetBounds(root_size);
6751 6774
6752 gfx::Rect clipping_rect(20, 10, 10, 20); 6775 gfx::Rect clipping_rect(20, 10, 10, 20);
6753 clipping_layer->SetBounds(clipping_rect.size()); 6776 clipping_layer->SetBounds(clipping_rect.size());
6754 clipping_layer->SetPosition(clipping_rect.origin()); 6777 clipping_layer->SetPosition(clipping_rect.origin());
6755 clipping_layer->SetMasksToBounds(true); 6778 clipping_layer->SetMasksToBounds(true);
6756 6779
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6816 } 6839 }
6817 6840
6818 void SetupTree() override { 6841 void SetupTree() override {
6819 // Root 6842 // Root
6820 // | 6843 // |
6821 // +-- Scaling Layer (adds a 2x scale) 6844 // +-- Scaling Layer (adds a 2x scale)
6822 // | 6845 // |
6823 // +-- Content Layer 6846 // +-- Content Layer
6824 // +--Mask 6847 // +--Mask
6825 6848
6826 scoped_refptr<Layer> root = Layer::Create(); 6849 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6827 6850
6828 scoped_refptr<Layer> scaling_layer = Layer::Create(); 6851 scoped_refptr<Layer> scaling_layer = Layer::Create(layer_settings());
6829 root->AddChild(scaling_layer); 6852 root->AddChild(scaling_layer);
6830 6853
6831 scoped_refptr<FakePictureLayer> content_layer = 6854 scoped_refptr<FakePictureLayer> content_layer =
6832 FakePictureLayer::Create(&client_); 6855 FakePictureLayer::Create(layer_settings(), &client_);
6833 scaling_layer->AddChild(content_layer); 6856 scaling_layer->AddChild(content_layer);
6834 6857
6835 scoped_refptr<FakePictureLayer> mask_layer = 6858 scoped_refptr<FakePictureLayer> mask_layer =
6836 FakePictureLayer::Create(&client_); 6859 FakePictureLayer::Create(layer_settings(), &client_);
6837 content_layer->SetMaskLayer(mask_layer.get()); 6860 content_layer->SetMaskLayer(mask_layer.get());
6838 6861
6839 gfx::Size root_size(100, 100); 6862 gfx::Size root_size(100, 100);
6840 root->SetBounds(root_size); 6863 root->SetBounds(root_size);
6841 6864
6842 gfx::Size scaling_layer_size(50, 50); 6865 gfx::Size scaling_layer_size(50, 50);
6843 scaling_layer->SetBounds(scaling_layer_size); 6866 scaling_layer->SetBounds(scaling_layer_size);
6844 gfx::Transform scale; 6867 gfx::Transform scale;
6845 scale.Scale(2.f, 2.f); 6868 scale.Scale(2.f, 2.f);
6846 scaling_layer->SetTransform(scale); 6869 scaling_layer->SetTransform(scale);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
6911 }; 6934 };
6912 6935
6913 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling); 6936 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling);
6914 6937
6915 class LayerTreeTestMaskLayerWithDifferentBounds : public LayerTreeTest { 6938 class LayerTreeTestMaskLayerWithDifferentBounds : public LayerTreeTest {
6916 protected: 6939 protected:
6917 void SetupTree() override { 6940 void SetupTree() override {
6918 // The mask layer has bounds 100x100 but is attached to a layer with bounds 6941 // The mask layer has bounds 100x100 but is attached to a layer with bounds
6919 // 50x50. 6942 // 50x50.
6920 6943
6921 scoped_refptr<Layer> root = Layer::Create(); 6944 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6922 6945
6923 scoped_refptr<FakePictureLayer> content_layer = 6946 scoped_refptr<FakePictureLayer> content_layer =
6924 FakePictureLayer::Create(&client_); 6947 FakePictureLayer::Create(layer_settings(), &client_);
6925 root->AddChild(content_layer); 6948 root->AddChild(content_layer);
6926 6949
6927 scoped_refptr<FakePictureLayer> mask_layer = 6950 scoped_refptr<FakePictureLayer> mask_layer =
6928 FakePictureLayer::Create(&client_); 6951 FakePictureLayer::Create(layer_settings(), &client_);
6929 content_layer->SetMaskLayer(mask_layer.get()); 6952 content_layer->SetMaskLayer(mask_layer.get());
6930 6953
6931 gfx::Size root_size(100, 100); 6954 gfx::Size root_size(100, 100);
6932 root->SetBounds(root_size); 6955 root->SetBounds(root_size);
6933 6956
6934 gfx::Size layer_size(50, 50); 6957 gfx::Size layer_size(50, 50);
6935 content_layer->SetBounds(layer_size); 6958 content_layer->SetBounds(layer_size);
6936 6959
6937 gfx::Size mask_size(100, 100); 6960 gfx::Size mask_size(100, 100);
6938 mask_layer->SetBounds(mask_size); 6961 mask_layer->SetBounds(mask_size);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
6999 7022
7000 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds); 7023 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds);
7001 7024
7002 class LayerTreeTestReflectionMaskLayerWithDifferentBounds 7025 class LayerTreeTestReflectionMaskLayerWithDifferentBounds
7003 : public LayerTreeTest { 7026 : public LayerTreeTest {
7004 protected: 7027 protected:
7005 void SetupTree() override { 7028 void SetupTree() override {
7006 // The replica's mask layer has bounds 100x100 but the replica is of a 7029 // The replica's mask layer has bounds 100x100 but the replica is of a
7007 // layer with bounds 50x50. 7030 // layer with bounds 50x50.
7008 7031
7009 scoped_refptr<Layer> root = Layer::Create(); 7032 scoped_refptr<Layer> root = Layer::Create(layer_settings());
7010 7033
7011 scoped_refptr<FakePictureLayer> content_layer = 7034 scoped_refptr<FakePictureLayer> content_layer =
7012 FakePictureLayer::Create(&client_); 7035 FakePictureLayer::Create(layer_settings(), &client_);
7013 root->AddChild(content_layer); 7036 root->AddChild(content_layer);
7014 7037
7015 scoped_refptr<Layer> replica_layer = Layer::Create(); 7038 scoped_refptr<Layer> replica_layer = Layer::Create(layer_settings());
7016 content_layer->SetReplicaLayer(replica_layer.get()); 7039 content_layer->SetReplicaLayer(replica_layer.get());
7017 7040
7018 scoped_refptr<FakePictureLayer> mask_layer = 7041 scoped_refptr<FakePictureLayer> mask_layer =
7019 FakePictureLayer::Create(&client_); 7042 FakePictureLayer::Create(layer_settings(), &client_);
7020 replica_layer->SetMaskLayer(mask_layer.get()); 7043 replica_layer->SetMaskLayer(mask_layer.get());
7021 7044
7022 gfx::Size root_size(100, 100); 7045 gfx::Size root_size(100, 100);
7023 root->SetBounds(root_size); 7046 root->SetBounds(root_size);
7024 7047
7025 gfx::Size layer_size(50, 50); 7048 gfx::Size layer_size(50, 50);
7026 content_layer->SetBounds(layer_size); 7049 content_layer->SetBounds(layer_size);
7027 7050
7028 gfx::Size mask_size(100, 100); 7051 gfx::Size mask_size(100, 100);
7029 mask_layer->SetBounds(mask_size); 7052 mask_layer->SetBounds(mask_size);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
7092 SINGLE_AND_MULTI_THREAD_TEST_F( 7115 SINGLE_AND_MULTI_THREAD_TEST_F(
7093 LayerTreeTestReflectionMaskLayerWithDifferentBounds); 7116 LayerTreeTestReflectionMaskLayerWithDifferentBounds);
7094 7117
7095 class LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild 7118 class LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild
7096 : public LayerTreeTest { 7119 : public LayerTreeTest {
7097 protected: 7120 protected:
7098 void SetupTree() override { 7121 void SetupTree() override {
7099 // The replica is of a layer with bounds 50x50, but it has a child that 7122 // The replica is of a layer with bounds 50x50, but it has a child that
7100 // causes the surface bounds to be larger. 7123 // causes the surface bounds to be larger.
7101 7124
7102 scoped_refptr<Layer> root = Layer::Create(); 7125 scoped_refptr<Layer> root = Layer::Create(layer_settings());
7103 7126
7104 scoped_refptr<FakePictureLayer> content_layer = 7127 scoped_refptr<FakePictureLayer> content_layer =
7105 FakePictureLayer::Create(&client_); 7128 FakePictureLayer::Create(layer_settings(), &client_);
7106 root->AddChild(content_layer); 7129 root->AddChild(content_layer);
7107 7130
7108 content_child_layer_ = FakePictureLayer::Create(&client_); 7131 content_child_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
7109 content_layer->AddChild(content_child_layer_); 7132 content_layer->AddChild(content_child_layer_);
7110 7133
7111 scoped_refptr<Layer> replica_layer = Layer::Create(); 7134 scoped_refptr<Layer> replica_layer = Layer::Create(layer_settings());
7112 content_layer->SetReplicaLayer(replica_layer.get()); 7135 content_layer->SetReplicaLayer(replica_layer.get());
7113 7136
7114 scoped_refptr<FakePictureLayer> mask_layer = 7137 scoped_refptr<FakePictureLayer> mask_layer =
7115 FakePictureLayer::Create(&client_); 7138 FakePictureLayer::Create(layer_settings(), &client_);
7116 replica_layer->SetMaskLayer(mask_layer.get()); 7139 replica_layer->SetMaskLayer(mask_layer.get());
7117 7140
7118 gfx::Size root_size(100, 100); 7141 gfx::Size root_size(100, 100);
7119 root->SetBounds(root_size); 7142 root->SetBounds(root_size);
7120 7143
7121 gfx::Size layer_size(50, 50); 7144 gfx::Size layer_size(50, 50);
7122 content_layer->SetBounds(layer_size); 7145 content_layer->SetBounds(layer_size);
7123 content_child_layer_->SetBounds(layer_size); 7146 content_child_layer_->SetBounds(layer_size);
7124 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f)); 7147 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f));
7125 7148
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
7186 void AfterTest() override {} 7209 void AfterTest() override {}
7187 7210
7188 scoped_refptr<FakePictureLayer> content_child_layer_; 7211 scoped_refptr<FakePictureLayer> content_child_layer_;
7189 FakeContentLayerClient client_; 7212 FakeContentLayerClient client_;
7190 }; 7213 };
7191 7214
7192 SINGLE_AND_MULTI_THREAD_TEST_F( 7215 SINGLE_AND_MULTI_THREAD_TEST_F(
7193 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild); 7216 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild);
7194 7217
7195 } // namespace cc 7218 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698