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

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

Issue 563523002: cc: Change LayerTreeHost unit tests to use impl painting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unnecessary comment. Created 6 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 int num_draws_; 410 int num_draws_;
411 }; 411 };
412 412
413 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedraw); 413 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedraw);
414 414
415 // After setNeedsRedrawRect(invalid_rect) the final damage_rect 415 // After setNeedsRedrawRect(invalid_rect) the final damage_rect
416 // must contain invalid_rect. 416 // must contain invalid_rect.
417 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { 417 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest {
418 public: 418 public:
419 LayerTreeHostTestSetNeedsRedrawRect() 419 LayerTreeHostTestSetNeedsRedrawRect()
420 : num_draws_(0), 420 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {}
421 bounds_(50, 50),
422 invalid_rect_(10, 10, 20, 20),
423 root_layer_(ContentLayer::Create(&client_)) {}
424 421
425 void BeginTest() override { 422 void BeginTest() override {
423 if (layer_tree_host()->settings().impl_side_painting)
424 root_layer_ = FakePictureLayer::Create(&client_);
425 else
426 root_layer_ = ContentLayer::Create(&client_);
426 root_layer_->SetIsDrawable(true); 427 root_layer_->SetIsDrawable(true);
427 root_layer_->SetBounds(bounds_); 428 root_layer_->SetBounds(bounds_);
428 layer_tree_host()->SetRootLayer(root_layer_); 429 layer_tree_host()->SetRootLayer(root_layer_);
429 layer_tree_host()->SetViewportSize(bounds_); 430 layer_tree_host()->SetViewportSize(bounds_);
430 PostSetNeedsCommitToMainThread(); 431 PostSetNeedsCommitToMainThread();
431 } 432 }
432 433
433 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 434 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
434 LayerTreeHostImpl::FrameData* frame_data, 435 LayerTreeHostImpl::FrameData* frame_data,
435 DrawResult draw_result) override { 436 DrawResult draw_result) override {
(...skipping 23 matching lines...) Expand all
459 num_draws_++; 460 num_draws_++;
460 } 461 }
461 462
462 void AfterTest() override { EXPECT_EQ(2, num_draws_); } 463 void AfterTest() override { EXPECT_EQ(2, num_draws_); }
463 464
464 private: 465 private:
465 int num_draws_; 466 int num_draws_;
466 const gfx::Size bounds_; 467 const gfx::Size bounds_;
467 const gfx::Rect invalid_rect_; 468 const gfx::Rect invalid_rect_;
468 FakeContentLayerClient client_; 469 FakeContentLayerClient client_;
469 scoped_refptr<ContentLayer> root_layer_; 470 scoped_refptr<Layer> root_layer_;
470 }; 471 };
471 472
472 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedrawRect); 473 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedrawRect);
473 474
474 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest { 475 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest {
475 public: 476 public:
476 void InitializeSettings(LayerTreeSettings* settings) override { 477 void InitializeSettings(LayerTreeSettings* settings) override {
477 settings->layer_transforms_should_scale_layer_contents = true; 478 settings->layer_transforms_should_scale_layer_contents = true;
478 } 479 }
479 480
480 void SetupTree() override { 481 void SetupTree() override {
481 root_layer_ = Layer::Create(); 482 root_layer_ = Layer::Create();
482 root_layer_->SetBounds(gfx::Size(10, 20)); 483 root_layer_->SetBounds(gfx::Size(10, 20));
483 484
484 scaled_layer_ = FakeContentLayer::Create(&client_); 485 if (layer_tree_host()->settings().impl_side_painting)
486 scaled_layer_ = FakePictureLayer::Create(&client_);
487 else
488 scaled_layer_ = FakeContentLayer::Create(&client_);
485 scaled_layer_->SetBounds(gfx::Size(1, 1)); 489 scaled_layer_->SetBounds(gfx::Size(1, 1));
486 root_layer_->AddChild(scaled_layer_); 490 root_layer_->AddChild(scaled_layer_);
487 491
488 layer_tree_host()->SetRootLayer(root_layer_); 492 layer_tree_host()->SetRootLayer(root_layer_);
489 LayerTreeHostTest::SetupTree(); 493 LayerTreeHostTest::SetupTree();
490 } 494 }
491 495
492 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 496 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
493 497
494 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 498 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
495 if (host_impl->active_tree()->source_frame_number() == 1) 499 if (host_impl->active_tree()->source_frame_number() == 1)
496 EndTest(); 500 EndTest();
497 } 501 }
498 502
499 void DidCommit() override { 503 void DidCommit() override {
500 switch (layer_tree_host()->source_frame_number()) { 504 switch (layer_tree_host()->source_frame_number()) {
501 case 1: 505 case 1:
502 // Changing the device scale factor causes a commit. It also changes 506 // SetBounds grows the layer and exposes new content.
503 // the content bounds of |scaled_layer_|, which should not generate 507 if (layer_tree_host()->settings().impl_side_painting) {
504 // a second commit as a result. 508 scaled_layer_->SetBounds(gfx::Size(4, 4));
505 layer_tree_host()->SetDeviceScaleFactor(4.f); 509 } else {
510 // Changing the device scale factor causes a commit. It also changes
511 // the content bounds of |scaled_layer_|, which should not generate
512 // a second commit as a result.
513 layer_tree_host()->SetDeviceScaleFactor(4.f);
514 }
506 break; 515 break;
507 default: 516 default:
508 // No extra commits. 517 // No extra commits.
509 EXPECT_EQ(2, layer_tree_host()->source_frame_number()); 518 EXPECT_EQ(2, layer_tree_host()->source_frame_number());
510 } 519 }
511 } 520 }
512 521
513 void AfterTest() override { 522 void AfterTest() override {
514 EXPECT_EQ(gfx::Size(4, 4).ToString(), 523 EXPECT_EQ(gfx::Size(4, 4).ToString(),
515 scaled_layer_->content_bounds().ToString()); 524 scaled_layer_->content_bounds().ToString());
516 } 525 }
517 526
518 private: 527 private:
519 FakeContentLayerClient client_; 528 FakeContentLayerClient client_;
520 scoped_refptr<Layer> root_layer_; 529 scoped_refptr<Layer> root_layer_;
521 scoped_refptr<FakeContentLayer> scaled_layer_; 530 scoped_refptr<Layer> scaled_layer_;
522 }; 531 };
523 532
524 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate); 533 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate);
525 534
526 class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate 535 class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate
527 : public LayerTreeHostTest { 536 : public LayerTreeHostTest {
528 public: 537 public:
529 void InitializeSettings(LayerTreeSettings* settings) override { 538 void InitializeSettings(LayerTreeSettings* settings) override {
530 settings->layer_transforms_should_scale_layer_contents = true; 539 settings->layer_transforms_should_scale_layer_contents = true;
531 } 540 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 scoped_refptr<Layer> root_layer_; 587 scoped_refptr<Layer> root_layer_;
579 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_; 588 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_;
580 }; 589 };
581 590
582 SINGLE_AND_MULTI_THREAD_TEST_F( 591 SINGLE_AND_MULTI_THREAD_TEST_F(
583 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate); 592 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate);
584 593
585 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { 594 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest {
586 public: 595 public:
587 LayerTreeHostTestSetNextCommitForcesRedraw() 596 LayerTreeHostTestSetNextCommitForcesRedraw()
588 : num_draws_(0), 597 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {}
589 bounds_(50, 50),
590 invalid_rect_(10, 10, 20, 20),
591 root_layer_(ContentLayer::Create(&client_)) {}
592 598
593 void BeginTest() override { 599 void BeginTest() override {
600 if (layer_tree_host()->settings().impl_side_painting)
601 root_layer_ = FakePictureLayer::Create(&client_);
602 else
603 root_layer_ = ContentLayer::Create(&client_);
594 root_layer_->SetIsDrawable(true); 604 root_layer_->SetIsDrawable(true);
595 root_layer_->SetBounds(bounds_); 605 root_layer_->SetBounds(bounds_);
596 layer_tree_host()->SetRootLayer(root_layer_); 606 layer_tree_host()->SetRootLayer(root_layer_);
597 layer_tree_host()->SetViewportSize(bounds_); 607 layer_tree_host()->SetViewportSize(bounds_);
598 PostSetNeedsCommitToMainThread(); 608 PostSetNeedsCommitToMainThread();
599 } 609 }
600 610
601 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 611 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
602 if (num_draws_ == 3 && host_impl->settings().impl_side_painting) 612 if (num_draws_ == 3 && host_impl->settings().impl_side_painting)
603 host_impl->SetNeedsRedrawRect(invalid_rect_); 613 host_impl->SetNeedsRedrawRect(invalid_rect_);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 num_draws_++; 670 num_draws_++;
661 } 671 }
662 672
663 void AfterTest() override { EXPECT_EQ(5, num_draws_); } 673 void AfterTest() override { EXPECT_EQ(5, num_draws_); }
664 674
665 private: 675 private:
666 int num_draws_; 676 int num_draws_;
667 const gfx::Size bounds_; 677 const gfx::Size bounds_;
668 const gfx::Rect invalid_rect_; 678 const gfx::Rect invalid_rect_;
669 FakeContentLayerClient client_; 679 FakeContentLayerClient client_;
670 scoped_refptr<ContentLayer> root_layer_; 680 scoped_refptr<Layer> root_layer_;
671 }; 681 };
672 682
673 SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F( 683 SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F(
674 LayerTreeHostTestSetNextCommitForcesRedraw); 684 LayerTreeHostTestSetNextCommitForcesRedraw);
675 685
676 // Tests that if a layer is not drawn because of some reason in the parent then 686 // Tests that if a layer is not drawn because of some reason in the parent then
677 // its damage is preserved until the next time it is drawn. 687 // its damage is preserved until the next time it is drawn.
678 class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest { 688 class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest {
679 public: 689 public:
680 LayerTreeHostTestUndrawnLayersDamageLater() 690 LayerTreeHostTestUndrawnLayersDamageLater() {}
681 : root_layer_(ContentLayer::Create(&client_)) {}
682 691
683 void SetupTree() override { 692 void SetupTree() override {
693 if (layer_tree_host()->settings().impl_side_painting)
694 root_layer_ = FakePictureLayer::Create(&client_);
695 else
696 root_layer_ = ContentLayer::Create(&client_);
684 root_layer_->SetIsDrawable(true); 697 root_layer_->SetIsDrawable(true);
685 root_layer_->SetBounds(gfx::Size(50, 50)); 698 root_layer_->SetBounds(gfx::Size(50, 50));
686 layer_tree_host()->SetRootLayer(root_layer_); 699 layer_tree_host()->SetRootLayer(root_layer_);
687 700
688 // The initially transparent layer has a larger child layer, which is 701 // The initially transparent layer has a larger child layer, which is
689 // not initially drawn because of the this (parent) layer. 702 // not initially drawn because of the this (parent) layer.
690 parent_layer_ = FakeContentLayer::Create(&client_); 703 if (layer_tree_host()->settings().impl_side_painting)
704 parent_layer_ = FakePictureLayer::Create(&client_);
705 else
706 parent_layer_ = FakeContentLayer::Create(&client_);
691 parent_layer_->SetBounds(gfx::Size(15, 15)); 707 parent_layer_->SetBounds(gfx::Size(15, 15));
692 parent_layer_->SetOpacity(0.0f); 708 parent_layer_->SetOpacity(0.0f);
693 root_layer_->AddChild(parent_layer_); 709 root_layer_->AddChild(parent_layer_);
694 710
695 child_layer_ = FakeContentLayer::Create(&client_); 711 if (layer_tree_host()->settings().impl_side_painting)
712 child_layer_ = FakePictureLayer::Create(&client_);
713 else
714 child_layer_ = FakeContentLayer::Create(&client_);
696 child_layer_->SetBounds(gfx::Size(25, 25)); 715 child_layer_->SetBounds(gfx::Size(25, 25));
697 parent_layer_->AddChild(child_layer_); 716 parent_layer_->AddChild(child_layer_);
698 717
699 LayerTreeHostTest::SetupTree(); 718 LayerTreeHostTest::SetupTree();
700 } 719 }
701 720
702 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 721 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
703 722
704 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 723 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
705 LayerTreeHostImpl::FrameData* frame_data, 724 LayerTreeHostImpl::FrameData* frame_data,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 break; 769 break;
751 default: 770 default:
752 NOTREACHED(); 771 NOTREACHED();
753 } 772 }
754 } 773 }
755 774
756 void AfterTest() override {} 775 void AfterTest() override {}
757 776
758 private: 777 private:
759 FakeContentLayerClient client_; 778 FakeContentLayerClient client_;
760 scoped_refptr<ContentLayer> root_layer_; 779 scoped_refptr<Layer> root_layer_;
761 scoped_refptr<FakeContentLayer> parent_layer_; 780 scoped_refptr<Layer> parent_layer_;
762 scoped_refptr<FakeContentLayer> child_layer_; 781 scoped_refptr<Layer> child_layer_;
763 }; 782 };
764 783
765 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUndrawnLayersDamageLater); 784 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUndrawnLayersDamageLater);
766 785
767 // Tests that if a layer is not drawn because of some reason in the parent, 786 // Tests that if a layer is not drawn because of some reason in the parent,
768 // causing its content bounds to not be computed, then when it is later drawn, 787 // causing its content bounds to not be computed, then when it is later drawn,
769 // its content bounds get pushed. 788 // its content bounds get pushed.
770 class LayerTreeHostTestUndrawnLayersPushContentBoundsLater 789 class LayerTreeHostTestUndrawnLayersPushContentBoundsLater
771 : public LayerTreeHostTest { 790 : public LayerTreeHostTest {
772 public: 791 public:
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 } 1144 }
1126 ~ContentLayerWithUpdateTracking() override {} 1145 ~ContentLayerWithUpdateTracking() override {}
1127 1146
1128 int paint_contents_count_; 1147 int paint_contents_count_;
1129 }; 1148 };
1130 1149
1131 // Layer opacity change during paint should not prevent compositor resources 1150 // Layer opacity change during paint should not prevent compositor resources
1132 // from being updated during commit. 1151 // from being updated during commit.
1133 class LayerTreeHostTestOpacityChange : public LayerTreeHostTest { 1152 class LayerTreeHostTestOpacityChange : public LayerTreeHostTest {
1134 public: 1153 public:
1135 LayerTreeHostTestOpacityChange() 1154 LayerTreeHostTestOpacityChange() : test_opacity_change_delegate_() {}
1136 : test_opacity_change_delegate_(),
1137 update_check_layer_(ContentLayerWithUpdateTracking::Create(
1138 &test_opacity_change_delegate_)) {
1139 test_opacity_change_delegate_.SetTestLayer(update_check_layer_.get());
1140 }
1141 1155
1142 void BeginTest() override { 1156 void BeginTest() override {
1157 if (layer_tree_host()->settings().impl_side_painting) {
1158 update_check_picture_layer_ =
1159 FakePictureLayer::Create(&test_opacity_change_delegate_);
1160 test_opacity_change_delegate_.SetTestLayer(
1161 update_check_picture_layer_.get());
1162 is_impl_paint_ = true;
1163 } else {
1164 update_check_content_layer_ = ContentLayerWithUpdateTracking::Create(
1165 &test_opacity_change_delegate_);
1166 test_opacity_change_delegate_.SetTestLayer(
1167 update_check_content_layer_.get());
1168 is_impl_paint_ = false;
1169 }
1143 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); 1170 layer_tree_host()->SetViewportSize(gfx::Size(10, 10));
1144 layer_tree_host()->root_layer()->AddChild(update_check_layer_); 1171 if (layer_tree_host()->settings().impl_side_painting)
1172 layer_tree_host()->root_layer()->AddChild(update_check_picture_layer_);
1173 else
1174 layer_tree_host()->root_layer()->AddChild(update_check_content_layer_);
1145 1175
1146 PostSetNeedsCommitToMainThread(); 1176 PostSetNeedsCommitToMainThread();
1147 } 1177 }
1148 1178
1149 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { EndTest(); } 1179 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { EndTest(); }
1150 1180
1151 void AfterTest() override { 1181 void AfterTest() override {
1152 // Update() should have been called once. 1182 // Update() should have been called once.
1153 EXPECT_EQ(1, update_check_layer_->PaintContentsCount()); 1183 if (is_impl_paint_)
1184 EXPECT_EQ(1u, update_check_picture_layer_->update_count());
1185 else
1186 EXPECT_EQ(1, update_check_content_layer_->PaintContentsCount());
1154 } 1187 }
1155 1188
1156 private: 1189 private:
1157 TestOpacityChangeLayerDelegate test_opacity_change_delegate_; 1190 TestOpacityChangeLayerDelegate test_opacity_change_delegate_;
1158 scoped_refptr<ContentLayerWithUpdateTracking> update_check_layer_; 1191 scoped_refptr<ContentLayerWithUpdateTracking> update_check_content_layer_;
1192 scoped_refptr<FakePictureLayer> update_check_picture_layer_;
1193 bool is_impl_paint_;
1159 }; 1194 };
1160 1195
1161 MULTI_THREAD_TEST_F(LayerTreeHostTestOpacityChange); 1196 MULTI_THREAD_TEST_F(LayerTreeHostTestOpacityChange);
1162 1197
1163 class NoScaleContentLayer : public ContentLayer {
1164 public:
1165 static scoped_refptr<NoScaleContentLayer> Create(ContentLayerClient* client) {
1166 return make_scoped_refptr(new NoScaleContentLayer(client));
1167 }
1168
1169 void CalculateContentsScale(float ideal_contents_scale,
1170 float* contents_scale_x,
1171 float* contents_scale_y,
1172 gfx::Size* contentBounds) override {
1173 // Skip over the ContentLayer's method to the base Layer class.
1174 Layer::CalculateContentsScale(ideal_contents_scale,
1175 contents_scale_x,
1176 contents_scale_y,
1177 contentBounds);
1178 }
1179
1180 private:
1181 explicit NoScaleContentLayer(ContentLayerClient* client)
1182 : ContentLayer(client) {}
1183 ~NoScaleContentLayer() override {}
1184 };
1185
1186 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers 1198 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers
1187 : public LayerTreeHostTest { 1199 : public LayerTreeHostTest {
1188 public: 1200 public:
1189 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() 1201 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {}
1190 : root_layer_(NoScaleContentLayer::Create(&client_)), 1202
1191 child_layer_(ContentLayer::Create(&client_)) {} 1203 void InitializeSettings(LayerTreeSettings* settings) override {
1204 // PictureLayer can only be used with impl side painting enabled.
1205 settings->impl_side_painting = true;
1206 }
1192 1207
1193 void BeginTest() override { 1208 void BeginTest() override {
1209 client_.set_fill_with_nonsolid_color(true);
1210 root_layer_ = FakePictureLayer::Create(&client_);
1211 child_layer_ = FakePictureLayer::Create(&client_);
1212
1194 layer_tree_host()->SetViewportSize(gfx::Size(60, 60)); 1213 layer_tree_host()->SetViewportSize(gfx::Size(60, 60));
1195 layer_tree_host()->SetDeviceScaleFactor(1.5); 1214 layer_tree_host()->SetDeviceScaleFactor(1.5);
1196 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size()); 1215 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size());
1197 1216
1198 root_layer_->AddChild(child_layer_); 1217 root_layer_->AddChild(child_layer_);
1199 1218
1200 root_layer_->SetIsDrawable(true); 1219 root_layer_->SetIsDrawable(true);
1201 root_layer_->SetBounds(gfx::Size(30, 30)); 1220 root_layer_->SetBounds(gfx::Size(30, 30));
1202 1221
1203 child_layer_->SetIsDrawable(true); 1222 child_layer_->SetIsDrawable(true);
(...skipping 10 matching lines...) Expand all
1214 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); 1233 EXPECT_EQ(0, impl->active_tree()->source_frame_number());
1215 // Device scale factor should come over to impl. 1234 // Device scale factor should come over to impl.
1216 EXPECT_NEAR(impl->device_scale_factor(), 1.5f, 0.00001f); 1235 EXPECT_NEAR(impl->device_scale_factor(), 1.5f, 0.00001f);
1217 1236
1218 // Both layers are on impl. 1237 // Both layers are on impl.
1219 ASSERT_EQ(1u, impl->active_tree()->root_layer()->children().size()); 1238 ASSERT_EQ(1u, impl->active_tree()->root_layer()->children().size());
1220 1239
1221 // Device viewport is scaled. 1240 // Device viewport is scaled.
1222 EXPECT_EQ(gfx::Size(60, 60), impl->DrawViewportSize()); 1241 EXPECT_EQ(gfx::Size(60, 60), impl->DrawViewportSize());
1223 1242
1224 LayerImpl* root = impl->active_tree()->root_layer(); 1243 FakePictureLayerImpl* root =
1225 LayerImpl* child = impl->active_tree()->root_layer()->children()[0]; 1244 static_cast<FakePictureLayerImpl*>(impl->active_tree()->root_layer());
1245 FakePictureLayerImpl* child = static_cast<FakePictureLayerImpl*>(
1246 impl->active_tree()->root_layer()->children()[0]);
1226 1247
1227 // Positions remain in layout pixels. 1248 // Positions remain in layout pixels.
1228 EXPECT_EQ(gfx::Point(0, 0), root->position()); 1249 EXPECT_EQ(gfx::Point(0, 0), root->position());
1229 EXPECT_EQ(gfx::Point(2, 2), child->position()); 1250 EXPECT_EQ(gfx::Point(2, 2), child->position());
1230 1251
1231 // Compute all the layer transforms for the frame. 1252 // Compute all the layer transforms for the frame.
1232 LayerTreeHostImpl::FrameData frame_data; 1253 LayerTreeHostImpl::FrameData frame_data;
1233 impl->PrepareToDraw(&frame_data); 1254 impl->PrepareToDraw(&frame_data);
1234 impl->DidDrawAllLayers(frame_data); 1255 impl->DidDrawAllLayers(frame_data);
1235 1256
1236 const LayerImplList& render_surface_layer_list = 1257 const LayerImplList& render_surface_layer_list =
1237 *frame_data.render_surface_layer_list; 1258 *frame_data.render_surface_layer_list;
1238 1259
1239 // Both layers should be drawing into the root render surface. 1260 // Both layers should be drawing into the root render surface.
1240 ASSERT_EQ(1u, render_surface_layer_list.size()); 1261 ASSERT_EQ(1u, render_surface_layer_list.size());
1241 ASSERT_EQ(root->render_surface(), 1262 ASSERT_EQ(root->render_surface(),
1242 render_surface_layer_list[0]->render_surface()); 1263 render_surface_layer_list[0]->render_surface());
1243 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); 1264 ASSERT_EQ(2u, root->render_surface()->layer_list().size());
1244 1265
1245 // The root render surface is the size of the viewport. 1266 // The root render surface is the size of the viewport.
1246 EXPECT_RECT_EQ(gfx::Rect(0, 0, 60, 60), 1267 EXPECT_RECT_EQ(gfx::Rect(0, 0, 60, 60),
1247 root->render_surface()->content_rect()); 1268 root->render_surface()->content_rect());
1248 1269
1249 // The content bounds of the child should be scaled. 1270 // The max tiling scale of the child should be scaled.
1250 gfx::Size child_bounds_scaled = 1271 EXPECT_FLOAT_EQ(1.5f, child->MaximumTilingContentsScale());
1251 gfx::ToCeiledSize(gfx::ScaleSize(child->bounds(), 1.5));
1252 EXPECT_EQ(child_bounds_scaled, child->content_bounds());
1253 1272
1254 gfx::Transform scale_transform; 1273 gfx::Transform scale_transform;
1255 scale_transform.Scale(impl->device_scale_factor(), 1274 scale_transform.Scale(impl->device_scale_factor(),
1256 impl->device_scale_factor()); 1275 impl->device_scale_factor());
1257 1276
1258 // The root layer is scaled by 2x. 1277 // The root layer is scaled by 2x.
1259 gfx::Transform root_screen_space_transform = scale_transform; 1278 gfx::Transform root_screen_space_transform = scale_transform;
1260 gfx::Transform root_draw_transform = scale_transform; 1279 gfx::Transform root_draw_transform = scale_transform;
1261 1280
1262 EXPECT_EQ(root_draw_transform, root->draw_transform()); 1281 EXPECT_EQ(root_draw_transform, root->draw_transform());
1263 EXPECT_EQ(root_screen_space_transform, root->screen_space_transform()); 1282 EXPECT_EQ(root_screen_space_transform, root->screen_space_transform());
1264 1283
1265 // The child is at position 2,2, which is transformed to 3,3 after the scale 1284 // The child is at position 2,2, which is transformed to 3,3 after the scale
1266 gfx::Transform child_screen_space_transform; 1285 gfx::Transform child_transform;
1267 child_screen_space_transform.Translate(3.f, 3.f); 1286 child_transform.Translate(3.f, 3.f);
1268 gfx::Transform child_draw_transform = child_screen_space_transform; 1287 child_transform.Scale(child->MaximumTilingContentsScale(),
1288 child->MaximumTilingContentsScale());
1269 1289
1270 EXPECT_TRANSFORMATION_MATRIX_EQ(child_draw_transform, 1290 EXPECT_TRANSFORMATION_MATRIX_EQ(child_transform, child->draw_transform());
1271 child->draw_transform()); 1291 EXPECT_TRANSFORMATION_MATRIX_EQ(child_transform,
1272 EXPECT_TRANSFORMATION_MATRIX_EQ(child_screen_space_transform,
1273 child->screen_space_transform()); 1292 child->screen_space_transform());
1274 1293
1275 EndTest(); 1294 EndTest();
1276 } 1295 }
1277 1296
1278 void AfterTest() override {} 1297 void AfterTest() override {}
1279 1298
1280 private: 1299 private:
1281 FakeContentLayerClient client_; 1300 FakeContentLayerClient client_;
1282 scoped_refptr<NoScaleContentLayer> root_layer_; 1301 scoped_refptr<FakePictureLayer> root_layer_;
1283 scoped_refptr<ContentLayer> child_layer_; 1302 scoped_refptr<FakePictureLayer> child_layer_;
1284 }; 1303 };
1285 1304
1286 MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers); 1305 MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers);
1287 1306
1307 // TODO(sohanjg) : Remove it once impl-side painting ships everywhere.
1288 // Verify atomicity of commits and reuse of textures. 1308 // Verify atomicity of commits and reuse of textures.
1289 class LayerTreeHostTestDirectRendererAtomicCommit : public LayerTreeHostTest { 1309 class LayerTreeHostTestDirectRendererAtomicCommit : public LayerTreeHostTest {
1290 public: 1310 public:
1291 void InitializeSettings(LayerTreeSettings* settings) override { 1311 void InitializeSettings(LayerTreeSettings* settings) override {
1292 settings->texture_id_allocation_chunk_size = 1; 1312 settings->texture_id_allocation_chunk_size = 1;
1293 // Make sure partial texture updates are turned off. 1313 // Make sure partial texture updates are turned off.
1294 settings->max_partial_texture_updates = 0; 1314 settings->max_partial_texture_updates = 0;
1295 // Linear fade animator prevents scrollbars from drawing immediately. 1315 // Linear fade animator prevents scrollbars from drawing immediately.
1296 settings->scrollbar_animator = LayerTreeSettings::NoAnimator; 1316 settings->scrollbar_animator = LayerTreeSettings::NoAnimator;
1297 } 1317 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 protected: 1406 protected:
1387 FakeContentLayerClient client_; 1407 FakeContentLayerClient client_;
1388 scoped_refptr<FakeContentLayer> layer_; 1408 scoped_refptr<FakeContentLayer> layer_;
1389 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_; 1409 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_;
1390 int drew_frame_; 1410 int drew_frame_;
1391 }; 1411 };
1392 1412
1393 MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F( 1413 MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(
1394 LayerTreeHostTestDirectRendererAtomicCommit); 1414 LayerTreeHostTestDirectRendererAtomicCommit);
1395 1415
1416 // TODO(sohanjg) : Remove it once impl-side painting ships everywhere.
1396 class LayerTreeHostTestDelegatingRendererAtomicCommit 1417 class LayerTreeHostTestDelegatingRendererAtomicCommit
1397 : public LayerTreeHostTestDirectRendererAtomicCommit { 1418 : public LayerTreeHostTestDirectRendererAtomicCommit {
1398 public: 1419 public:
1399 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { 1420 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
1400 ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates); 1421 ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates);
1401 1422
1402 TestWebGraphicsContext3D* context = TestContext(); 1423 TestWebGraphicsContext3D* context = TestContext();
1403 1424
1404 switch (impl->active_tree()->source_frame_number()) { 1425 switch (impl->active_tree()->source_frame_number()) {
1405 case 0: 1426 case 0:
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 layer->RemoveAllChildren(); 1474 layer->RemoveAllChildren();
1454 if (parent) 1475 if (parent)
1455 parent->AddChild(layer); 1476 parent->AddChild(layer);
1456 layer->SetTransform(transform); 1477 layer->SetTransform(transform);
1457 layer->SetTransformOrigin(transform_origin); 1478 layer->SetTransformOrigin(transform_origin);
1458 layer->SetPosition(position); 1479 layer->SetPosition(position);
1459 layer->SetBounds(bounds); 1480 layer->SetBounds(bounds);
1460 layer->SetContentsOpaque(opaque); 1481 layer->SetContentsOpaque(opaque);
1461 } 1482 }
1462 1483
1484 // TODO(sohanjg) : Remove it once impl-side painting ships everywhere.
1463 class LayerTreeHostTestAtomicCommitWithPartialUpdate 1485 class LayerTreeHostTestAtomicCommitWithPartialUpdate
1464 : public LayerTreeHostTest { 1486 : public LayerTreeHostTest {
1465 public: 1487 public:
1466 void InitializeSettings(LayerTreeSettings* settings) override { 1488 void InitializeSettings(LayerTreeSettings* settings) override {
1467 settings->texture_id_allocation_chunk_size = 1; 1489 settings->texture_id_allocation_chunk_size = 1;
1468 // Allow one partial texture update. 1490 // Allow one partial texture update.
1469 settings->max_partial_texture_updates = 1; 1491 settings->max_partial_texture_updates = 1;
1470 // No partial updates when impl side painting is enabled. 1492 // No partial updates when impl side painting is enabled.
1471 settings->impl_side_painting = false; 1493 settings->impl_side_painting = false;
1472 } 1494 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 private: 1648 private:
1627 FakeContentLayerClient client_; 1649 FakeContentLayerClient client_;
1628 scoped_refptr<FakeContentLayer> parent_; 1650 scoped_refptr<FakeContentLayer> parent_;
1629 scoped_refptr<FakeContentLayer> child_; 1651 scoped_refptr<FakeContentLayer> child_;
1630 }; 1652 };
1631 1653
1632 // Partial updates are not possible with a delegating renderer. 1654 // Partial updates are not possible with a delegating renderer.
1633 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 1655 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
1634 LayerTreeHostTestAtomicCommitWithPartialUpdate); 1656 LayerTreeHostTestAtomicCommitWithPartialUpdate);
1635 1657
1658 // TODO(sohanjg) : Make it work with impl-side painting.
1636 class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit 1659 class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit
1637 : public LayerTreeHostTest { 1660 : public LayerTreeHostTest {
1638 protected: 1661 protected:
1639 void SetupTree() override { 1662 void SetupTree() override {
1640 root_layer_ = FakeContentLayer::Create(&client_); 1663 root_layer_ = FakeContentLayer::Create(&client_);
1641 root_layer_->SetBounds(gfx::Size(100, 100)); 1664 root_layer_->SetBounds(gfx::Size(100, 100));
1642 1665
1643 surface_layer1_ = FakeContentLayer::Create(&client_); 1666 surface_layer1_ = FakeContentLayer::Create(&client_);
1644 surface_layer1_->SetBounds(gfx::Size(100, 100)); 1667 surface_layer1_->SetBounds(gfx::Size(100, 100));
1645 surface_layer1_->SetForceRenderSurface(true); 1668 surface_layer1_->SetForceRenderSurface(true);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 1969
1947 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { 1970 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest {
1948 public: 1971 public:
1949 LayerTreeHostTestContinuousInvalidate() 1972 LayerTreeHostTestContinuousInvalidate()
1950 : num_commit_complete_(0), num_draw_layers_(0) {} 1973 : num_commit_complete_(0), num_draw_layers_(0) {}
1951 1974
1952 void BeginTest() override { 1975 void BeginTest() override {
1953 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); 1976 layer_tree_host()->SetViewportSize(gfx::Size(10, 10));
1954 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); 1977 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10));
1955 1978
1956 content_layer_ = ContentLayer::Create(&client_); 1979 if (layer_tree_host()->settings().impl_side_painting)
1957 content_layer_->SetBounds(gfx::Size(10, 10)); 1980 layer_ = FakePictureLayer::Create(&client_);
1958 content_layer_->SetPosition(gfx::PointF(0.f, 0.f)); 1981 else
1959 content_layer_->SetIsDrawable(true); 1982 layer_ = FakeContentLayer::Create(&client_);
1960 layer_tree_host()->root_layer()->AddChild(content_layer_); 1983
1984 layer_->SetBounds(gfx::Size(10, 10));
1985 layer_->SetPosition(gfx::PointF(0.f, 0.f));
1986 layer_->SetIsDrawable(true);
1987 layer_tree_host()->root_layer()->AddChild(layer_);
1961 1988
1962 PostSetNeedsCommitToMainThread(); 1989 PostSetNeedsCommitToMainThread();
1963 } 1990 }
1964 1991
1965 void DidCommitAndDrawFrame() override { 1992 void DidCommitAndDrawFrame() override {
1966 if (num_draw_layers_ == 2) 1993 if (num_draw_layers_ == 2)
1967 return; 1994 return;
1968 content_layer_->SetNeedsDisplay(); 1995 layer_->SetNeedsDisplay();
1969 } 1996 }
1970 1997
1971 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { 1998 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
1972 if (num_draw_layers_ == 1) 1999 if (num_draw_layers_ == 1)
1973 num_commit_complete_++; 2000 num_commit_complete_++;
1974 } 2001 }
1975 2002
1976 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 2003 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
1977 num_draw_layers_++; 2004 num_draw_layers_++;
1978 if (num_draw_layers_ == 2) 2005 if (num_draw_layers_ == 2)
1979 EndTest(); 2006 EndTest();
1980 } 2007 }
1981 2008
1982 void AfterTest() override { 2009 void AfterTest() override {
1983 // Check that we didn't commit twice between first and second draw. 2010 // Check that we didn't commit twice between first and second draw.
1984 EXPECT_EQ(1, num_commit_complete_); 2011 EXPECT_EQ(1, num_commit_complete_);
1985 } 2012 }
1986 2013
1987 private: 2014 private:
1988 FakeContentLayerClient client_; 2015 FakeContentLayerClient client_;
1989 scoped_refptr<Layer> content_layer_; 2016 scoped_refptr<Layer> layer_;
1990 int num_commit_complete_; 2017 int num_commit_complete_;
1991 int num_draw_layers_; 2018 int num_draw_layers_;
1992 }; 2019 };
1993 2020
1994 MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostTestContinuousInvalidate); 2021 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousInvalidate);
1995 2022
1996 class LayerTreeHostTestDeferCommits : public LayerTreeHostTest { 2023 class LayerTreeHostTestDeferCommits : public LayerTreeHostTest {
1997 public: 2024 public:
1998 LayerTreeHostTestDeferCommits() 2025 LayerTreeHostTestDeferCommits()
1999 : num_commits_deferred_(0), num_complete_commits_(0) {} 2026 : num_commits_deferred_(0), num_complete_commits_(0) {}
2000 2027
2001 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 2028 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
2002 2029
2003 void DidDeferCommit() override { 2030 void DidDeferCommit() override {
2004 num_commits_deferred_++; 2031 num_commits_deferred_++;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2187 NULL, 2214 NULL,
2188 settings, 2215 settings,
2189 base::MessageLoopProxy::current(), 2216 base::MessageLoopProxy::current(),
2190 nullptr); 2217 nullptr);
2191 client.SetLayerTreeHost(host.get()); 2218 client.SetLayerTreeHost(host.get());
2192 host->Composite(base::TimeTicks::Now()); 2219 host->Composite(base::TimeTicks::Now());
2193 2220
2194 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); 2221 EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
2195 } 2222 }
2196 2223
2224 // TODO(sohanjg) : Remove it once impl-side painting ships everywhere.
2197 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted 2225 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted
2198 : public LayerTreeHostTest { 2226 : public LayerTreeHostTest {
2199 public: 2227 public:
2200 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() 2228 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted()
2201 : root_layer_(FakeContentLayer::Create(&client_)), 2229 : root_layer_(FakeContentLayer::Create(&client_)),
2202 child_layer1_(FakeContentLayer::Create(&client_)), 2230 child_layer1_(FakeContentLayer::Create(&client_)),
2203 child_layer2_(FakeContentLayer::Create(&client_)), 2231 child_layer2_(FakeContentLayer::Create(&client_)),
2204 num_commits_(0) {} 2232 num_commits_(0) {}
2205 2233
2206 void BeginTest() override { 2234 void BeginTest() override {
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
2591 SINGLE_AND_MULTI_THREAD_TEST_F( 2619 SINGLE_AND_MULTI_THREAD_TEST_F(
2592 LayerTreeHostTestChangeLayerPropertiesInPaintContents); 2620 LayerTreeHostTestChangeLayerPropertiesInPaintContents);
2593 2621
2594 class MockIOSurfaceWebGraphicsContext3D : public TestWebGraphicsContext3D { 2622 class MockIOSurfaceWebGraphicsContext3D : public TestWebGraphicsContext3D {
2595 public: 2623 public:
2596 MockIOSurfaceWebGraphicsContext3D() { 2624 MockIOSurfaceWebGraphicsContext3D() {
2597 test_capabilities_.gpu.iosurface = true; 2625 test_capabilities_.gpu.iosurface = true;
2598 test_capabilities_.gpu.texture_rectangle = true; 2626 test_capabilities_.gpu.texture_rectangle = true;
2599 } 2627 }
2600 2628
2601 virtual GLuint createTexture() override { 2629 GLuint createTexture() override { return 1; }
2602 return 1;
2603 }
2604 MOCK_METHOD1(activeTexture, void(GLenum texture)); 2630 MOCK_METHOD1(activeTexture, void(GLenum texture));
2605 MOCK_METHOD2(bindTexture, void(GLenum target, 2631 MOCK_METHOD2(bindTexture, void(GLenum target,
2606 GLuint texture_id)); 2632 GLuint texture_id));
2607 MOCK_METHOD3(texParameteri, void(GLenum target, 2633 MOCK_METHOD3(texParameteri, void(GLenum target,
2608 GLenum pname, 2634 GLenum pname,
2609 GLint param)); 2635 GLint param));
2610 MOCK_METHOD5(texImageIOSurface2DCHROMIUM, void(GLenum target, 2636 MOCK_METHOD5(texImageIOSurface2DCHROMIUM, void(GLenum target,
2611 GLint width, 2637 GLint width,
2612 GLint height, 2638 GLint height,
2613 GLuint ioSurfaceId, 2639 GLuint ioSurfaceId,
(...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after
4499 output_surface->SetMemoryPolicyToSetAtBind( 4525 output_surface->SetMemoryPolicyToSetAtBind(
4500 make_scoped_ptr(new ManagedMemoryPolicy( 4526 make_scoped_ptr(new ManagedMemoryPolicy(
4501 second_context_provider_.get() ? second_output_surface_memory_limit_ 4527 second_context_provider_.get() ? second_output_surface_memory_limit_
4502 : first_output_surface_memory_limit_, 4528 : first_output_surface_memory_limit_,
4503 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, 4529 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
4504 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); 4530 ManagedMemoryPolicy::kDefaultNumResourcesLimit)));
4505 return output_surface.Pass(); 4531 return output_surface.Pass();
4506 } 4532 }
4507 4533
4508 void SetupTree() override { 4534 void SetupTree() override {
4509 root_ = FakeContentLayer::Create(&client_); 4535 if (layer_tree_host()->settings().impl_side_painting)
4536 root_ = FakePictureLayer::Create(&client_);
4537 else
4538 root_ = FakeContentLayer::Create(&client_);
4510 root_->SetBounds(gfx::Size(20, 20)); 4539 root_->SetBounds(gfx::Size(20, 20));
4511 layer_tree_host()->SetRootLayer(root_); 4540 layer_tree_host()->SetRootLayer(root_);
4512 LayerTreeHostTest::SetupTree(); 4541 LayerTreeHostTest::SetupTree();
4513 } 4542 }
4514 4543
4515 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4544 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
4516 4545
4517 void DidCommitAndDrawFrame() override { 4546 void DidCommitAndDrawFrame() override {
4518 // Lost context sometimes takes two frames to recreate. The third frame 4547 // Lost context sometimes takes two frames to recreate. The third frame
4519 // is sometimes aborted, so wait until the fourth frame to verify that 4548 // is sometimes aborted, so wait until the fourth frame to verify that
(...skipping 21 matching lines...) Expand all
4541 } 4570 }
4542 } 4571 }
4543 4572
4544 void AfterTest() override {} 4573 void AfterTest() override {}
4545 4574
4546 scoped_refptr<TestContextProvider> first_context_provider_; 4575 scoped_refptr<TestContextProvider> first_context_provider_;
4547 scoped_refptr<TestContextProvider> second_context_provider_; 4576 scoped_refptr<TestContextProvider> second_context_provider_;
4548 size_t first_output_surface_memory_limit_; 4577 size_t first_output_surface_memory_limit_;
4549 size_t second_output_surface_memory_limit_; 4578 size_t second_output_surface_memory_limit_;
4550 FakeContentLayerClient client_; 4579 FakeContentLayerClient client_;
4551 scoped_refptr<FakeContentLayer> root_; 4580 scoped_refptr<Layer> root_;
4552 }; 4581 };
4553 4582
4554 // No output to copy for delegated renderers.
4555 SINGLE_AND_MULTI_THREAD_TEST_F( 4583 SINGLE_AND_MULTI_THREAD_TEST_F(
4556 LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface); 4584 LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface);
4557 4585
4558 struct TestSwapPromiseResult { 4586 struct TestSwapPromiseResult {
4559 TestSwapPromiseResult() 4587 TestSwapPromiseResult()
4560 : did_swap_called(false), 4588 : did_swap_called(false),
4561 did_not_swap_called(false), 4589 did_not_swap_called(false),
4562 dtor_called(false), 4590 dtor_called(false),
4563 reason(SwapPromise::DID_NOT_SWAP_UNKNOWN) {} 4591 reason(SwapPromise::DID_NOT_SWAP_UNKNOWN) {}
4564 4592
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
5348 void AfterTest() override { 5376 void AfterTest() override {
5349 EXPECT_TRUE(deltas_sent_to_client_); 5377 EXPECT_TRUE(deltas_sent_to_client_);
5350 } 5378 }
5351 5379
5352 ScrollAndScaleSet info_; 5380 ScrollAndScaleSet info_;
5353 bool deltas_sent_to_client_; 5381 bool deltas_sent_to_client_;
5354 }; 5382 };
5355 5383
5356 MULTI_THREAD_TEST_F(LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer); 5384 MULTI_THREAD_TEST_F(LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer);
5357 } // namespace cc 5385 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698