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

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

Issue 1101823002: CC Animations: Make LayerAnimationController creation optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Plumb LayerSettings parameter for cc::Layer construction. 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestReadyToActivateEmpty); 171 SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestReadyToActivateEmpty);
172 172
173 // Test if the LTHI receives ReadyToActivate notifications from the TileManager 173 // Test if the LTHI receives ReadyToActivate notifications from the TileManager
174 // when some raster tasks flagged as REQUIRED_FOR_ACTIVATION got scheduled. 174 // when some raster tasks flagged as REQUIRED_FOR_ACTIVATION got scheduled.
175 class LayerTreeHostTestReadyToActivateNonEmpty 175 class LayerTreeHostTestReadyToActivateNonEmpty
176 : public LayerTreeHostTestReadyToActivateEmpty { 176 : public LayerTreeHostTestReadyToActivateEmpty {
177 public: 177 public:
178 void SetupTree() override { 178 void SetupTree() override {
179 client_.set_fill_with_nonsolid_color(true); 179 client_.set_fill_with_nonsolid_color(true);
180 scoped_refptr<FakePictureLayer> root_layer = 180 scoped_refptr<FakePictureLayer> root_layer =
181 FakePictureLayer::Create(&client_); 181 FakePictureLayer::Create(layer_settings(), &client_);
182 root_layer->SetBounds(gfx::Size(1024, 1024)); 182 root_layer->SetBounds(gfx::Size(1024, 1024));
183 root_layer->SetIsDrawable(true); 183 root_layer->SetIsDrawable(true);
184 184
185 layer_tree_host()->SetRootLayer(root_layer); 185 layer_tree_host()->SetRootLayer(root_layer);
186 LayerTreeHostTest::SetupTree(); 186 LayerTreeHostTest::SetupTree();
187 } 187 }
188 188
189 void AfterTest() override { 189 void AfterTest() override {
190 EXPECT_TRUE(did_notify_ready_to_activate_); 190 EXPECT_TRUE(did_notify_ready_to_activate_);
191 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); 191 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestReadyToDrawEmpty); 241 SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestReadyToDrawEmpty);
242 242
243 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when 243 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when
244 // some raster tasks flagged as REQUIRED_FOR_DRAW got scheduled. 244 // some raster tasks flagged as REQUIRED_FOR_DRAW got scheduled.
245 class LayerTreeHostTestReadyToDrawNonEmpty 245 class LayerTreeHostTestReadyToDrawNonEmpty
246 : public LayerTreeHostTestReadyToDrawEmpty { 246 : public LayerTreeHostTestReadyToDrawEmpty {
247 public: 247 public:
248 void SetupTree() override { 248 void SetupTree() override {
249 client_.set_fill_with_nonsolid_color(true); 249 client_.set_fill_with_nonsolid_color(true);
250 scoped_refptr<FakePictureLayer> root_layer = 250 scoped_refptr<FakePictureLayer> root_layer =
251 FakePictureLayer::Create(&client_); 251 FakePictureLayer::Create(layer_settings(), &client_);
252 root_layer->SetBounds(gfx::Size(1024, 1024)); 252 root_layer->SetBounds(gfx::Size(1024, 1024));
253 root_layer->SetIsDrawable(true); 253 root_layer->SetIsDrawable(true);
254 254
255 layer_tree_host()->SetRootLayer(root_layer); 255 layer_tree_host()->SetRootLayer(root_layer);
256 LayerTreeHostTest::SetupTree(); 256 LayerTreeHostTest::SetupTree();
257 } 257 }
258 258
259 void AfterTest() override { 259 void AfterTest() override {
260 EXPECT_TRUE(did_notify_ready_to_draw_); 260 EXPECT_TRUE(did_notify_ready_to_draw_);
261 EXPECT_TRUE(all_tiles_required_for_draw_are_ready_to_draw_); 261 EXPECT_TRUE(all_tiles_required_for_draw_are_ready_to_draw_);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 int num_commits_; 336 int num_commits_;
337 int num_draws_; 337 int num_draws_;
338 }; 338 };
339 339
340 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit2); 340 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit2);
341 341
342 // Verify that we pass property values in PushPropertiesTo. 342 // Verify that we pass property values in PushPropertiesTo.
343 class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest { 343 class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest {
344 protected: 344 protected:
345 void SetupTree() override { 345 void SetupTree() override {
346 scoped_refptr<Layer> root = Layer::Create(); 346 scoped_refptr<Layer> root = Layer::Create(layer_settings());
347 root->CreateRenderSurface(); 347 root->CreateRenderSurface();
348 root->SetBounds(gfx::Size(10, 10)); 348 root->SetBounds(gfx::Size(10, 10));
349 layer_tree_host()->SetRootLayer(root); 349 layer_tree_host()->SetRootLayer(root);
350 LayerTreeHostTest::SetupTree(); 350 LayerTreeHostTest::SetupTree();
351 } 351 }
352 352
353 enum Properties { 353 enum Properties {
354 STARTUP, 354 STARTUP,
355 BOUNDS, 355 BOUNDS,
356 HIDE_LAYER_AND_SUBTREE, 356 HIDE_LAYER_AND_SUBTREE,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 471
472 // After setNeedsRedrawRect(invalid_rect) the final damage_rect 472 // After setNeedsRedrawRect(invalid_rect) the final damage_rect
473 // must contain invalid_rect. 473 // must contain invalid_rect.
474 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { 474 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest {
475 public: 475 public:
476 LayerTreeHostTestSetNeedsRedrawRect() 476 LayerTreeHostTestSetNeedsRedrawRect()
477 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} 477 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {}
478 478
479 void BeginTest() override { 479 void BeginTest() override {
480 if (layer_tree_host()->settings().impl_side_painting) 480 if (layer_tree_host()->settings().impl_side_painting)
481 root_layer_ = FakePictureLayer::Create(&client_); 481 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
482 else 482 else
483 root_layer_ = ContentLayer::Create(&client_); 483 root_layer_ = ContentLayer::Create(layer_settings(), &client_);
484 root_layer_->SetIsDrawable(true); 484 root_layer_->SetIsDrawable(true);
485 root_layer_->SetBounds(bounds_); 485 root_layer_->SetBounds(bounds_);
486 layer_tree_host()->SetRootLayer(root_layer_); 486 layer_tree_host()->SetRootLayer(root_layer_);
487 layer_tree_host()->SetViewportSize(bounds_); 487 layer_tree_host()->SetViewportSize(bounds_);
488 PostSetNeedsCommitToMainThread(); 488 PostSetNeedsCommitToMainThread();
489 } 489 }
490 490
491 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 491 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
492 LayerTreeHostImpl::FrameData* frame_data, 492 LayerTreeHostImpl::FrameData* frame_data,
493 DrawResult draw_result) override { 493 DrawResult draw_result) override {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 531
532 // Ensure the texture size of the pending and active trees are identical when a 532 // Ensure the texture size of the pending and active trees are identical when a
533 // layer is not in the viewport and a resize happens on the viewport 533 // layer is not in the viewport and a resize happens on the viewport
534 class LayerTreeHostTestGpuRasterDeviceSizeChanged : public LayerTreeHostTest { 534 class LayerTreeHostTestGpuRasterDeviceSizeChanged : public LayerTreeHostTest {
535 public: 535 public:
536 LayerTreeHostTestGpuRasterDeviceSizeChanged() 536 LayerTreeHostTestGpuRasterDeviceSizeChanged()
537 : num_draws_(0), bounds_(500, 64), invalid_rect_(10, 10, 20, 20) {} 537 : num_draws_(0), bounds_(500, 64), invalid_rect_(10, 10, 20, 20) {}
538 538
539 void BeginTest() override { 539 void BeginTest() override {
540 client_.set_fill_with_nonsolid_color(true); 540 client_.set_fill_with_nonsolid_color(true);
541 root_layer_ = FakePictureLayer::Create(&client_); 541 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
542 root_layer_->SetIsDrawable(true); 542 root_layer_->SetIsDrawable(true);
543 gfx::Transform transform; 543 gfx::Transform transform;
544 // Translate the layer out of the viewport to force it to not update its 544 // Translate the layer out of the viewport to force it to not update its
545 // tile size via PushProperties. 545 // tile size via PushProperties.
546 transform.Translate(10000.0, 10000.0); 546 transform.Translate(10000.0, 10000.0);
547 root_layer_->SetTransform(transform); 547 root_layer_->SetTransform(transform);
548 root_layer_->SetBounds(bounds_); 548 root_layer_->SetBounds(bounds_);
549 layer_tree_host()->SetRootLayer(root_layer_); 549 layer_tree_host()->SetRootLayer(root_layer_);
550 layer_tree_host()->SetViewportSize(bounds_); 550 layer_tree_host()->SetViewportSize(bounds_);
551 551
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 SINGLE_AND_MULTI_THREAD_IMPL_TEST_F( 609 SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(
610 LayerTreeHostTestGpuRasterDeviceSizeChanged); 610 LayerTreeHostTestGpuRasterDeviceSizeChanged);
611 611
612 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest { 612 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest {
613 public: 613 public:
614 void InitializeSettings(LayerTreeSettings* settings) override { 614 void InitializeSettings(LayerTreeSettings* settings) override {
615 settings->layer_transforms_should_scale_layer_contents = true; 615 settings->layer_transforms_should_scale_layer_contents = true;
616 } 616 }
617 617
618 void SetupTree() override { 618 void SetupTree() override {
619 root_layer_ = Layer::Create(); 619 root_layer_ = Layer::Create(layer_settings());
620 root_layer_->SetBounds(gfx::Size(10, 20)); 620 root_layer_->SetBounds(gfx::Size(10, 20));
621 root_layer_->CreateRenderSurface(); 621 root_layer_->CreateRenderSurface();
622 622
623 if (layer_tree_host()->settings().impl_side_painting) 623 if (layer_tree_host()->settings().impl_side_painting)
624 scaled_layer_ = FakePictureLayer::Create(&client_); 624 scaled_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
625 else 625 else
626 scaled_layer_ = FakeContentLayer::Create(&client_); 626 scaled_layer_ = FakeContentLayer::Create(layer_settings(), &client_);
627 scaled_layer_->SetBounds(gfx::Size(1, 1)); 627 scaled_layer_->SetBounds(gfx::Size(1, 1));
628 root_layer_->AddChild(scaled_layer_); 628 root_layer_->AddChild(scaled_layer_);
629 629
630 layer_tree_host()->SetRootLayer(root_layer_); 630 layer_tree_host()->SetRootLayer(root_layer_);
631 LayerTreeHostTest::SetupTree(); 631 LayerTreeHostTest::SetupTree();
632 } 632 }
633 633
634 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 634 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
635 635
636 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 636 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate); 671 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate);
672 672
673 class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate 673 class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate
674 : public LayerTreeHostTest { 674 : public LayerTreeHostTest {
675 public: 675 public:
676 void InitializeSettings(LayerTreeSettings* settings) override { 676 void InitializeSettings(LayerTreeSettings* settings) override {
677 settings->layer_transforms_should_scale_layer_contents = true; 677 settings->layer_transforms_should_scale_layer_contents = true;
678 } 678 }
679 679
680 void SetupTree() override { 680 void SetupTree() override {
681 root_layer_ = Layer::Create(); 681 root_layer_ = Layer::Create(layer_settings());
682 root_layer_->SetBounds(gfx::Size(10, 20)); 682 root_layer_->SetBounds(gfx::Size(10, 20));
683 root_layer_->CreateRenderSurface(); 683 root_layer_->CreateRenderSurface();
684 684
685 bool paint_scrollbar = true; 685 bool paint_scrollbar = true;
686 bool has_thumb = false; 686 bool has_thumb = false;
687 scrollbar_ = FakePaintedScrollbarLayer::Create( 687 scrollbar_ = FakePaintedScrollbarLayer::Create(
688 paint_scrollbar, has_thumb, root_layer_->id()); 688 layer_settings(), paint_scrollbar, has_thumb, root_layer_->id());
689 scrollbar_->SetPosition(gfx::Point(0, 10)); 689 scrollbar_->SetPosition(gfx::Point(0, 10));
690 scrollbar_->SetBounds(gfx::Size(10, 10)); 690 scrollbar_->SetBounds(gfx::Size(10, 10));
691 691
692 root_layer_->AddChild(scrollbar_); 692 root_layer_->AddChild(scrollbar_);
693 693
694 layer_tree_host()->SetRootLayer(root_layer_); 694 layer_tree_host()->SetRootLayer(root_layer_);
695 LayerTreeHostTest::SetupTree(); 695 LayerTreeHostTest::SetupTree();
696 } 696 }
697 697
698 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 698 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 SINGLE_AND_MULTI_THREAD_TEST_F( 730 SINGLE_AND_MULTI_THREAD_TEST_F(
731 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate); 731 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate);
732 732
733 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { 733 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest {
734 public: 734 public:
735 LayerTreeHostTestSetNextCommitForcesRedraw() 735 LayerTreeHostTestSetNextCommitForcesRedraw()
736 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} 736 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {}
737 737
738 void BeginTest() override { 738 void BeginTest() override {
739 if (layer_tree_host()->settings().impl_side_painting) 739 if (layer_tree_host()->settings().impl_side_painting)
740 root_layer_ = FakePictureLayer::Create(&client_); 740 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
741 else 741 else
742 root_layer_ = ContentLayer::Create(&client_); 742 root_layer_ = ContentLayer::Create(layer_settings(), &client_);
743 root_layer_->SetIsDrawable(true); 743 root_layer_->SetIsDrawable(true);
744 root_layer_->SetBounds(bounds_); 744 root_layer_->SetBounds(bounds_);
745 layer_tree_host()->SetRootLayer(root_layer_); 745 layer_tree_host()->SetRootLayer(root_layer_);
746 layer_tree_host()->SetViewportSize(bounds_); 746 layer_tree_host()->SetViewportSize(bounds_);
747 PostSetNeedsCommitToMainThread(); 747 PostSetNeedsCommitToMainThread();
748 } 748 }
749 749
750 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 750 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
751 if (num_draws_ == 3 && host_impl->settings().impl_side_painting) 751 if (num_draws_ == 3 && host_impl->settings().impl_side_painting)
752 host_impl->SetNeedsRedrawRect(invalid_rect_); 752 host_impl->SetNeedsRedrawRect(invalid_rect_);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 830
831 void InitializeSettings(LayerTreeSettings* settings) override { 831 void InitializeSettings(LayerTreeSettings* settings) override {
832 // If we don't set the minimum contents scale, it's harder to verify whether 832 // If we don't set the minimum contents scale, it's harder to verify whether
833 // the damage we get is correct. For other scale amounts, please see 833 // the damage we get is correct. For other scale amounts, please see
834 // LayerTreeHostTestDamageWithScale. 834 // LayerTreeHostTestDamageWithScale.
835 settings->minimum_contents_scale = 1.f; 835 settings->minimum_contents_scale = 1.f;
836 } 836 }
837 837
838 void SetupTree() override { 838 void SetupTree() override {
839 if (layer_tree_host()->settings().impl_side_painting) 839 if (layer_tree_host()->settings().impl_side_painting)
840 root_layer_ = FakePictureLayer::Create(&client_); 840 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
841 else 841 else
842 root_layer_ = ContentLayer::Create(&client_); 842 root_layer_ = ContentLayer::Create(layer_settings(), &client_);
843 root_layer_->SetIsDrawable(true); 843 root_layer_->SetIsDrawable(true);
844 root_layer_->SetBounds(gfx::Size(50, 50)); 844 root_layer_->SetBounds(gfx::Size(50, 50));
845 layer_tree_host()->SetRootLayer(root_layer_); 845 layer_tree_host()->SetRootLayer(root_layer_);
846 846
847 // The initially transparent layer has a larger child layer, which is 847 // The initially transparent layer has a larger child layer, which is
848 // not initially drawn because of the this (parent) layer. 848 // not initially drawn because of the this (parent) layer.
849 if (layer_tree_host()->settings().impl_side_painting) 849 if (layer_tree_host()->settings().impl_side_painting)
850 parent_layer_ = FakePictureLayer::Create(&client_); 850 parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
851 else 851 else
852 parent_layer_ = FakeContentLayer::Create(&client_); 852 parent_layer_ = FakeContentLayer::Create(layer_settings(), &client_);
853 parent_layer_->SetBounds(gfx::Size(15, 15)); 853 parent_layer_->SetBounds(gfx::Size(15, 15));
854 parent_layer_->SetOpacity(0.0f); 854 parent_layer_->SetOpacity(0.0f);
855 root_layer_->AddChild(parent_layer_); 855 root_layer_->AddChild(parent_layer_);
856 856
857 if (layer_tree_host()->settings().impl_side_painting) 857 if (layer_tree_host()->settings().impl_side_painting)
858 child_layer_ = FakePictureLayer::Create(&client_); 858 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
859 else 859 else
860 child_layer_ = FakeContentLayer::Create(&client_); 860 child_layer_ = FakeContentLayer::Create(layer_settings(), &client_);
861 child_layer_->SetBounds(gfx::Size(25, 25)); 861 child_layer_->SetBounds(gfx::Size(25, 25));
862 parent_layer_->AddChild(child_layer_); 862 parent_layer_->AddChild(child_layer_);
863 863
864 LayerTreeHostTest::SetupTree(); 864 LayerTreeHostTest::SetupTree();
865 } 865 }
866 866
867 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 867 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
868 868
869 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 869 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
870 LayerTreeHostImpl::FrameData* frame_data, 870 LayerTreeHostImpl::FrameData* frame_data,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 class LayerTreeHostTestDamageWithScale : public LayerTreeHostTest { 934 class LayerTreeHostTestDamageWithScale : public LayerTreeHostTest {
935 public: 935 public:
936 LayerTreeHostTestDamageWithScale() {} 936 LayerTreeHostTestDamageWithScale() {}
937 937
938 void SetupTree() override { 938 void SetupTree() override {
939 client_.set_fill_with_nonsolid_color(true); 939 client_.set_fill_with_nonsolid_color(true);
940 940
941 scoped_ptr<FakePicturePile> pile( 941 scoped_ptr<FakePicturePile> pile(
942 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 942 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
943 ImplSidePaintingSettings().default_tile_grid_size)); 943 ImplSidePaintingSettings().default_tile_grid_size));
944 root_layer_ = 944 root_layer_ = FakePictureLayer::CreateWithRecordingSource(
945 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 945 layer_settings(), &client_, pile.Pass());
946 root_layer_->SetBounds(gfx::Size(50, 50)); 946 root_layer_->SetBounds(gfx::Size(50, 50));
947 947
948 pile.reset( 948 pile.reset(
949 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 949 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
950 ImplSidePaintingSettings().default_tile_grid_size)); 950 ImplSidePaintingSettings().default_tile_grid_size));
951 child_layer_ = 951 child_layer_ = FakePictureLayer::CreateWithRecordingSource(
952 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 952 layer_settings(), &client_, pile.Pass());
953 child_layer_->SetBounds(gfx::Size(25, 25)); 953 child_layer_->SetBounds(gfx::Size(25, 25));
954 child_layer_->SetIsDrawable(true); 954 child_layer_->SetIsDrawable(true);
955 child_layer_->SetContentsOpaque(true); 955 child_layer_->SetContentsOpaque(true);
956 root_layer_->AddChild(child_layer_); 956 root_layer_->AddChild(child_layer_);
957 957
958 layer_tree_host()->SetRootLayer(root_layer_); 958 layer_tree_host()->SetRootLayer(root_layer_);
959 LayerTreeHostTest::SetupTree(); 959 LayerTreeHostTest::SetupTree();
960 } 960 }
961 961
962 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 962 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 1037
1038 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestDamageWithScale); 1038 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestDamageWithScale);
1039 1039
1040 // Tests that if a layer is not drawn because of some reason in the parent, 1040 // Tests that if a layer is not drawn because of some reason in the parent,
1041 // causing its content bounds to not be computed, then when it is later drawn, 1041 // causing its content bounds to not be computed, then when it is later drawn,
1042 // its content bounds get pushed. 1042 // its content bounds get pushed.
1043 class LayerTreeHostTestUndrawnLayersPushContentBoundsLater 1043 class LayerTreeHostTestUndrawnLayersPushContentBoundsLater
1044 : public LayerTreeHostTest { 1044 : public LayerTreeHostTest {
1045 public: 1045 public:
1046 LayerTreeHostTestUndrawnLayersPushContentBoundsLater() 1046 LayerTreeHostTestUndrawnLayersPushContentBoundsLater()
1047 : root_layer_(Layer::Create()) {} 1047 : root_layer_(Layer::Create(layer_settings())) {}
1048 1048
1049 void SetupTree() override { 1049 void SetupTree() override {
1050 root_layer_->CreateRenderSurface(); 1050 root_layer_->CreateRenderSurface();
1051 root_layer_->SetIsDrawable(true); 1051 root_layer_->SetIsDrawable(true);
1052 root_layer_->SetBounds(gfx::Size(20, 20)); 1052 root_layer_->SetBounds(gfx::Size(20, 20));
1053 layer_tree_host()->SetRootLayer(root_layer_); 1053 layer_tree_host()->SetRootLayer(root_layer_);
1054 1054
1055 parent_layer_ = Layer::Create(); 1055 parent_layer_ = Layer::Create(layer_settings());
1056 parent_layer_->SetBounds(gfx::Size(20, 20)); 1056 parent_layer_->SetBounds(gfx::Size(20, 20));
1057 parent_layer_->SetOpacity(0.0f); 1057 parent_layer_->SetOpacity(0.0f);
1058 root_layer_->AddChild(parent_layer_); 1058 root_layer_->AddChild(parent_layer_);
1059 1059
1060 child_layer_ = Layer::Create(); 1060 child_layer_ = Layer::Create(layer_settings());
1061 child_layer_->SetBounds(gfx::Size(15, 15)); 1061 child_layer_->SetBounds(gfx::Size(15, 15));
1062 parent_layer_->AddChild(child_layer_); 1062 parent_layer_->AddChild(child_layer_);
1063 1063
1064 LayerTreeHostTest::SetupTree(); 1064 LayerTreeHostTest::SetupTree();
1065 } 1065 }
1066 1066
1067 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1067 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1068 1068
1069 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 1069 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
1070 LayerImpl* root = host_impl->active_tree()->root_layer(); 1070 LayerImpl* root = host_impl->active_tree()->root_layer();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. 1250 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor.
1251 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { 1251 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest {
1252 public: 1252 public:
1253 LayerTreeHostTestStartPageScaleAnimation() {} 1253 LayerTreeHostTestStartPageScaleAnimation() {}
1254 1254
1255 void SetupTree() override { 1255 void SetupTree() override {
1256 LayerTreeHostTest::SetupTree(); 1256 LayerTreeHostTest::SetupTree();
1257 1257
1258 if (layer_tree_host()->settings().impl_side_painting) { 1258 if (layer_tree_host()->settings().impl_side_painting) {
1259 scoped_refptr<FakePictureLayer> layer = 1259 scoped_refptr<FakePictureLayer> layer =
1260 FakePictureLayer::Create(&client_); 1260 FakePictureLayer::Create(layer_settings(), &client_);
1261 layer->set_always_update_resources(true); 1261 layer->set_always_update_resources(true);
1262 scroll_layer_ = layer; 1262 scroll_layer_ = layer;
1263 } else { 1263 } else {
1264 scroll_layer_ = FakeContentLayer::Create(&client_); 1264 scroll_layer_ = FakeContentLayer::Create(layer_settings(), &client_);
1265 } 1265 }
1266 1266
1267 Layer* root_layer = layer_tree_host()->root_layer(); 1267 Layer* root_layer = layer_tree_host()->root_layer();
1268 scroll_layer_->SetScrollClipLayerId(root_layer->id()); 1268 scroll_layer_->SetScrollClipLayerId(root_layer->id());
1269 scroll_layer_->SetIsContainerForFixedPositionLayers(true); 1269 scroll_layer_->SetIsContainerForFixedPositionLayers(true);
1270 scroll_layer_->SetBounds(gfx::Size(2 * root_layer->bounds().width(), 1270 scroll_layer_->SetBounds(gfx::Size(2 * root_layer->bounds().width(),
1271 2 * root_layer->bounds().height())); 1271 2 * root_layer->bounds().height()));
1272 scroll_layer_->SetScrollOffset(gfx::ScrollOffset()); 1272 scroll_layer_->SetScrollOffset(gfx::ScrollOffset());
1273 layer_tree_host()->root_layer()->AddChild(scroll_layer_); 1273 layer_tree_host()->root_layer()->AddChild(scroll_layer_);
1274 // This test requires the page_scale and inner viewport layers to be 1274 // This test requires the page_scale and inner viewport layers to be
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 } 1374 }
1375 bool FillsBoundsCompletely() const override { return false; } 1375 bool FillsBoundsCompletely() const override { return false; }
1376 1376
1377 private: 1377 private:
1378 Layer* test_layer_; 1378 Layer* test_layer_;
1379 }; 1379 };
1380 1380
1381 class ContentLayerWithUpdateTracking : public ContentLayer { 1381 class ContentLayerWithUpdateTracking : public ContentLayer {
1382 public: 1382 public:
1383 static scoped_refptr<ContentLayerWithUpdateTracking> Create( 1383 static scoped_refptr<ContentLayerWithUpdateTracking> Create(
1384 const LayerSettings& settings,
1384 ContentLayerClient* client) { 1385 ContentLayerClient* client) {
1385 return make_scoped_refptr(new ContentLayerWithUpdateTracking(client)); 1386 return make_scoped_refptr(
1387 new ContentLayerWithUpdateTracking(settings, client));
1386 } 1388 }
1387 1389
1388 int PaintContentsCount() { return paint_contents_count_; } 1390 int PaintContentsCount() { return paint_contents_count_; }
1389 void ResetPaintContentsCount() { paint_contents_count_ = 0; } 1391 void ResetPaintContentsCount() { paint_contents_count_ = 0; }
1390 1392
1391 bool Update(ResourceUpdateQueue* queue, 1393 bool Update(ResourceUpdateQueue* queue,
1392 const OcclusionTracker<Layer>* occlusion) override { 1394 const OcclusionTracker<Layer>* occlusion) override {
1393 bool updated = ContentLayer::Update(queue, occlusion); 1395 bool updated = ContentLayer::Update(queue, occlusion);
1394 paint_contents_count_++; 1396 paint_contents_count_++;
1395 return updated; 1397 return updated;
1396 } 1398 }
1397 1399
1398 private: 1400 private:
1399 explicit ContentLayerWithUpdateTracking(ContentLayerClient* client) 1401 ContentLayerWithUpdateTracking(const LayerSettings& settings,
1400 : ContentLayer(client), paint_contents_count_(0) { 1402 ContentLayerClient* client)
1403 : ContentLayer(settings, client), paint_contents_count_(0) {
1401 SetBounds(gfx::Size(10, 10)); 1404 SetBounds(gfx::Size(10, 10));
1402 SetIsDrawable(true); 1405 SetIsDrawable(true);
1403 } 1406 }
1404 ~ContentLayerWithUpdateTracking() override {} 1407 ~ContentLayerWithUpdateTracking() override {}
1405 1408
1406 int paint_contents_count_; 1409 int paint_contents_count_;
1407 }; 1410 };
1408 1411
1409 // Layer opacity change during paint should not prevent compositor resources 1412 // Layer opacity change during paint should not prevent compositor resources
1410 // from being updated during commit. 1413 // from being updated during commit.
1411 class LayerTreeHostTestOpacityChange : public LayerTreeHostTest { 1414 class LayerTreeHostTestOpacityChange : public LayerTreeHostTest {
1412 public: 1415 public:
1413 LayerTreeHostTestOpacityChange() : test_opacity_change_delegate_() {} 1416 LayerTreeHostTestOpacityChange() : test_opacity_change_delegate_() {}
1414 1417
1415 void BeginTest() override { 1418 void BeginTest() override {
1416 if (layer_tree_host()->settings().impl_side_painting) { 1419 if (layer_tree_host()->settings().impl_side_painting) {
1417 update_check_picture_layer_ = 1420 update_check_picture_layer_ = FakePictureLayer::Create(
1418 FakePictureLayer::Create(&test_opacity_change_delegate_); 1421 layer_settings(), &test_opacity_change_delegate_);
1419 test_opacity_change_delegate_.SetTestLayer( 1422 test_opacity_change_delegate_.SetTestLayer(
1420 update_check_picture_layer_.get()); 1423 update_check_picture_layer_.get());
1421 is_impl_paint_ = true; 1424 is_impl_paint_ = true;
1422 } else { 1425 } else {
1423 update_check_content_layer_ = ContentLayerWithUpdateTracking::Create( 1426 update_check_content_layer_ = ContentLayerWithUpdateTracking::Create(
1424 &test_opacity_change_delegate_); 1427 layer_settings(), &test_opacity_change_delegate_);
1425 test_opacity_change_delegate_.SetTestLayer( 1428 test_opacity_change_delegate_.SetTestLayer(
1426 update_check_content_layer_.get()); 1429 update_check_content_layer_.get());
1427 is_impl_paint_ = false; 1430 is_impl_paint_ = false;
1428 } 1431 }
1429 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); 1432 layer_tree_host()->SetViewportSize(gfx::Size(10, 10));
1430 if (layer_tree_host()->settings().impl_side_painting) 1433 if (layer_tree_host()->settings().impl_side_painting)
1431 layer_tree_host()->root_layer()->AddChild(update_check_picture_layer_); 1434 layer_tree_host()->root_layer()->AddChild(update_check_picture_layer_);
1432 else 1435 else
1433 layer_tree_host()->root_layer()->AddChild(update_check_content_layer_); 1436 layer_tree_host()->root_layer()->AddChild(update_check_content_layer_);
1434 1437
(...skipping 24 matching lines...) Expand all
1459 public: 1462 public:
1460 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {} 1463 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {}
1461 1464
1462 void InitializeSettings(LayerTreeSettings* settings) override { 1465 void InitializeSettings(LayerTreeSettings* settings) override {
1463 // PictureLayer can only be used with impl side painting enabled. 1466 // PictureLayer can only be used with impl side painting enabled.
1464 settings->impl_side_painting = true; 1467 settings->impl_side_painting = true;
1465 } 1468 }
1466 1469
1467 void BeginTest() override { 1470 void BeginTest() override {
1468 client_.set_fill_with_nonsolid_color(true); 1471 client_.set_fill_with_nonsolid_color(true);
1469 root_layer_ = FakePictureLayer::Create(&client_); 1472 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
1470 child_layer_ = FakePictureLayer::Create(&client_); 1473 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
1471 1474
1472 layer_tree_host()->SetViewportSize(gfx::Size(60, 60)); 1475 layer_tree_host()->SetViewportSize(gfx::Size(60, 60));
1473 layer_tree_host()->SetDeviceScaleFactor(1.5); 1476 layer_tree_host()->SetDeviceScaleFactor(1.5);
1474 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size()); 1477 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size());
1475 1478
1476 root_layer_->AddChild(child_layer_); 1479 root_layer_->AddChild(child_layer_);
1477 1480
1478 root_layer_->SetIsDrawable(true); 1481 root_layer_->SetIsDrawable(true);
1479 root_layer_->SetBounds(gfx::Size(30, 30)); 1482 root_layer_->SetBounds(gfx::Size(30, 30));
1480 1483
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 public: 1571 public:
1569 void InitializeSettings(LayerTreeSettings* settings) override { 1572 void InitializeSettings(LayerTreeSettings* settings) override {
1570 settings->renderer_settings.texture_id_allocation_chunk_size = 1; 1573 settings->renderer_settings.texture_id_allocation_chunk_size = 1;
1571 // Make sure partial texture updates are turned off. 1574 // Make sure partial texture updates are turned off.
1572 settings->max_partial_texture_updates = 0; 1575 settings->max_partial_texture_updates = 0;
1573 // Linear fade animator prevents scrollbars from drawing immediately. 1576 // Linear fade animator prevents scrollbars from drawing immediately.
1574 settings->scrollbar_animator = LayerTreeSettings::NO_ANIMATOR; 1577 settings->scrollbar_animator = LayerTreeSettings::NO_ANIMATOR;
1575 } 1578 }
1576 1579
1577 void SetupTree() override { 1580 void SetupTree() override {
1578 layer_ = FakeContentLayer::Create(&client_); 1581 layer_ = FakeContentLayer::Create(layer_settings(), &client_);
1579 layer_->SetBounds(gfx::Size(10, 20)); 1582 layer_->SetBounds(gfx::Size(10, 20));
1580 1583
1581 bool paint_scrollbar = true; 1584 bool paint_scrollbar = true;
1582 bool has_thumb = false; 1585 bool has_thumb = false;
1583 scrollbar_ = FakePaintedScrollbarLayer::Create( 1586 scrollbar_ = FakePaintedScrollbarLayer::Create(
1584 paint_scrollbar, has_thumb, layer_->id()); 1587 layer_settings(), paint_scrollbar, has_thumb, layer_->id());
1585 scrollbar_->SetPosition(gfx::Point(0, 10)); 1588 scrollbar_->SetPosition(gfx::Point(0, 10));
1586 scrollbar_->SetBounds(gfx::Size(10, 10)); 1589 scrollbar_->SetBounds(gfx::Size(10, 10));
1587 1590
1588 layer_->AddChild(scrollbar_); 1591 layer_->AddChild(scrollbar_);
1589 1592
1590 layer_tree_host()->SetRootLayer(layer_); 1593 layer_tree_host()->SetRootLayer(layer_);
1591 LayerTreeHostTest::SetupTree(); 1594 LayerTreeHostTest::SetupTree();
1592 } 1595 }
1593 1596
1594 void BeginTest() override { 1597 void BeginTest() override {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 public: 1746 public:
1744 void InitializeSettings(LayerTreeSettings* settings) override { 1747 void InitializeSettings(LayerTreeSettings* settings) override {
1745 settings->renderer_settings.texture_id_allocation_chunk_size = 1; 1748 settings->renderer_settings.texture_id_allocation_chunk_size = 1;
1746 // Allow one partial texture update. 1749 // Allow one partial texture update.
1747 settings->max_partial_texture_updates = 1; 1750 settings->max_partial_texture_updates = 1;
1748 // No partial updates when impl side painting is enabled. 1751 // No partial updates when impl side painting is enabled.
1749 settings->impl_side_painting = false; 1752 settings->impl_side_painting = false;
1750 } 1753 }
1751 1754
1752 void SetupTree() override { 1755 void SetupTree() override {
1753 parent_ = FakeContentLayer::Create(&client_); 1756 parent_ = FakeContentLayer::Create(layer_settings(), &client_);
1754 parent_->SetBounds(gfx::Size(10, 20)); 1757 parent_->SetBounds(gfx::Size(10, 20));
1755 1758
1756 child_ = FakeContentLayer::Create(&client_); 1759 child_ = FakeContentLayer::Create(layer_settings(), &client_);
1757 child_->SetPosition(gfx::Point(0, 10)); 1760 child_->SetPosition(gfx::Point(0, 10));
1758 child_->SetBounds(gfx::Size(3, 10)); 1761 child_->SetBounds(gfx::Size(3, 10));
1759 1762
1760 parent_->AddChild(child_); 1763 parent_->AddChild(child_);
1761 1764
1762 layer_tree_host()->SetRootLayer(parent_); 1765 layer_tree_host()->SetRootLayer(parent_);
1763 LayerTreeHostTest::SetupTree(); 1766 LayerTreeHostTest::SetupTree();
1764 } 1767 }
1765 1768
1766 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1769 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 1912
1910 // Partial updates are not possible with a delegating renderer. 1913 // Partial updates are not possible with a delegating renderer.
1911 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 1914 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
1912 LayerTreeHostTestAtomicCommitWithPartialUpdate); 1915 LayerTreeHostTestAtomicCommitWithPartialUpdate);
1913 1916
1914 // TODO(sohanjg) : Make it work with impl-side painting. 1917 // TODO(sohanjg) : Make it work with impl-side painting.
1915 class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit 1918 class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit
1916 : public LayerTreeHostTest { 1919 : public LayerTreeHostTest {
1917 protected: 1920 protected:
1918 void SetupTree() override { 1921 void SetupTree() override {
1919 root_layer_ = FakeContentLayer::Create(&client_); 1922 root_layer_ = FakeContentLayer::Create(layer_settings(), &client_);
1920 root_layer_->SetBounds(gfx::Size(100, 100)); 1923 root_layer_->SetBounds(gfx::Size(100, 100));
1921 1924
1922 surface_layer1_ = FakeContentLayer::Create(&client_); 1925 surface_layer1_ = FakeContentLayer::Create(layer_settings(), &client_);
1923 surface_layer1_->SetBounds(gfx::Size(100, 100)); 1926 surface_layer1_->SetBounds(gfx::Size(100, 100));
1924 surface_layer1_->SetForceRenderSurface(true); 1927 surface_layer1_->SetForceRenderSurface(true);
1925 surface_layer1_->SetOpacity(0.5f); 1928 surface_layer1_->SetOpacity(0.5f);
1926 root_layer_->AddChild(surface_layer1_); 1929 root_layer_->AddChild(surface_layer1_);
1927 1930
1928 surface_layer2_ = FakeContentLayer::Create(&client_); 1931 surface_layer2_ = FakeContentLayer::Create(layer_settings(), &client_);
1929 surface_layer2_->SetBounds(gfx::Size(100, 100)); 1932 surface_layer2_->SetBounds(gfx::Size(100, 100));
1930 surface_layer2_->SetForceRenderSurface(true); 1933 surface_layer2_->SetForceRenderSurface(true);
1931 surface_layer2_->SetOpacity(0.5f); 1934 surface_layer2_->SetOpacity(0.5f);
1932 surface_layer1_->AddChild(surface_layer2_); 1935 surface_layer1_->AddChild(surface_layer2_);
1933 1936
1934 replica_layer1_ = FakeContentLayer::Create(&client_); 1937 replica_layer1_ = FakeContentLayer::Create(layer_settings(), &client_);
1935 surface_layer1_->SetReplicaLayer(replica_layer1_.get()); 1938 surface_layer1_->SetReplicaLayer(replica_layer1_.get());
1936 1939
1937 replica_layer2_ = FakeContentLayer::Create(&client_); 1940 replica_layer2_ = FakeContentLayer::Create(layer_settings(), &client_);
1938 surface_layer2_->SetReplicaLayer(replica_layer2_.get()); 1941 surface_layer2_->SetReplicaLayer(replica_layer2_.get());
1939 1942
1940 layer_tree_host()->SetRootLayer(root_layer_); 1943 layer_tree_host()->SetRootLayer(root_layer_);
1941 LayerTreeHostTest::SetupTree(); 1944 LayerTreeHostTest::SetupTree();
1942 } 1945 }
1943 1946
1944 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1947 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1945 1948
1946 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 1949 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
1947 Renderer* renderer = host_impl->renderer(); 1950 Renderer* renderer = host_impl->renderer();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1998 scoped_refptr<FakeContentLayer> surface_layer2_; 2001 scoped_refptr<FakeContentLayer> surface_layer2_;
1999 scoped_refptr<FakeContentLayer> replica_layer2_; 2002 scoped_refptr<FakeContentLayer> replica_layer2_;
2000 }; 2003 };
2001 2004
2002 // Surfaces don't exist with a delegated renderer. 2005 // Surfaces don't exist with a delegated renderer.
2003 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F( 2006 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(
2004 LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit); 2007 LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit);
2005 2008
2006 class EvictionTestLayer : public Layer { 2009 class EvictionTestLayer : public Layer {
2007 public: 2010 public:
2008 static scoped_refptr<EvictionTestLayer> Create() { 2011 static scoped_refptr<EvictionTestLayer> Create(
2009 return make_scoped_refptr(new EvictionTestLayer()); 2012 const LayerSettings& settings) {
2013 return make_scoped_refptr(new EvictionTestLayer(settings));
2010 } 2014 }
2011 2015
2012 bool Update(ResourceUpdateQueue*, const OcclusionTracker<Layer>*) override; 2016 bool Update(ResourceUpdateQueue*, const OcclusionTracker<Layer>*) override;
2013 bool DrawsContent() const override { return true; } 2017 bool DrawsContent() const override { return true; }
2014 2018
2015 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; 2019 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
2016 void PushPropertiesTo(LayerImpl* impl) override; 2020 void PushPropertiesTo(LayerImpl* impl) override;
2017 void SetTexturePriorities(const PriorityCalculator&) override; 2021 void SetTexturePriorities(const PriorityCalculator&) override;
2018 2022
2019 bool HaveBackingTexture() const { 2023 bool HaveBackingTexture() const {
2020 return texture_.get() ? texture_->have_backing_texture() : false; 2024 return texture_.get() ? texture_->have_backing_texture() : false;
2021 } 2025 }
2022 2026
2023 private: 2027 private:
2024 EvictionTestLayer() : Layer() {} 2028 explicit EvictionTestLayer(const LayerSettings& settings) : Layer(settings) {}
2025 ~EvictionTestLayer() override {} 2029 ~EvictionTestLayer() override {}
2026 2030
2027 void CreateTextureIfNeeded() { 2031 void CreateTextureIfNeeded() {
2028 if (texture_) 2032 if (texture_)
2029 return; 2033 return;
2030 texture_ = PrioritizedResource::Create( 2034 texture_ = PrioritizedResource::Create(
2031 layer_tree_host()->contents_texture_manager()); 2035 layer_tree_host()->contents_texture_manager());
2032 texture_->SetDimensions(gfx::Size(10, 10), RGBA_8888); 2036 texture_->SetDimensions(gfx::Size(10, 10), RGBA_8888);
2033 bitmap_.allocN32Pixels(10, 10); 2037 bitmap_.allocN32Pixels(10, 10);
2034 } 2038 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2089 Layer::PushPropertiesTo(layer_impl); 2093 Layer::PushPropertiesTo(layer_impl);
2090 2094
2091 EvictionTestLayerImpl* test_layer_impl = 2095 EvictionTestLayerImpl* test_layer_impl =
2092 static_cast<EvictionTestLayerImpl*>(layer_impl); 2096 static_cast<EvictionTestLayerImpl*>(layer_impl);
2093 test_layer_impl->SetHasTexture(texture_->have_backing_texture()); 2097 test_layer_impl->SetHasTexture(texture_->have_backing_texture());
2094 } 2098 }
2095 2099
2096 class LayerTreeHostTestEvictTextures : public LayerTreeHostTest { 2100 class LayerTreeHostTestEvictTextures : public LayerTreeHostTest {
2097 public: 2101 public:
2098 LayerTreeHostTestEvictTextures() 2102 LayerTreeHostTestEvictTextures()
2099 : layer_(EvictionTestLayer::Create()), 2103 : layer_(EvictionTestLayer::Create(layer_settings())),
2100 impl_for_evict_textures_(0), 2104 impl_for_evict_textures_(0),
2101 num_commits_(0) {} 2105 num_commits_(0) {}
2102 2106
2103 void BeginTest() override { 2107 void BeginTest() override {
2104 layer_tree_host()->SetRootLayer(layer_); 2108 layer_tree_host()->SetRootLayer(layer_);
2105 layer_tree_host()->SetViewportSize(gfx::Size(10, 20)); 2109 layer_tree_host()->SetViewportSize(gfx::Size(10, 20));
2106 2110
2107 gfx::Transform identity_matrix; 2111 gfx::Transform identity_matrix;
2108 SetLayerPropertiesForTesting(layer_.get(), 2112 SetLayerPropertiesForTesting(layer_.get(),
2109 0, 2113 0,
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2225 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { 2229 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest {
2226 public: 2230 public:
2227 LayerTreeHostTestContinuousInvalidate() 2231 LayerTreeHostTestContinuousInvalidate()
2228 : num_commit_complete_(0), num_draw_layers_(0) {} 2232 : num_commit_complete_(0), num_draw_layers_(0) {}
2229 2233
2230 void BeginTest() override { 2234 void BeginTest() override {
2231 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); 2235 layer_tree_host()->SetViewportSize(gfx::Size(10, 10));
2232 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); 2236 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10));
2233 2237
2234 if (layer_tree_host()->settings().impl_side_painting) 2238 if (layer_tree_host()->settings().impl_side_painting)
2235 layer_ = FakePictureLayer::Create(&client_); 2239 layer_ = FakePictureLayer::Create(layer_settings(), &client_);
2236 else 2240 else
2237 layer_ = FakeContentLayer::Create(&client_); 2241 layer_ = FakeContentLayer::Create(layer_settings(), &client_);
2238 2242
2239 layer_->SetBounds(gfx::Size(10, 10)); 2243 layer_->SetBounds(gfx::Size(10, 10));
2240 layer_->SetPosition(gfx::PointF(0.f, 0.f)); 2244 layer_->SetPosition(gfx::PointF(0.f, 0.f));
2241 layer_->SetIsDrawable(true); 2245 layer_->SetIsDrawable(true);
2242 layer_tree_host()->root_layer()->AddChild(layer_); 2246 layer_tree_host()->root_layer()->AddChild(layer_);
2243 2247
2244 PostSetNeedsCommitToMainThread(); 2248 PostSetNeedsCommitToMainThread();
2245 } 2249 }
2246 2250
2247 void DidCommitAndDrawFrame() override { 2251 void DidCommitAndDrawFrame() override {
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 host->Composite(base::TimeTicks::Now()); 2479 host->Composite(base::TimeTicks::Now());
2476 2480
2477 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); 2481 EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
2478 } 2482 }
2479 2483
2480 // TODO(sohanjg) : Remove it once impl-side painting ships everywhere. 2484 // TODO(sohanjg) : Remove it once impl-side painting ships everywhere.
2481 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted 2485 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted
2482 : public LayerTreeHostTest { 2486 : public LayerTreeHostTest {
2483 public: 2487 public:
2484 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() 2488 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted()
2485 : root_layer_(FakeContentLayer::Create(&client_)), 2489 : root_layer_(FakeContentLayer::Create(layer_settings(), &client_)),
2486 child_layer1_(FakeContentLayer::Create(&client_)), 2490 child_layer1_(FakeContentLayer::Create(layer_settings(), &client_)),
2487 child_layer2_(FakeContentLayer::Create(&client_)), 2491 child_layer2_(FakeContentLayer::Create(layer_settings(), &client_)),
2488 num_commits_(0) {} 2492 num_commits_(0) {}
2489 2493
2490 void BeginTest() override { 2494 void BeginTest() override {
2491 layer_tree_host()->SetViewportSize(gfx::Size(100, 100)); 2495 layer_tree_host()->SetViewportSize(gfx::Size(100, 100));
2492 root_layer_->SetBounds(gfx::Size(100, 100)); 2496 root_layer_->SetBounds(gfx::Size(100, 100));
2493 child_layer1_->SetBounds(gfx::Size(100, 100)); 2497 child_layer1_->SetBounds(gfx::Size(100, 100));
2494 child_layer2_->SetBounds(gfx::Size(100, 100)); 2498 child_layer2_->SetBounds(gfx::Size(100, 100));
2495 root_layer_->AddChild(child_layer1_); 2499 root_layer_->AddChild(child_layer1_);
2496 root_layer_->AddChild(child_layer2_); 2500 root_layer_->AddChild(child_layer2_);
2497 layer_tree_host()->SetRootLayer(root_layer_); 2501 layer_tree_host()->SetRootLayer(root_layer_);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2557 }; 2561 };
2558 2562
2559 SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F( 2563 SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(
2560 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted); 2564 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted);
2561 2565
2562 class LayerTreeHostTestLCDChange : public LayerTreeHostTest { 2566 class LayerTreeHostTestLCDChange : public LayerTreeHostTest {
2563 public: 2567 public:
2564 void SetupTree() override { 2568 void SetupTree() override {
2565 num_tiles_rastered_ = 0; 2569 num_tiles_rastered_ = 0;
2566 2570
2567 scoped_refptr<Layer> root_layer = PictureLayer::Create(&client_); 2571 scoped_refptr<Layer> root_layer =
2572 PictureLayer::Create(layer_settings(), &client_);
2568 client_.set_fill_with_nonsolid_color(true); 2573 client_.set_fill_with_nonsolid_color(true);
2569 root_layer->SetIsDrawable(true); 2574 root_layer->SetIsDrawable(true);
2570 root_layer->SetBounds(gfx::Size(10, 10)); 2575 root_layer->SetBounds(gfx::Size(10, 10));
2571 root_layer->SetContentsOpaque(true); 2576 root_layer->SetContentsOpaque(true);
2572 2577
2573 layer_tree_host()->SetRootLayer(root_layer); 2578 layer_tree_host()->SetRootLayer(root_layer);
2574 2579
2575 // The expectations are based on the assumption that the default 2580 // The expectations are based on the assumption that the default
2576 // LCD settings are: 2581 // LCD settings are:
2577 EXPECT_TRUE(layer_tree_host()->settings().can_use_lcd_text); 2582 EXPECT_TRUE(layer_tree_host()->settings().can_use_lcd_text);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2789 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation 2794 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation
2790 : public LayerTreeHostTest { 2795 : public LayerTreeHostTest {
2791 protected: 2796 protected:
2792 void InitializeSettings(LayerTreeSettings* settings) override { 2797 void InitializeSettings(LayerTreeSettings* settings) override {
2793 settings->impl_side_painting = true; 2798 settings->impl_side_painting = true;
2794 } 2799 }
2795 2800
2796 void SetupTree() override { 2801 void SetupTree() override {
2797 LayerTreeHostTest::SetupTree(); 2802 LayerTreeHostTest::SetupTree();
2798 2803
2799 scoped_refptr<Layer> layer = PictureLayer::Create(&client_); 2804 scoped_refptr<Layer> layer =
2805 PictureLayer::Create(layer_settings(), &client_);
2800 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); 2806 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
2801 layer->SetBounds(gfx::Size(10, 10)); 2807 layer->SetBounds(gfx::Size(10, 10));
2802 layer_tree_host()->root_layer()->AddChild(layer); 2808 layer_tree_host()->root_layer()->AddChild(layer);
2803 } 2809 }
2804 2810
2805 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 2811 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
2806 2812
2807 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 2813 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
2808 EndTest(); 2814 EndTest();
2809 } 2815 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2841 bool FillsBoundsCompletely() const override { return false; } 2847 bool FillsBoundsCompletely() const override { return false; }
2842 2848
2843 private: 2849 private:
2844 Layer* layer_; 2850 Layer* layer_;
2845 }; 2851 };
2846 2852
2847 LayerTreeHostTestChangeLayerPropertiesInPaintContents() : num_commits_(0) {} 2853 LayerTreeHostTestChangeLayerPropertiesInPaintContents() : num_commits_(0) {}
2848 2854
2849 void SetupTree() override { 2855 void SetupTree() override {
2850 if (layer_tree_host()->settings().impl_side_painting) { 2856 if (layer_tree_host()->settings().impl_side_painting) {
2851 scoped_refptr<PictureLayer> root_layer = PictureLayer::Create(&client_); 2857 scoped_refptr<PictureLayer> root_layer =
2858 PictureLayer::Create(layer_settings(), &client_);
2852 layer_tree_host()->SetRootLayer(root_layer); 2859 layer_tree_host()->SetRootLayer(root_layer);
2853 } else { 2860 } else {
2854 scoped_refptr<ContentLayer> root_layer = ContentLayer::Create(&client_); 2861 scoped_refptr<ContentLayer> root_layer =
2862 ContentLayer::Create(layer_settings(), &client_);
2855 layer_tree_host()->SetRootLayer(root_layer); 2863 layer_tree_host()->SetRootLayer(root_layer);
2856 } 2864 }
2857 Layer* root_layer = layer_tree_host()->root_layer(); 2865 Layer* root_layer = layer_tree_host()->root_layer();
2858 root_layer->SetIsDrawable(true); 2866 root_layer->SetIsDrawable(true);
2859 root_layer->SetBounds(gfx::Size(1, 1)); 2867 root_layer->SetBounds(gfx::Size(1, 1));
2860 2868
2861 client_.set_layer(root_layer); 2869 client_.set_layer(root_layer);
2862 2870
2863 LayerTreeHostTest::SetupTree(); 2871 LayerTreeHostTest::SetupTree();
2864 } 2872 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2928 } 2936 }
2929 2937
2930 void SetupTree() override { 2938 void SetupTree() override {
2931 LayerTreeHostTest::SetupTree(); 2939 LayerTreeHostTest::SetupTree();
2932 2940
2933 layer_tree_host()->root_layer()->SetIsDrawable(false); 2941 layer_tree_host()->root_layer()->SetIsDrawable(false);
2934 2942
2935 io_surface_id_ = 9; 2943 io_surface_id_ = 9;
2936 io_surface_size_ = gfx::Size(6, 7); 2944 io_surface_size_ = gfx::Size(6, 7);
2937 2945
2938 scoped_refptr<IOSurfaceLayer> io_surface_layer = IOSurfaceLayer::Create(); 2946 scoped_refptr<IOSurfaceLayer> io_surface_layer =
2947 IOSurfaceLayer::Create(layer_settings());
2939 io_surface_layer->SetBounds(gfx::Size(10, 10)); 2948 io_surface_layer->SetBounds(gfx::Size(10, 10));
2940 io_surface_layer->SetIsDrawable(true); 2949 io_surface_layer->SetIsDrawable(true);
2941 io_surface_layer->SetContentsOpaque(true); 2950 io_surface_layer->SetContentsOpaque(true);
2942 io_surface_layer->SetIOSurfaceProperties(io_surface_id_, io_surface_size_); 2951 io_surface_layer->SetIOSurfaceProperties(io_surface_id_, io_surface_size_);
2943 layer_tree_host()->root_layer()->AddChild(io_surface_layer); 2952 layer_tree_host()->root_layer()->AddChild(io_surface_layer);
2944 } 2953 }
2945 2954
2946 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 2955 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
2947 2956
2948 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 2957 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3081 RunTest(true, true, true); 3090 RunTest(true, true, true);
3082 } 3091 }
3083 3092
3084 TEST_F(LayerTreeHostTestNumFramesPending, DISABLED_GLRenderer) { 3093 TEST_F(LayerTreeHostTestNumFramesPending, DISABLED_GLRenderer) {
3085 RunTest(true, false, true); 3094 RunTest(true, false, true);
3086 } 3095 }
3087 3096
3088 class LayerTreeHostTestResourcelessSoftwareDraw : public LayerTreeHostTest { 3097 class LayerTreeHostTestResourcelessSoftwareDraw : public LayerTreeHostTest {
3089 public: 3098 public:
3090 void SetupTree() override { 3099 void SetupTree() override {
3091 root_layer_ = FakePictureLayer::Create(&client_); 3100 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
3092 root_layer_->SetIsDrawable(true); 3101 root_layer_->SetIsDrawable(true);
3093 root_layer_->SetBounds(gfx::Size(50, 50)); 3102 root_layer_->SetBounds(gfx::Size(50, 50));
3094 3103
3095 parent_layer_ = FakePictureLayer::Create(&client_); 3104 parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
3096 parent_layer_->SetIsDrawable(true); 3105 parent_layer_->SetIsDrawable(true);
3097 parent_layer_->SetBounds(gfx::Size(50, 50)); 3106 parent_layer_->SetBounds(gfx::Size(50, 50));
3098 parent_layer_->SetForceRenderSurface(true); 3107 parent_layer_->SetForceRenderSurface(true);
3099 3108
3100 child_layer_ = FakePictureLayer::Create(&client_); 3109 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
3101 child_layer_->SetIsDrawable(true); 3110 child_layer_->SetIsDrawable(true);
3102 child_layer_->SetBounds(gfx::Size(50, 50)); 3111 child_layer_->SetBounds(gfx::Size(50, 50));
3103 3112
3104 root_layer_->AddChild(parent_layer_); 3113 root_layer_->AddChild(parent_layer_);
3105 parent_layer_->AddChild(child_layer_); 3114 parent_layer_->AddChild(child_layer_);
3106 layer_tree_host()->SetRootLayer(root_layer_); 3115 layer_tree_host()->SetRootLayer(root_layer_);
3107 3116
3108 LayerTreeHostTest::SetupTree(); 3117 LayerTreeHostTest::SetupTree();
3109 } 3118 }
3110 3119
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
3307 3316
3308 PushPropertiesCountingLayerImpl(LayerTreeImpl* tree_impl, int id) 3317 PushPropertiesCountingLayerImpl(LayerTreeImpl* tree_impl, int id)
3309 : LayerImpl(tree_impl, id), 3318 : LayerImpl(tree_impl, id),
3310 push_properties_count_(0) { 3319 push_properties_count_(0) {
3311 SetBounds(gfx::Size(1, 1)); 3320 SetBounds(gfx::Size(1, 1));
3312 } 3321 }
3313 }; 3322 };
3314 3323
3315 class PushPropertiesCountingLayer : public Layer { 3324 class PushPropertiesCountingLayer : public Layer {
3316 public: 3325 public:
3317 static scoped_refptr<PushPropertiesCountingLayer> Create() { 3326 static scoped_refptr<PushPropertiesCountingLayer> Create(
3318 return new PushPropertiesCountingLayer(); 3327 const LayerSettings& settings) {
3328 return new PushPropertiesCountingLayer(settings);
3319 } 3329 }
3320 3330
3321 void PushPropertiesTo(LayerImpl* layer) override { 3331 void PushPropertiesTo(LayerImpl* layer) override {
3322 Layer::PushPropertiesTo(layer); 3332 Layer::PushPropertiesTo(layer);
3323 push_properties_count_++; 3333 push_properties_count_++;
3324 if (persist_needs_push_properties_) 3334 if (persist_needs_push_properties_)
3325 needs_push_properties_ = true; 3335 needs_push_properties_ = true;
3326 } 3336 }
3327 3337
3328 // Something to make this layer push properties, but no other layer. 3338 // Something to make this layer push properties, but no other layer.
3329 void MakePushProperties() { SetContentsOpaque(!contents_opaque()); } 3339 void MakePushProperties() { SetContentsOpaque(!contents_opaque()); }
3330 3340
3331 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override { 3341 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override {
3332 return PushPropertiesCountingLayerImpl::Create(tree_impl, id()); 3342 return PushPropertiesCountingLayerImpl::Create(tree_impl, id());
3333 } 3343 }
3334 3344
3335 void SetDrawsContent(bool draws_content) { SetIsDrawable(draws_content); } 3345 void SetDrawsContent(bool draws_content) { SetIsDrawable(draws_content); }
3336 3346
3337 size_t push_properties_count() const { return push_properties_count_; } 3347 size_t push_properties_count() const { return push_properties_count_; }
3338 void reset_push_properties_count() { push_properties_count_ = 0; } 3348 void reset_push_properties_count() { push_properties_count_ = 0; }
3339 3349
3340 void set_persist_needs_push_properties(bool persist) { 3350 void set_persist_needs_push_properties(bool persist) {
3341 persist_needs_push_properties_ = persist; 3351 persist_needs_push_properties_ = persist;
3342 } 3352 }
3343 3353
3344 private: 3354 private:
3345 PushPropertiesCountingLayer() 3355 explicit PushPropertiesCountingLayer(const LayerSettings& settings)
3346 : push_properties_count_(0), persist_needs_push_properties_(false) { 3356 : Layer(settings),
3357 push_properties_count_(0),
3358 persist_needs_push_properties_(false) {
3347 SetBounds(gfx::Size(1, 1)); 3359 SetBounds(gfx::Size(1, 1));
3348 } 3360 }
3349 ~PushPropertiesCountingLayer() override {} 3361 ~PushPropertiesCountingLayer() override {}
3350 3362
3351 size_t push_properties_count_; 3363 size_t push_properties_count_;
3352 bool persist_needs_push_properties_; 3364 bool persist_needs_push_properties_;
3353 }; 3365 };
3354 3366
3355 class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest { 3367 class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest {
3356 protected: 3368 protected:
3357 void BeginTest() override { 3369 void BeginTest() override {
3358 num_commits_ = 0; 3370 num_commits_ = 0;
3359 expected_push_properties_root_ = 0; 3371 expected_push_properties_root_ = 0;
3360 expected_push_properties_child_ = 0; 3372 expected_push_properties_child_ = 0;
3361 expected_push_properties_grandchild_ = 0; 3373 expected_push_properties_grandchild_ = 0;
3362 expected_push_properties_child2_ = 0; 3374 expected_push_properties_child2_ = 0;
3363 expected_push_properties_other_root_ = 0; 3375 expected_push_properties_other_root_ = 0;
3364 expected_push_properties_leaf_layer_ = 0; 3376 expected_push_properties_leaf_layer_ = 0;
3365 PostSetNeedsCommitToMainThread(); 3377 PostSetNeedsCommitToMainThread();
3366 } 3378 }
3367 3379
3368 void SetupTree() override { 3380 void SetupTree() override {
3369 root_ = PushPropertiesCountingLayer::Create(); 3381 root_ = PushPropertiesCountingLayer::Create(layer_settings());
3370 root_->CreateRenderSurface(); 3382 root_->CreateRenderSurface();
3371 child_ = PushPropertiesCountingLayer::Create(); 3383 child_ = PushPropertiesCountingLayer::Create(layer_settings());
3372 child2_ = PushPropertiesCountingLayer::Create(); 3384 child2_ = PushPropertiesCountingLayer::Create(layer_settings());
3373 grandchild_ = PushPropertiesCountingLayer::Create(); 3385 grandchild_ = PushPropertiesCountingLayer::Create(layer_settings());
3374 leaf_always_pushing_layer_ = PushPropertiesCountingLayer::Create(); 3386 leaf_always_pushing_layer_ =
3387 PushPropertiesCountingLayer::Create(layer_settings());
3375 leaf_always_pushing_layer_->set_persist_needs_push_properties(true); 3388 leaf_always_pushing_layer_->set_persist_needs_push_properties(true);
3376 3389
3377 root_->AddChild(child_); 3390 root_->AddChild(child_);
3378 root_->AddChild(child2_); 3391 root_->AddChild(child2_);
3379 child_->AddChild(grandchild_); 3392 child_->AddChild(grandchild_);
3380 child2_->AddChild(leaf_always_pushing_layer_); 3393 child2_->AddChild(leaf_always_pushing_layer_);
3381 3394
3382 other_root_ = PushPropertiesCountingLayer::Create(); 3395 other_root_ = PushPropertiesCountingLayer::Create(layer_settings());
3383 other_root_->CreateRenderSurface(); 3396 other_root_->CreateRenderSurface();
3384 3397
3385 // Don't set the root layer here. 3398 // Don't set the root layer here.
3386 LayerTreeHostTest::SetupTree(); 3399 LayerTreeHostTest::SetupTree();
3387 } 3400 }
3388 3401
3389 void DidCommitAndDrawFrame() override { 3402 void DidCommitAndDrawFrame() override {
3390 EXPECT_EQ(expected_push_properties_root_, root_->push_properties_count()) 3403 EXPECT_EQ(expected_push_properties_root_, root_->push_properties_count())
3391 << "num_commits: " << num_commits_; 3404 << "num_commits: " << num_commits_;
3392 EXPECT_EQ(expected_push_properties_child_, child_->push_properties_count()) 3405 EXPECT_EQ(expected_push_properties_child_, child_->push_properties_count())
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
3751 TEST_F(LayerTreeHostTestImplLayersPushProperties, DelegatingRenderer) { 3764 TEST_F(LayerTreeHostTestImplLayersPushProperties, DelegatingRenderer) {
3752 RunTestWithImplSidePainting(); 3765 RunTestWithImplSidePainting();
3753 } 3766 }
3754 3767
3755 class LayerTreeHostTestPropertyChangesDuringUpdateArePushed 3768 class LayerTreeHostTestPropertyChangesDuringUpdateArePushed
3756 : public LayerTreeHostTest { 3769 : public LayerTreeHostTest {
3757 protected: 3770 protected:
3758 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 3771 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
3759 3772
3760 void SetupTree() override { 3773 void SetupTree() override {
3761 root_ = Layer::Create(); 3774 root_ = Layer::Create(layer_settings());
3762 root_->CreateRenderSurface(); 3775 root_->CreateRenderSurface();
3763 root_->SetBounds(gfx::Size(1, 1)); 3776 root_->SetBounds(gfx::Size(1, 1));
3764 3777
3765 bool paint_scrollbar = true; 3778 bool paint_scrollbar = true;
3766 bool has_thumb = false; 3779 bool has_thumb = false;
3767 scrollbar_layer_ = FakePaintedScrollbarLayer::Create( 3780 scrollbar_layer_ = FakePaintedScrollbarLayer::Create(
3768 paint_scrollbar, has_thumb, root_->id()); 3781 layer_settings(), paint_scrollbar, has_thumb, root_->id());
3769 3782
3770 root_->AddChild(scrollbar_layer_); 3783 root_->AddChild(scrollbar_layer_);
3771 3784
3772 layer_tree_host()->SetRootLayer(root_); 3785 layer_tree_host()->SetRootLayer(root_);
3773 LayerTreeHostTest::SetupTree(); 3786 LayerTreeHostTest::SetupTree();
3774 } 3787 }
3775 3788
3776 void DidCommitAndDrawFrame() override { 3789 void DidCommitAndDrawFrame() override {
3777 switch (layer_tree_host()->source_frame_number()) { 3790 switch (layer_tree_host()->source_frame_number()) {
3778 case 0: 3791 case 0:
(...skipping 29 matching lines...) Expand all
3808 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer_; 3821 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer_;
3809 }; 3822 };
3810 3823
3811 MULTI_THREAD_TEST_F(LayerTreeHostTestPropertyChangesDuringUpdateArePushed); 3824 MULTI_THREAD_TEST_F(LayerTreeHostTestPropertyChangesDuringUpdateArePushed);
3812 3825
3813 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { 3826 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest {
3814 protected: 3827 protected:
3815 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 3828 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
3816 3829
3817 void SetupTree() override { 3830 void SetupTree() override {
3818 root_ = PushPropertiesCountingLayer::Create(); 3831 root_ = PushPropertiesCountingLayer::Create(layer_settings());
3819 root_->CreateRenderSurface(); 3832 root_->CreateRenderSurface();
3820 child_ = PushPropertiesCountingLayer::Create(); 3833 child_ = PushPropertiesCountingLayer::Create(layer_settings());
3821 root_->AddChild(child_); 3834 root_->AddChild(child_);
3822 3835
3823 layer_tree_host()->SetRootLayer(root_); 3836 layer_tree_host()->SetRootLayer(root_);
3824 LayerTreeHostTest::SetupTree(); 3837 LayerTreeHostTest::SetupTree();
3825 } 3838 }
3826 3839
3827 void DidCommitAndDrawFrame() override { 3840 void DidCommitAndDrawFrame() override {
3828 switch (layer_tree_host()->source_frame_number()) { 3841 switch (layer_tree_host()->source_frame_number()) {
3829 case 0: 3842 case 0:
3830 break; 3843 break;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3870 void BeginTest() override { 3883 void BeginTest() override {
3871 expected_push_properties_root_ = 0; 3884 expected_push_properties_root_ = 0;
3872 expected_push_properties_child_ = 0; 3885 expected_push_properties_child_ = 0;
3873 expected_push_properties_grandchild1_ = 0; 3886 expected_push_properties_grandchild1_ = 0;
3874 expected_push_properties_grandchild2_ = 0; 3887 expected_push_properties_grandchild2_ = 0;
3875 expected_push_properties_grandchild3_ = 0; 3888 expected_push_properties_grandchild3_ = 0;
3876 PostSetNeedsCommitToMainThread(); 3889 PostSetNeedsCommitToMainThread();
3877 } 3890 }
3878 3891
3879 void SetupTree() override { 3892 void SetupTree() override {
3880 root_ = PushPropertiesCountingLayer::Create(); 3893 root_ = PushPropertiesCountingLayer::Create(layer_settings());
3881 root_->CreateRenderSurface(); 3894 root_->CreateRenderSurface();
3882 child_ = PushPropertiesCountingLayer::Create(); 3895 child_ = PushPropertiesCountingLayer::Create(layer_settings());
3883 grandchild1_ = PushPropertiesCountingLayer::Create(); 3896 grandchild1_ = PushPropertiesCountingLayer::Create(layer_settings());
3884 grandchild2_ = PushPropertiesCountingLayer::Create(); 3897 grandchild2_ = PushPropertiesCountingLayer::Create(layer_settings());
3885 grandchild3_ = PushPropertiesCountingLayer::Create(); 3898 grandchild3_ = PushPropertiesCountingLayer::Create(layer_settings());
3886 3899
3887 root_->AddChild(child_); 3900 root_->AddChild(child_);
3888 child_->AddChild(grandchild1_); 3901 child_->AddChild(grandchild1_);
3889 child_->AddChild(grandchild2_); 3902 child_->AddChild(grandchild2_);
3890 child_->AddChild(grandchild3_); 3903 child_->AddChild(grandchild3_);
3891 3904
3892 // Don't set the root layer here. 3905 // Don't set the root layer here.
3893 LayerTreeHostTest::SetupTree(); 3906 LayerTreeHostTest::SetupTree();
3894 } 3907 }
3895 3908
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
4383 int num_draws_; 4396 int num_draws_;
4384 }; 4397 };
4385 4398
4386 // VideoLayer must support being invalidated and then passing that along 4399 // VideoLayer must support being invalidated and then passing that along
4387 // to the compositor thread, even though no resources are updated in 4400 // to the compositor thread, even though no resources are updated in
4388 // response to that invalidation. 4401 // response to that invalidation.
4389 class LayerTreeHostTestVideoLayerInvalidate : public LayerInvalidateCausesDraw { 4402 class LayerTreeHostTestVideoLayerInvalidate : public LayerInvalidateCausesDraw {
4390 public: 4403 public:
4391 void SetupTree() override { 4404 void SetupTree() override {
4392 LayerTreeHostTest::SetupTree(); 4405 LayerTreeHostTest::SetupTree();
4393 scoped_refptr<VideoLayer> video_layer = 4406 scoped_refptr<VideoLayer> video_layer = VideoLayer::Create(
4394 VideoLayer::Create(&provider_, media::VIDEO_ROTATION_0); 4407 layer_settings(), &provider_, media::VIDEO_ROTATION_0);
4395 video_layer->SetBounds(gfx::Size(10, 10)); 4408 video_layer->SetBounds(gfx::Size(10, 10));
4396 video_layer->SetIsDrawable(true); 4409 video_layer->SetIsDrawable(true);
4397 layer_tree_host()->root_layer()->AddChild(video_layer); 4410 layer_tree_host()->root_layer()->AddChild(video_layer);
4398 4411
4399 invalidate_layer_ = video_layer; 4412 invalidate_layer_ = video_layer;
4400 } 4413 }
4401 4414
4402 private: 4415 private:
4403 FakeVideoFrameProvider provider_; 4416 FakeVideoFrameProvider provider_;
4404 }; 4417 };
4405 4418
4406 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate); 4419 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate);
4407 4420
4408 // IOSurfaceLayer must support being invalidated and then passing that along 4421 // IOSurfaceLayer must support being invalidated and then passing that along
4409 // to the compositor thread, even though no resources are updated in 4422 // to the compositor thread, even though no resources are updated in
4410 // response to that invalidation. 4423 // response to that invalidation.
4411 class LayerTreeHostTestIOSurfaceLayerInvalidate 4424 class LayerTreeHostTestIOSurfaceLayerInvalidate
4412 : public LayerInvalidateCausesDraw { 4425 : public LayerInvalidateCausesDraw {
4413 public: 4426 public:
4414 void SetupTree() override { 4427 void SetupTree() override {
4415 LayerTreeHostTest::SetupTree(); 4428 LayerTreeHostTest::SetupTree();
4416 scoped_refptr<IOSurfaceLayer> layer = IOSurfaceLayer::Create(); 4429 scoped_refptr<IOSurfaceLayer> layer =
4430 IOSurfaceLayer::Create(layer_settings());
4417 layer->SetBounds(gfx::Size(10, 10)); 4431 layer->SetBounds(gfx::Size(10, 10));
4418 uint32_t fake_io_surface_id = 7; 4432 uint32_t fake_io_surface_id = 7;
4419 layer->SetIOSurfaceProperties(fake_io_surface_id, layer->bounds()); 4433 layer->SetIOSurfaceProperties(fake_io_surface_id, layer->bounds());
4420 layer->SetIsDrawable(true); 4434 layer->SetIsDrawable(true);
4421 layer_tree_host()->root_layer()->AddChild(layer); 4435 layer_tree_host()->root_layer()->AddChild(layer);
4422 4436
4423 invalidate_layer_ = layer; 4437 invalidate_layer_ = layer;
4424 } 4438 }
4425 }; 4439 };
4426 4440
4427 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335 4441 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335
4428 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 4442 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
4429 LayerTreeHostTestIOSurfaceLayerInvalidate); 4443 LayerTreeHostTestIOSurfaceLayerInvalidate);
4430 4444
4431 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { 4445 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest {
4432 protected: 4446 protected:
4433 void SetupTree() override { 4447 void SetupTree() override {
4434 root_layer_ = Layer::Create(); 4448 root_layer_ = Layer::Create(layer_settings());
4435 root_layer_->CreateRenderSurface(); 4449 root_layer_->CreateRenderSurface();
4436 root_layer_->SetPosition(gfx::Point()); 4450 root_layer_->SetPosition(gfx::Point());
4437 root_layer_->SetBounds(gfx::Size(10, 10)); 4451 root_layer_->SetBounds(gfx::Size(10, 10));
4438 4452
4439 parent_layer_ = SolidColorLayer::Create(); 4453 parent_layer_ = SolidColorLayer::Create(layer_settings());
4440 parent_layer_->SetPosition(gfx::Point()); 4454 parent_layer_->SetPosition(gfx::Point());
4441 parent_layer_->SetBounds(gfx::Size(10, 10)); 4455 parent_layer_->SetBounds(gfx::Size(10, 10));
4442 parent_layer_->SetIsDrawable(true); 4456 parent_layer_->SetIsDrawable(true);
4443 root_layer_->AddChild(parent_layer_); 4457 root_layer_->AddChild(parent_layer_);
4444 4458
4445 child_layer_ = SolidColorLayer::Create(); 4459 child_layer_ = SolidColorLayer::Create(layer_settings());
4446 child_layer_->SetPosition(gfx::Point()); 4460 child_layer_->SetPosition(gfx::Point());
4447 child_layer_->SetBounds(gfx::Size(10, 10)); 4461 child_layer_->SetBounds(gfx::Size(10, 10));
4448 child_layer_->SetIsDrawable(true); 4462 child_layer_->SetIsDrawable(true);
4449 parent_layer_->AddChild(child_layer_); 4463 parent_layer_->AddChild(child_layer_);
4450 4464
4451 layer_tree_host()->SetRootLayer(root_layer_); 4465 layer_tree_host()->SetRootLayer(root_layer_);
4452 LayerTreeHostTest::SetupTree(); 4466 LayerTreeHostTest::SetupTree();
4453 } 4467 }
4454 4468
4455 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4469 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
4495 4509
4496 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer); 4510 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer);
4497 4511
4498 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { 4512 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest {
4499 protected: 4513 protected:
4500 void InitializeSettings(LayerTreeSettings* settings) override { 4514 void InitializeSettings(LayerTreeSettings* settings) override {
4501 settings->impl_side_painting = true; 4515 settings->impl_side_painting = true;
4502 } 4516 }
4503 4517
4504 void SetupTree() override { 4518 void SetupTree() override {
4505 root_layer_ = FakePictureLayer::Create(&client_); 4519 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
4506 root_layer_->SetBounds(gfx::Size(10, 10)); 4520 root_layer_->SetBounds(gfx::Size(10, 10));
4507 4521
4508 layer_tree_host()->SetRootLayer(root_layer_); 4522 layer_tree_host()->SetRootLayer(root_layer_);
4509 LayerTreeHostTest::SetupTree(); 4523 LayerTreeHostTest::SetupTree();
4510 } 4524 }
4511 4525
4512 void BeginTest() override { 4526 void BeginTest() override {
4513 // The viewport is empty, but we still need to update layers on the main 4527 // The viewport is empty, but we still need to update layers on the main
4514 // thread. 4528 // thread.
4515 layer_tree_host()->SetViewportSize(gfx::Size(0, 0)); 4529 layer_tree_host()->SetViewportSize(gfx::Size(0, 0));
(...skipping 15 matching lines...) Expand all
4531 4545
4532 MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateLayerInEmptyViewport); 4546 MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateLayerInEmptyViewport);
4533 4547
4534 class LayerTreeHostTestAbortEvictedTextures : public LayerTreeHostTest { 4548 class LayerTreeHostTestAbortEvictedTextures : public LayerTreeHostTest {
4535 public: 4549 public:
4536 LayerTreeHostTestAbortEvictedTextures() 4550 LayerTreeHostTestAbortEvictedTextures()
4537 : num_will_begin_main_frames_(0), num_impl_commits_(0) {} 4551 : num_will_begin_main_frames_(0), num_impl_commits_(0) {}
4538 4552
4539 protected: 4553 protected:
4540 void SetupTree() override { 4554 void SetupTree() override {
4541 scoped_refptr<SolidColorLayer> root_layer = SolidColorLayer::Create(); 4555 scoped_refptr<SolidColorLayer> root_layer =
4556 SolidColorLayer::Create(layer_settings());
4542 root_layer->SetBounds(gfx::Size(200, 200)); 4557 root_layer->SetBounds(gfx::Size(200, 200));
4543 root_layer->SetIsDrawable(true); 4558 root_layer->SetIsDrawable(true);
4544 root_layer->CreateRenderSurface(); 4559 root_layer->CreateRenderSurface();
4545 4560
4546 layer_tree_host()->SetRootLayer(root_layer); 4561 layer_tree_host()->SetRootLayer(root_layer);
4547 LayerTreeHostTest::SetupTree(); 4562 LayerTreeHostTest::SetupTree();
4548 } 4563 }
4549 4564
4550 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4565 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
4551 4566
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4607 context_provider->SetMaxTransferBufferUsageBytes(512 * 512); 4622 context_provider->SetMaxTransferBufferUsageBytes(512 * 512);
4608 if (delegating_renderer()) 4623 if (delegating_renderer())
4609 return FakeOutputSurface::CreateDelegating3d(context_provider); 4624 return FakeOutputSurface::CreateDelegating3d(context_provider);
4610 else 4625 else
4611 return FakeOutputSurface::Create3d(context_provider); 4626 return FakeOutputSurface::Create3d(context_provider);
4612 } 4627 }
4613 4628
4614 void SetupTree() override { 4629 void SetupTree() override {
4615 client_.set_fill_with_nonsolid_color(true); 4630 client_.set_fill_with_nonsolid_color(true);
4616 scoped_refptr<FakePictureLayer> root_layer = 4631 scoped_refptr<FakePictureLayer> root_layer =
4617 FakePictureLayer::Create(&client_); 4632 FakePictureLayer::Create(layer_settings(), &client_);
4618 root_layer->SetBounds(gfx::Size(1024, 1024)); 4633 root_layer->SetBounds(gfx::Size(1024, 1024));
4619 root_layer->SetIsDrawable(true); 4634 root_layer->SetIsDrawable(true);
4620 4635
4621 layer_tree_host()->SetRootLayer(root_layer); 4636 layer_tree_host()->SetRootLayer(root_layer);
4622 LayerTreeHostTest::SetupTree(); 4637 LayerTreeHostTest::SetupTree();
4623 } 4638 }
4624 4639
4625 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4640 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
4626 4641
4627 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { 4642 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
4762 make_scoped_ptr(new ManagedMemoryPolicy( 4777 make_scoped_ptr(new ManagedMemoryPolicy(
4763 second_context_provider_.get() ? second_output_surface_memory_limit_ 4778 second_context_provider_.get() ? second_output_surface_memory_limit_
4764 : first_output_surface_memory_limit_, 4779 : first_output_surface_memory_limit_,
4765 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, 4780 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
4766 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); 4781 ManagedMemoryPolicy::kDefaultNumResourcesLimit)));
4767 return output_surface.Pass(); 4782 return output_surface.Pass();
4768 } 4783 }
4769 4784
4770 void SetupTree() override { 4785 void SetupTree() override {
4771 if (layer_tree_host()->settings().impl_side_painting) 4786 if (layer_tree_host()->settings().impl_side_painting)
4772 root_ = FakePictureLayer::Create(&client_); 4787 root_ = FakePictureLayer::Create(layer_settings(), &client_);
4773 else 4788 else
4774 root_ = FakeContentLayer::Create(&client_); 4789 root_ = FakeContentLayer::Create(layer_settings(), &client_);
4775 root_->SetBounds(gfx::Size(20, 20)); 4790 root_->SetBounds(gfx::Size(20, 20));
4776 layer_tree_host()->SetRootLayer(root_); 4791 layer_tree_host()->SetRootLayer(root_);
4777 LayerTreeHostTest::SetupTree(); 4792 LayerTreeHostTest::SetupTree();
4778 } 4793 }
4779 4794
4780 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4795 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
4781 4796
4782 void DidCommitAndDrawFrame() override { 4797 void DidCommitAndDrawFrame() override {
4783 // Lost context sometimes takes two frames to recreate. The third frame 4798 // Lost context sometimes takes two frames to recreate. The third frame
4784 // is sometimes aborted, so wait until the fourth frame to verify that 4799 // is sometimes aborted, so wait until the fourth frame to verify that
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
4935 TestSwapPromiseResult swap_promise_result_[3]; 4950 TestSwapPromiseResult swap_promise_result_[3];
4936 }; 4951 };
4937 4952
4938 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); 4953 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise);
4939 4954
4940 class LayerTreeHostTestKeepSwapPromise : public LayerTreeTest { 4955 class LayerTreeHostTestKeepSwapPromise : public LayerTreeTest {
4941 public: 4956 public:
4942 LayerTreeHostTestKeepSwapPromise() {} 4957 LayerTreeHostTestKeepSwapPromise() {}
4943 4958
4944 void BeginTest() override { 4959 void BeginTest() override {
4945 layer_ = SolidColorLayer::Create(); 4960 layer_ = SolidColorLayer::Create(layer_settings());
4946 layer_->SetIsDrawable(true); 4961 layer_->SetIsDrawable(true);
4947 layer_->SetBounds(gfx::Size(10, 10)); 4962 layer_->SetBounds(gfx::Size(10, 10));
4948 layer_tree_host()->SetRootLayer(layer_); 4963 layer_tree_host()->SetRootLayer(layer_);
4949 gfx::Size bounds(100, 100); 4964 gfx::Size bounds(100, 100);
4950 layer_tree_host()->SetViewportSize(bounds); 4965 layer_tree_host()->SetViewportSize(bounds);
4951 PostSetNeedsCommitToMainThread(); 4966 PostSetNeedsCommitToMainThread();
4952 } 4967 }
4953 4968
4954 void DidCommit() override { 4969 void DidCommit() override {
4955 MainThreadTaskRunner()->PostTask( 4970 MainThreadTaskRunner()->PostTask(
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
5217 void InitializeSettings(LayerTreeSettings* settings) override { 5232 void InitializeSettings(LayerTreeSettings* settings) override {
5218 settings->impl_side_painting = true; 5233 settings->impl_side_painting = true;
5219 5234
5220 EXPECT_FALSE(settings->gpu_rasterization_enabled); 5235 EXPECT_FALSE(settings->gpu_rasterization_enabled);
5221 EXPECT_FALSE(settings->gpu_rasterization_forced); 5236 EXPECT_FALSE(settings->gpu_rasterization_forced);
5222 } 5237 }
5223 5238
5224 void SetupTree() override { 5239 void SetupTree() override {
5225 LayerTreeHostTest::SetupTree(); 5240 LayerTreeHostTest::SetupTree();
5226 5241
5227 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&layer_client_); 5242 scoped_refptr<PictureLayer> layer =
5243 PictureLayer::Create(layer_settings(), &layer_client_);
5228 layer->SetBounds(gfx::Size(10, 10)); 5244 layer->SetBounds(gfx::Size(10, 10));
5229 layer->SetIsDrawable(true); 5245 layer->SetIsDrawable(true);
5230 layer_tree_host()->root_layer()->AddChild(layer); 5246 layer_tree_host()->root_layer()->AddChild(layer);
5231 } 5247 }
5232 5248
5233 void BeginTest() override { 5249 void BeginTest() override {
5234 Layer* root = layer_tree_host()->root_layer(); 5250 Layer* root = layer_tree_host()->root_layer();
5235 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0)); 5251 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0));
5236 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); 5252 RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
5237 5253
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5273 void InitializeSettings(LayerTreeSettings* settings) override { 5289 void InitializeSettings(LayerTreeSettings* settings) override {
5274 settings->impl_side_painting = true; 5290 settings->impl_side_painting = true;
5275 5291
5276 EXPECT_FALSE(settings->gpu_rasterization_enabled); 5292 EXPECT_FALSE(settings->gpu_rasterization_enabled);
5277 settings->gpu_rasterization_enabled = true; 5293 settings->gpu_rasterization_enabled = true;
5278 } 5294 }
5279 5295
5280 void SetupTree() override { 5296 void SetupTree() override {
5281 LayerTreeHostTest::SetupTree(); 5297 LayerTreeHostTest::SetupTree();
5282 5298
5283 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&layer_client_); 5299 scoped_refptr<PictureLayer> layer =
5300 PictureLayer::Create(layer_settings(), &layer_client_);
5284 layer->SetBounds(gfx::Size(10, 10)); 5301 layer->SetBounds(gfx::Size(10, 10));
5285 layer->SetIsDrawable(true); 5302 layer->SetIsDrawable(true);
5286 layer_tree_host()->root_layer()->AddChild(layer); 5303 layer_tree_host()->root_layer()->AddChild(layer);
5287 } 5304 }
5288 5305
5289 void BeginTest() override { 5306 void BeginTest() override {
5290 Layer* root = layer_tree_host()->root_layer(); 5307 Layer* root = layer_tree_host()->root_layer();
5291 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0)); 5308 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0));
5292 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); 5309 RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
5293 5310
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
5339 ASSERT_TRUE(settings->impl_side_painting); 5356 ASSERT_TRUE(settings->impl_side_painting);
5340 5357
5341 EXPECT_FALSE(settings->gpu_rasterization_forced); 5358 EXPECT_FALSE(settings->gpu_rasterization_forced);
5342 settings->gpu_rasterization_forced = true; 5359 settings->gpu_rasterization_forced = true;
5343 } 5360 }
5344 5361
5345 void SetupTree() override { 5362 void SetupTree() override {
5346 LayerTreeHostTest::SetupTree(); 5363 LayerTreeHostTest::SetupTree();
5347 5364
5348 scoped_refptr<FakePictureLayer> layer = 5365 scoped_refptr<FakePictureLayer> layer =
5349 FakePictureLayer::Create(&layer_client_); 5366 FakePictureLayer::Create(layer_settings(), &layer_client_);
5350 layer->SetBounds(gfx::Size(10, 10)); 5367 layer->SetBounds(gfx::Size(10, 10));
5351 layer->SetIsDrawable(true); 5368 layer->SetIsDrawable(true);
5352 layer_tree_host()->root_layer()->AddChild(layer); 5369 layer_tree_host()->root_layer()->AddChild(layer);
5353 } 5370 }
5354 5371
5355 void BeginTest() override { 5372 void BeginTest() override {
5356 Layer* root = layer_tree_host()->root_layer(); 5373 Layer* root = layer_tree_host()->root_layer();
5357 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0)); 5374 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0));
5358 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); 5375 RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
5359 5376
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
5401 5418
5402 class LayerTreeHostTestContinuousPainting : public LayerTreeHostTest { 5419 class LayerTreeHostTestContinuousPainting : public LayerTreeHostTest {
5403 public: 5420 public:
5404 LayerTreeHostTestContinuousPainting() 5421 LayerTreeHostTestContinuousPainting()
5405 : num_commits_(0), num_draws_(0), bounds_(20, 20), child_layer_(NULL) {} 5422 : num_commits_(0), num_draws_(0), bounds_(20, 20), child_layer_(NULL) {}
5406 5423
5407 protected: 5424 protected:
5408 enum { kExpectedNumCommits = 10 }; 5425 enum { kExpectedNumCommits = 10 };
5409 5426
5410 void SetupTree() override { 5427 void SetupTree() override {
5411 scoped_refptr<Layer> root_layer = Layer::Create(); 5428 scoped_refptr<Layer> root_layer = Layer::Create(layer_settings());
5412 root_layer->SetBounds(bounds_); 5429 root_layer->SetBounds(bounds_);
5413 root_layer->CreateRenderSurface(); 5430 root_layer->CreateRenderSurface();
5414 5431
5415 if (layer_tree_host()->settings().impl_side_painting) { 5432 if (layer_tree_host()->settings().impl_side_painting) {
5416 picture_layer_ = FakePictureLayer::Create(&client_); 5433 picture_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
5417 child_layer_ = picture_layer_.get(); 5434 child_layer_ = picture_layer_.get();
5418 } else { 5435 } else {
5419 content_layer_ = ContentLayerWithUpdateTracking::Create(&client_); 5436 content_layer_ =
5437 ContentLayerWithUpdateTracking::Create(layer_settings(), &client_);
5420 child_layer_ = content_layer_.get(); 5438 child_layer_ = content_layer_.get();
5421 } 5439 }
5422 child_layer_->SetBounds(bounds_); 5440 child_layer_->SetBounds(bounds_);
5423 child_layer_->SetIsDrawable(true); 5441 child_layer_->SetIsDrawable(true);
5424 root_layer->AddChild(child_layer_); 5442 root_layer->AddChild(child_layer_);
5425 5443
5426 layer_tree_host()->SetRootLayer(root_layer); 5444 layer_tree_host()->SetRootLayer(root_layer);
5427 layer_tree_host()->SetViewportSize(bounds_); 5445 layer_tree_host()->SetViewportSize(bounds_);
5428 LayerTreeHostTest::SetupTree(); 5446 LayerTreeHostTest::SetupTree();
5429 } 5447 }
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
5752 class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest { 5770 class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest {
5753 protected: 5771 protected:
5754 LayerTreeHostTestCrispUpAfterPinchEnds() 5772 LayerTreeHostTestCrispUpAfterPinchEnds()
5755 : playback_allowed_event_(true, true) {} 5773 : playback_allowed_event_(true, true) {}
5756 5774
5757 void SetupTree() override { 5775 void SetupTree() override {
5758 frame_ = 1; 5776 frame_ = 1;
5759 posted_ = false; 5777 posted_ = false;
5760 client_.set_fill_with_nonsolid_color(true); 5778 client_.set_fill_with_nonsolid_color(true);
5761 5779
5762 scoped_refptr<Layer> root = Layer::Create(); 5780 scoped_refptr<Layer> root = Layer::Create(layer_settings());
5763 root->SetBounds(gfx::Size(500, 500)); 5781 root->SetBounds(gfx::Size(500, 500));
5764 5782
5765 scoped_refptr<Layer> pinch = Layer::Create(); 5783 scoped_refptr<Layer> pinch = Layer::Create(layer_settings());
5766 pinch->SetBounds(gfx::Size(500, 500)); 5784 pinch->SetBounds(gfx::Size(500, 500));
5767 pinch->SetScrollClipLayerId(root->id()); 5785 pinch->SetScrollClipLayerId(root->id());
5768 pinch->SetIsContainerForFixedPositionLayers(true); 5786 pinch->SetIsContainerForFixedPositionLayers(true);
5769 root->AddChild(pinch); 5787 root->AddChild(pinch);
5770 5788
5771 scoped_ptr<FakePicturePile> pile( 5789 scoped_ptr<FakePicturePile> pile(
5772 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 5790 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
5773 ImplSidePaintingSettings().default_tile_grid_size)); 5791 ImplSidePaintingSettings().default_tile_grid_size));
5774 pile->SetPlaybackAllowedEvent(&playback_allowed_event_); 5792 pile->SetPlaybackAllowedEvent(&playback_allowed_event_);
5775 scoped_refptr<FakePictureLayer> layer = 5793 scoped_refptr<FakePictureLayer> layer =
5776 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 5794 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
5795 pile.Pass());
5777 layer->SetBounds(gfx::Size(500, 500)); 5796 layer->SetBounds(gfx::Size(500, 500));
5778 layer->SetContentsOpaque(true); 5797 layer->SetContentsOpaque(true);
5779 // Avoid LCD text on the layer so we don't cause extra commits when we 5798 // Avoid LCD text on the layer so we don't cause extra commits when we
5780 // pinch. 5799 // pinch.
5781 layer->disable_lcd_text(); 5800 layer->disable_lcd_text();
5782 pinch->AddChild(layer); 5801 pinch->AddChild(layer);
5783 5802
5784 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch); 5803 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch);
5785 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); 5804 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f);
5786 layer_tree_host()->SetRootLayer(root); 5805 layer_tree_host()->SetRootLayer(root);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
5963 RasterizeWithGpuRasterizationCreatesResources() {} 5982 RasterizeWithGpuRasterizationCreatesResources() {}
5964 5983
5965 void InitializeSettings(LayerTreeSettings* settings) override { 5984 void InitializeSettings(LayerTreeSettings* settings) override {
5966 settings->impl_side_painting = true; 5985 settings->impl_side_painting = true;
5967 settings->gpu_rasterization_forced = true; 5986 settings->gpu_rasterization_forced = true;
5968 } 5987 }
5969 5988
5970 void SetupTree() override { 5989 void SetupTree() override {
5971 client_.set_fill_with_nonsolid_color(true); 5990 client_.set_fill_with_nonsolid_color(true);
5972 5991
5973 scoped_refptr<Layer> root = Layer::Create(); 5992 scoped_refptr<Layer> root = Layer::Create(layer_settings());
5974 root->SetBounds(gfx::Size(500, 500)); 5993 root->SetBounds(gfx::Size(500, 500));
5975 5994
5976 scoped_ptr<FakePicturePile> pile( 5995 scoped_ptr<FakePicturePile> pile(
5977 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 5996 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
5978 ImplSidePaintingSettings().default_tile_grid_size)); 5997 ImplSidePaintingSettings().default_tile_grid_size));
5979 scoped_refptr<FakePictureLayer> layer = 5998 scoped_refptr<FakePictureLayer> layer =
5980 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 5999 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
6000 pile.Pass());
5981 layer->SetBounds(gfx::Size(500, 500)); 6001 layer->SetBounds(gfx::Size(500, 500));
5982 layer->SetContentsOpaque(true); 6002 layer->SetContentsOpaque(true);
5983 root->AddChild(layer); 6003 root->AddChild(layer);
5984 6004
5985 layer_tree_host()->SetRootLayer(root); 6005 layer_tree_host()->SetRootLayer(root);
5986 LayerTreeHostTest::SetupTree(); 6006 LayerTreeHostTest::SetupTree();
5987 } 6007 }
5988 6008
5989 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6009 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
5990 6010
(...skipping 21 matching lines...) Expand all
6012 settings->gpu_rasterization_forced = true; 6032 settings->gpu_rasterization_forced = true;
6013 } 6033 }
6014 6034
6015 void SetupTree() override { 6035 void SetupTree() override {
6016 client_.set_fill_with_nonsolid_color(true); 6036 client_.set_fill_with_nonsolid_color(true);
6017 6037
6018 scoped_ptr<FakePicturePile> pile( 6038 scoped_ptr<FakePicturePile> pile(
6019 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 6039 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
6020 ImplSidePaintingSettings().default_tile_grid_size)); 6040 ImplSidePaintingSettings().default_tile_grid_size));
6021 scoped_refptr<FakePictureLayer> root = 6041 scoped_refptr<FakePictureLayer> root =
6022 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 6042 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
6043 pile.Pass());
6023 root->SetBounds(gfx::Size(10000, 10000)); 6044 root->SetBounds(gfx::Size(10000, 10000));
6024 root->SetContentsOpaque(true); 6045 root->SetContentsOpaque(true);
6025 6046
6026 layer_tree_host()->SetRootLayer(root); 6047 layer_tree_host()->SetRootLayer(root);
6027 LayerTreeHostTest::SetupTree(); 6048 LayerTreeHostTest::SetupTree();
6028 layer_tree_host()->SetViewportSize(viewport_size_); 6049 layer_tree_host()->SetViewportSize(viewport_size_);
6029 } 6050 }
6030 6051
6031 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6052 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6032 6053
(...skipping 22 matching lines...) Expand all
6055 6076
6056 void InitializeSettings(LayerTreeSettings* settings) override { 6077 void InitializeSettings(LayerTreeSettings* settings) override {
6057 settings->impl_side_painting = true; 6078 settings->impl_side_painting = true;
6058 } 6079 }
6059 6080
6060 void SetupTree() override { 6081 void SetupTree() override {
6061 step_ = 1; 6082 step_ = 1;
6062 continuous_draws_ = 0; 6083 continuous_draws_ = 0;
6063 client_.set_fill_with_nonsolid_color(true); 6084 client_.set_fill_with_nonsolid_color(true);
6064 6085
6065 scoped_refptr<Layer> root = Layer::Create(); 6086 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6066 root->SetBounds(gfx::Size(500, 500)); 6087 root->SetBounds(gfx::Size(500, 500));
6067 6088
6068 scoped_refptr<Layer> pinch = Layer::Create(); 6089 scoped_refptr<Layer> pinch = Layer::Create(layer_settings());
6069 pinch->SetBounds(gfx::Size(500, 500)); 6090 pinch->SetBounds(gfx::Size(500, 500));
6070 pinch->SetScrollClipLayerId(root->id()); 6091 pinch->SetScrollClipLayerId(root->id());
6071 pinch->SetIsContainerForFixedPositionLayers(true); 6092 pinch->SetIsContainerForFixedPositionLayers(true);
6072 root->AddChild(pinch); 6093 root->AddChild(pinch);
6073 6094
6074 scoped_ptr<FakePicturePile> pile( 6095 scoped_ptr<FakePicturePile> pile(
6075 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, 6096 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale,
6076 ImplSidePaintingSettings().default_tile_grid_size)); 6097 ImplSidePaintingSettings().default_tile_grid_size));
6077 pile->SetPlaybackAllowedEvent(&playback_allowed_event_); 6098 pile->SetPlaybackAllowedEvent(&playback_allowed_event_);
6078 scoped_refptr<FakePictureLayer> layer = 6099 scoped_refptr<FakePictureLayer> layer =
6079 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); 6100 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
6101 pile.Pass());
6080 layer->SetBounds(gfx::Size(500, 500)); 6102 layer->SetBounds(gfx::Size(500, 500));
6081 layer->SetContentsOpaque(true); 6103 layer->SetContentsOpaque(true);
6082 // Avoid LCD text on the layer so we don't cause extra commits when we 6104 // Avoid LCD text on the layer so we don't cause extra commits when we
6083 // pinch. 6105 // pinch.
6084 layer->disable_lcd_text(); 6106 layer->disable_lcd_text();
6085 pinch->AddChild(layer); 6107 pinch->AddChild(layer);
6086 6108
6087 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch); 6109 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch);
6088 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); 6110 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f);
6089 layer_tree_host()->SetRootLayer(root); 6111 layer_tree_host()->SetRootLayer(root);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
6228 6250
6229 class LayerTreeHostTestOneActivatePerPrepareTiles : public LayerTreeHostTest { 6251 class LayerTreeHostTestOneActivatePerPrepareTiles : public LayerTreeHostTest {
6230 public: 6252 public:
6231 LayerTreeHostTestOneActivatePerPrepareTiles() 6253 LayerTreeHostTestOneActivatePerPrepareTiles()
6232 : notify_ready_to_activate_count_(0u), 6254 : notify_ready_to_activate_count_(0u),
6233 scheduled_prepare_tiles_count_(0) {} 6255 scheduled_prepare_tiles_count_(0) {}
6234 6256
6235 void SetupTree() override { 6257 void SetupTree() override {
6236 client_.set_fill_with_nonsolid_color(true); 6258 client_.set_fill_with_nonsolid_color(true);
6237 scoped_refptr<FakePictureLayer> root_layer = 6259 scoped_refptr<FakePictureLayer> root_layer =
6238 FakePictureLayer::Create(&client_); 6260 FakePictureLayer::Create(layer_settings(), &client_);
6239 root_layer->SetBounds(gfx::Size(1500, 1500)); 6261 root_layer->SetBounds(gfx::Size(1500, 1500));
6240 root_layer->SetIsDrawable(true); 6262 root_layer->SetIsDrawable(true);
6241 6263
6242 layer_tree_host()->SetRootLayer(root_layer); 6264 layer_tree_host()->SetRootLayer(root_layer);
6243 LayerTreeHostTest::SetupTree(); 6265 LayerTreeHostTest::SetupTree();
6244 } 6266 }
6245 6267
6246 void BeginTest() override { 6268 void BeginTest() override {
6247 layer_tree_host()->SetViewportSize(gfx::Size(16, 16)); 6269 layer_tree_host()->SetViewportSize(gfx::Size(16, 16));
6248 PostSetNeedsCommitToMainThread(); 6270 PostSetNeedsCommitToMainThread();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
6283 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestOneActivatePerPrepareTiles); 6305 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestOneActivatePerPrepareTiles);
6284 6306
6285 class LayerTreeHostTestFrameTimingRequestsSaveTimestamps 6307 class LayerTreeHostTestFrameTimingRequestsSaveTimestamps
6286 : public LayerTreeHostTest { 6308 : public LayerTreeHostTest {
6287 public: 6309 public:
6288 LayerTreeHostTestFrameTimingRequestsSaveTimestamps() 6310 LayerTreeHostTestFrameTimingRequestsSaveTimestamps()
6289 : check_results_on_commit_(false) {} 6311 : check_results_on_commit_(false) {}
6290 6312
6291 void SetupTree() override { 6313 void SetupTree() override {
6292 scoped_refptr<FakePictureLayer> root_layer = 6314 scoped_refptr<FakePictureLayer> root_layer =
6293 FakePictureLayer::Create(&client_); 6315 FakePictureLayer::Create(layer_settings(), &client_);
6294 root_layer->SetBounds(gfx::Size(200, 200)); 6316 root_layer->SetBounds(gfx::Size(200, 200));
6295 root_layer->SetIsDrawable(true); 6317 root_layer->SetIsDrawable(true);
6296 6318
6297 scoped_refptr<FakePictureLayer> child_layer = 6319 scoped_refptr<FakePictureLayer> child_layer =
6298 FakePictureLayer::Create(&client_); 6320 FakePictureLayer::Create(layer_settings(), &client_);
6299 child_layer->SetBounds(gfx::Size(1500, 1500)); 6321 child_layer->SetBounds(gfx::Size(1500, 1500));
6300 child_layer->SetIsDrawable(true); 6322 child_layer->SetIsDrawable(true);
6301 6323
6302 std::vector<FrameTimingRequest> requests; 6324 std::vector<FrameTimingRequest> requests;
6303 requests.push_back(FrameTimingRequest(1, gfx::Rect(0, 0, 100, 100))); 6325 requests.push_back(FrameTimingRequest(1, gfx::Rect(0, 0, 100, 100)));
6304 requests.push_back(FrameTimingRequest(2, gfx::Rect(300, 0, 100, 100))); 6326 requests.push_back(FrameTimingRequest(2, gfx::Rect(300, 0, 100, 100)));
6305 child_layer->SetFrameTimingRequests(requests); 6327 child_layer->SetFrameTimingRequests(requests);
6306 6328
6307 root_layer->AddChild(child_layer); 6329 root_layer->AddChild(child_layer);
6308 layer_tree_host()->SetRootLayer(root_layer); 6330 layer_tree_host()->SetRootLayer(root_layer);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
6369 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestFrameTimingRequestsSaveTimestamps); 6391 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestFrameTimingRequestsSaveTimestamps);
6370 6392
6371 class LayerTreeHostTestActivationCausesPrepareTiles : public LayerTreeHostTest { 6393 class LayerTreeHostTestActivationCausesPrepareTiles : public LayerTreeHostTest {
6372 public: 6394 public:
6373 LayerTreeHostTestActivationCausesPrepareTiles() 6395 LayerTreeHostTestActivationCausesPrepareTiles()
6374 : scheduled_prepare_tiles_count_(0) {} 6396 : scheduled_prepare_tiles_count_(0) {}
6375 6397
6376 void SetupTree() override { 6398 void SetupTree() override {
6377 client_.set_fill_with_nonsolid_color(true); 6399 client_.set_fill_with_nonsolid_color(true);
6378 scoped_refptr<FakePictureLayer> root_layer = 6400 scoped_refptr<FakePictureLayer> root_layer =
6379 FakePictureLayer::Create(&client_); 6401 FakePictureLayer::Create(layer_settings(), &client_);
6380 root_layer->SetBounds(gfx::Size(150, 150)); 6402 root_layer->SetBounds(gfx::Size(150, 150));
6381 root_layer->SetIsDrawable(true); 6403 root_layer->SetIsDrawable(true);
6382 6404
6383 layer_tree_host()->SetRootLayer(root_layer); 6405 layer_tree_host()->SetRootLayer(root_layer);
6384 LayerTreeHostTest::SetupTree(); 6406 LayerTreeHostTest::SetupTree();
6385 } 6407 }
6386 6408
6387 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6409 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6388 6410
6389 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { 6411 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6449 6471
6450 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); 6472 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit);
6451 6473
6452 // Verify that if a LayerImpl holds onto a copy request for multiple 6474 // Verify that if a LayerImpl holds onto a copy request for multiple
6453 // frames that it will continue to have a render surface through 6475 // frames that it will continue to have a render surface through
6454 // multiple commits, even though the Layer itself has no reason 6476 // multiple commits, even though the Layer itself has no reason
6455 // to have a render surface. 6477 // to have a render surface.
6456 class LayerPreserveRenderSurfaceFromOutputRequests : public LayerTreeHostTest { 6478 class LayerPreserveRenderSurfaceFromOutputRequests : public LayerTreeHostTest {
6457 protected: 6479 protected:
6458 void SetupTree() override { 6480 void SetupTree() override {
6459 scoped_refptr<Layer> root = Layer::Create(); 6481 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6460 root->CreateRenderSurface(); 6482 root->CreateRenderSurface();
6461 root->SetBounds(gfx::Size(10, 10)); 6483 root->SetBounds(gfx::Size(10, 10));
6462 child_ = Layer::Create(); 6484 child_ = Layer::Create(layer_settings());
6463 child_->SetBounds(gfx::Size(20, 20)); 6485 child_->SetBounds(gfx::Size(20, 20));
6464 root->AddChild(child_); 6486 root->AddChild(child_);
6465 6487
6466 layer_tree_host()->SetRootLayer(root); 6488 layer_tree_host()->SetRootLayer(root);
6467 LayerTreeHostTest::SetupTree(); 6489 LayerTreeHostTest::SetupTree();
6468 } 6490 }
6469 6491
6470 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} 6492 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {}
6471 6493
6472 void BeginTest() override { 6494 void BeginTest() override {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
6528 6550
6529 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests); 6551 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests);
6530 6552
6531 class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest { 6553 class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest {
6532 protected: 6554 protected:
6533 void SetupTree() override { 6555 void SetupTree() override {
6534 // The masked layer has bounds 50x50, but it has a child that causes 6556 // The masked layer has bounds 50x50, but it has a child that causes
6535 // the surface bounds to be larger. It also has a parent that clips the 6557 // the surface bounds to be larger. It also has a parent that clips the
6536 // masked layer and its surface. 6558 // masked layer and its surface.
6537 6559
6538 scoped_refptr<Layer> root = Layer::Create(); 6560 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6539 6561
6540 scoped_refptr<Layer> clipping_layer = Layer::Create(); 6562 scoped_refptr<Layer> clipping_layer = Layer::Create(layer_settings());
6541 root->AddChild(clipping_layer); 6563 root->AddChild(clipping_layer);
6542 6564
6543 scoped_refptr<FakePictureLayer> content_layer = 6565 scoped_refptr<FakePictureLayer> content_layer =
6544 FakePictureLayer::Create(&client_); 6566 FakePictureLayer::Create(layer_settings(), &client_);
6545 clipping_layer->AddChild(content_layer); 6567 clipping_layer->AddChild(content_layer);
6546 6568
6547 scoped_refptr<FakePictureLayer> content_child_layer = 6569 scoped_refptr<FakePictureLayer> content_child_layer =
6548 FakePictureLayer::Create(&client_); 6570 FakePictureLayer::Create(layer_settings(), &client_);
6549 content_layer->AddChild(content_child_layer); 6571 content_layer->AddChild(content_child_layer);
6550 6572
6551 scoped_refptr<FakePictureLayer> mask_layer = 6573 scoped_refptr<FakePictureLayer> mask_layer =
6552 FakePictureLayer::Create(&client_); 6574 FakePictureLayer::Create(layer_settings(), &client_);
6553 content_layer->SetMaskLayer(mask_layer.get()); 6575 content_layer->SetMaskLayer(mask_layer.get());
6554 6576
6555 gfx::Size root_size(100, 100); 6577 gfx::Size root_size(100, 100);
6556 root->SetBounds(root_size); 6578 root->SetBounds(root_size);
6557 6579
6558 gfx::Rect clipping_rect(20, 10, 10, 20); 6580 gfx::Rect clipping_rect(20, 10, 10, 20);
6559 clipping_layer->SetBounds(clipping_rect.size()); 6581 clipping_layer->SetBounds(clipping_rect.size());
6560 clipping_layer->SetPosition(clipping_rect.origin()); 6582 clipping_layer->SetPosition(clipping_rect.origin());
6561 clipping_layer->SetMasksToBounds(true); 6583 clipping_layer->SetMasksToBounds(true);
6562 6584
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6622 } 6644 }
6623 6645
6624 void SetupTree() override { 6646 void SetupTree() override {
6625 // Root 6647 // Root
6626 // | 6648 // |
6627 // +-- Scaling Layer (adds a 2x scale) 6649 // +-- Scaling Layer (adds a 2x scale)
6628 // | 6650 // |
6629 // +-- Content Layer 6651 // +-- Content Layer
6630 // +--Mask 6652 // +--Mask
6631 6653
6632 scoped_refptr<Layer> root = Layer::Create(); 6654 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6633 6655
6634 scoped_refptr<Layer> scaling_layer = Layer::Create(); 6656 scoped_refptr<Layer> scaling_layer = Layer::Create(layer_settings());
6635 root->AddChild(scaling_layer); 6657 root->AddChild(scaling_layer);
6636 6658
6637 scoped_refptr<FakePictureLayer> content_layer = 6659 scoped_refptr<FakePictureLayer> content_layer =
6638 FakePictureLayer::Create(&client_); 6660 FakePictureLayer::Create(layer_settings(), &client_);
6639 scaling_layer->AddChild(content_layer); 6661 scaling_layer->AddChild(content_layer);
6640 6662
6641 scoped_refptr<FakePictureLayer> mask_layer = 6663 scoped_refptr<FakePictureLayer> mask_layer =
6642 FakePictureLayer::Create(&client_); 6664 FakePictureLayer::Create(layer_settings(), &client_);
6643 content_layer->SetMaskLayer(mask_layer.get()); 6665 content_layer->SetMaskLayer(mask_layer.get());
6644 6666
6645 gfx::Size root_size(100, 100); 6667 gfx::Size root_size(100, 100);
6646 root->SetBounds(root_size); 6668 root->SetBounds(root_size);
6647 6669
6648 gfx::Size scaling_layer_size(50, 50); 6670 gfx::Size scaling_layer_size(50, 50);
6649 scaling_layer->SetBounds(scaling_layer_size); 6671 scaling_layer->SetBounds(scaling_layer_size);
6650 gfx::Transform scale; 6672 gfx::Transform scale;
6651 scale.Scale(2.f, 2.f); 6673 scale.Scale(2.f, 2.f);
6652 scaling_layer->SetTransform(scale); 6674 scaling_layer->SetTransform(scale);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
6717 }; 6739 };
6718 6740
6719 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling); 6741 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling);
6720 6742
6721 class LayerTreeTestMaskLayerWithDifferentBounds : public LayerTreeTest { 6743 class LayerTreeTestMaskLayerWithDifferentBounds : public LayerTreeTest {
6722 protected: 6744 protected:
6723 void SetupTree() override { 6745 void SetupTree() override {
6724 // The mask layer has bounds 100x100 but is attached to a layer with bounds 6746 // The mask layer has bounds 100x100 but is attached to a layer with bounds
6725 // 50x50. 6747 // 50x50.
6726 6748
6727 scoped_refptr<Layer> root = Layer::Create(); 6749 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6728 6750
6729 scoped_refptr<FakePictureLayer> content_layer = 6751 scoped_refptr<FakePictureLayer> content_layer =
6730 FakePictureLayer::Create(&client_); 6752 FakePictureLayer::Create(layer_settings(), &client_);
6731 root->AddChild(content_layer); 6753 root->AddChild(content_layer);
6732 6754
6733 scoped_refptr<FakePictureLayer> mask_layer = 6755 scoped_refptr<FakePictureLayer> mask_layer =
6734 FakePictureLayer::Create(&client_); 6756 FakePictureLayer::Create(layer_settings(), &client_);
6735 content_layer->SetMaskLayer(mask_layer.get()); 6757 content_layer->SetMaskLayer(mask_layer.get());
6736 6758
6737 gfx::Size root_size(100, 100); 6759 gfx::Size root_size(100, 100);
6738 root->SetBounds(root_size); 6760 root->SetBounds(root_size);
6739 6761
6740 gfx::Size layer_size(50, 50); 6762 gfx::Size layer_size(50, 50);
6741 content_layer->SetBounds(layer_size); 6763 content_layer->SetBounds(layer_size);
6742 6764
6743 gfx::Size mask_size(100, 100); 6765 gfx::Size mask_size(100, 100);
6744 mask_layer->SetBounds(mask_size); 6766 mask_layer->SetBounds(mask_size);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
6805 6827
6806 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds); 6828 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds);
6807 6829
6808 class LayerTreeTestReflectionMaskLayerWithDifferentBounds 6830 class LayerTreeTestReflectionMaskLayerWithDifferentBounds
6809 : public LayerTreeTest { 6831 : public LayerTreeTest {
6810 protected: 6832 protected:
6811 void SetupTree() override { 6833 void SetupTree() override {
6812 // The replica's mask layer has bounds 100x100 but the replica is of a 6834 // The replica's mask layer has bounds 100x100 but the replica is of a
6813 // layer with bounds 50x50. 6835 // layer with bounds 50x50.
6814 6836
6815 scoped_refptr<Layer> root = Layer::Create(); 6837 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6816 6838
6817 scoped_refptr<FakePictureLayer> content_layer = 6839 scoped_refptr<FakePictureLayer> content_layer =
6818 FakePictureLayer::Create(&client_); 6840 FakePictureLayer::Create(layer_settings(), &client_);
6819 root->AddChild(content_layer); 6841 root->AddChild(content_layer);
6820 6842
6821 scoped_refptr<Layer> replica_layer = Layer::Create(); 6843 scoped_refptr<Layer> replica_layer = Layer::Create(layer_settings());
6822 content_layer->SetReplicaLayer(replica_layer.get()); 6844 content_layer->SetReplicaLayer(replica_layer.get());
6823 6845
6824 scoped_refptr<FakePictureLayer> mask_layer = 6846 scoped_refptr<FakePictureLayer> mask_layer =
6825 FakePictureLayer::Create(&client_); 6847 FakePictureLayer::Create(layer_settings(), &client_);
6826 replica_layer->SetMaskLayer(mask_layer.get()); 6848 replica_layer->SetMaskLayer(mask_layer.get());
6827 6849
6828 gfx::Size root_size(100, 100); 6850 gfx::Size root_size(100, 100);
6829 root->SetBounds(root_size); 6851 root->SetBounds(root_size);
6830 6852
6831 gfx::Size layer_size(50, 50); 6853 gfx::Size layer_size(50, 50);
6832 content_layer->SetBounds(layer_size); 6854 content_layer->SetBounds(layer_size);
6833 6855
6834 gfx::Size mask_size(100, 100); 6856 gfx::Size mask_size(100, 100);
6835 mask_layer->SetBounds(mask_size); 6857 mask_layer->SetBounds(mask_size);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
6898 SINGLE_AND_MULTI_THREAD_TEST_F( 6920 SINGLE_AND_MULTI_THREAD_TEST_F(
6899 LayerTreeTestReflectionMaskLayerWithDifferentBounds); 6921 LayerTreeTestReflectionMaskLayerWithDifferentBounds);
6900 6922
6901 class LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild 6923 class LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild
6902 : public LayerTreeTest { 6924 : public LayerTreeTest {
6903 protected: 6925 protected:
6904 void SetupTree() override { 6926 void SetupTree() override {
6905 // The replica is of a layer with bounds 50x50, but it has a child that 6927 // The replica is of a layer with bounds 50x50, but it has a child that
6906 // causes the surface bounds to be larger. 6928 // causes the surface bounds to be larger.
6907 6929
6908 scoped_refptr<Layer> root = Layer::Create(); 6930 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6909 6931
6910 scoped_refptr<FakePictureLayer> content_layer = 6932 scoped_refptr<FakePictureLayer> content_layer =
6911 FakePictureLayer::Create(&client_); 6933 FakePictureLayer::Create(layer_settings(), &client_);
6912 root->AddChild(content_layer); 6934 root->AddChild(content_layer);
6913 6935
6914 content_child_layer_ = FakePictureLayer::Create(&client_); 6936 content_child_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
6915 content_layer->AddChild(content_child_layer_); 6937 content_layer->AddChild(content_child_layer_);
6916 6938
6917 scoped_refptr<Layer> replica_layer = Layer::Create(); 6939 scoped_refptr<Layer> replica_layer = Layer::Create(layer_settings());
6918 content_layer->SetReplicaLayer(replica_layer.get()); 6940 content_layer->SetReplicaLayer(replica_layer.get());
6919 6941
6920 scoped_refptr<FakePictureLayer> mask_layer = 6942 scoped_refptr<FakePictureLayer> mask_layer =
6921 FakePictureLayer::Create(&client_); 6943 FakePictureLayer::Create(layer_settings(), &client_);
6922 replica_layer->SetMaskLayer(mask_layer.get()); 6944 replica_layer->SetMaskLayer(mask_layer.get());
6923 6945
6924 gfx::Size root_size(100, 100); 6946 gfx::Size root_size(100, 100);
6925 root->SetBounds(root_size); 6947 root->SetBounds(root_size);
6926 6948
6927 gfx::Size layer_size(50, 50); 6949 gfx::Size layer_size(50, 50);
6928 content_layer->SetBounds(layer_size); 6950 content_layer->SetBounds(layer_size);
6929 content_child_layer_->SetBounds(layer_size); 6951 content_child_layer_->SetBounds(layer_size);
6930 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f)); 6952 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f));
6931 6953
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
6992 void AfterTest() override {} 7014 void AfterTest() override {}
6993 7015
6994 scoped_refptr<FakePictureLayer> content_child_layer_; 7016 scoped_refptr<FakePictureLayer> content_child_layer_;
6995 FakeContentLayerClient client_; 7017 FakeContentLayerClient client_;
6996 }; 7018 };
6997 7019
6998 SINGLE_AND_MULTI_THREAD_TEST_F( 7020 SINGLE_AND_MULTI_THREAD_TEST_F(
6999 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild); 7021 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild);
7000 7022
7001 } // namespace cc 7023 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698