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

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

Issue 1452353002: Turn off computation of the interest rect in cc in synchronized paint mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/layer_iterator.h" 5 #include "cc/layers/layer_iterator.h"
6 #include "cc/output/copy_output_request.h" 6 #include "cc/output/copy_output_request.h"
7 #include "cc/output/copy_output_result.h" 7 #include "cc/output/copy_output_result.h"
8 #include "cc/test/fake_content_layer_client.h" 8 #include "cc/test/fake_content_layer_client.h"
9 #include "cc/test/fake_output_surface.h" 9 #include "cc/test/fake_output_surface.h"
10 #include "cc/test/fake_picture_layer.h" 10 #include "cc/test/fake_picture_layer.h"
(...skipping 18 matching lines...) Expand all
29 child = FakePictureLayer::Create(layer_settings(), &client_); 29 child = FakePictureLayer::Create(layer_settings(), &client_);
30 child->SetBounds(gfx::Size(10, 10)); 30 child->SetBounds(gfx::Size(10, 10));
31 root->AddChild(child); 31 root->AddChild(child);
32 32
33 grand_child = FakePictureLayer::Create(layer_settings(), &client_); 33 grand_child = FakePictureLayer::Create(layer_settings(), &client_);
34 grand_child->SetBounds(gfx::Size(5, 5)); 34 grand_child->SetBounds(gfx::Size(5, 5));
35 child->AddChild(grand_child); 35 child->AddChild(grand_child);
36 36
37 layer_tree_host()->SetRootLayer(root); 37 layer_tree_host()->SetRootLayer(root);
38 LayerTreeHostCopyRequestTest::SetupTree(); 38 LayerTreeHostCopyRequestTest::SetupTree();
39 client_.set_bounds(root->bounds());
39 } 40 }
40 41
41 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 42 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
42 43
43 void DidCommitAndDrawFrame() override { WaitForCallback(); } 44 void DidCommitAndDrawFrame() override { WaitForCallback(); }
44 45
45 void WaitForCallback() { 46 void WaitForCallback() {
46 base::MessageLoop::current()->PostTask( 47 base::MessageLoop::current()->PostTask(
47 FROM_HERE, 48 FROM_HERE,
48 base::Bind(&LayerTreeHostCopyRequestTestMultipleRequests::NextStep, 49 base::Bind(&LayerTreeHostCopyRequestTestMultipleRequests::NextStep,
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 main_destroyed_ = FakePictureLayer::Create(layer_settings(), &client_); 185 main_destroyed_ = FakePictureLayer::Create(layer_settings(), &client_);
185 main_destroyed_->SetBounds(gfx::Size(15, 15)); 186 main_destroyed_->SetBounds(gfx::Size(15, 15));
186 root_->AddChild(main_destroyed_); 187 root_->AddChild(main_destroyed_);
187 188
188 impl_destroyed_ = FakePictureLayer::Create(layer_settings(), &client_); 189 impl_destroyed_ = FakePictureLayer::Create(layer_settings(), &client_);
189 impl_destroyed_->SetBounds(gfx::Size(10, 10)); 190 impl_destroyed_->SetBounds(gfx::Size(10, 10));
190 root_->AddChild(impl_destroyed_); 191 root_->AddChild(impl_destroyed_);
191 192
192 layer_tree_host()->SetRootLayer(root_); 193 layer_tree_host()->SetRootLayer(root_);
193 LayerTreeHostCopyRequestTest::SetupTree(); 194 LayerTreeHostCopyRequestTest::SetupTree();
195 client_.set_bounds(root_->bounds());
194 } 196 }
195 197
196 void BeginTest() override { 198 void BeginTest() override {
197 callback_count_ = 0; 199 callback_count_ = 0;
198 PostSetNeedsCommitToMainThread(); 200 PostSetNeedsCommitToMainThread();
199 } 201 }
200 202
201 void DidCommit() override { 203 void DidCommit() override {
202 int frame = layer_tree_host()->source_frame_number(); 204 int frame = layer_tree_host()->source_frame_number();
203 switch (frame) { 205 switch (frame) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 parent_layer_->SetBounds(gfx::Size(15, 15)); 284 parent_layer_->SetBounds(gfx::Size(15, 15));
283 parent_layer_->SetForceRenderSurface(true); 285 parent_layer_->SetForceRenderSurface(true);
284 grand_parent_layer_->AddChild(parent_layer_); 286 grand_parent_layer_->AddChild(parent_layer_);
285 287
286 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 288 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
287 copy_layer_->SetBounds(gfx::Size(10, 10)); 289 copy_layer_->SetBounds(gfx::Size(10, 10));
288 parent_layer_->AddChild(copy_layer_); 290 parent_layer_->AddChild(copy_layer_);
289 291
290 layer_tree_host()->SetRootLayer(root_); 292 layer_tree_host()->SetRootLayer(root_);
291 LayerTreeHostCopyRequestTest::SetupTree(); 293 LayerTreeHostCopyRequestTest::SetupTree();
294 client_.set_bounds(root_->bounds());
292 } 295 }
293 296
294 void AddCopyRequest(Layer* layer) { 297 void AddCopyRequest(Layer* layer) {
295 layer->RequestCopyOfOutput( 298 layer->RequestCopyOfOutput(
296 CopyOutputRequest::CreateBitmapRequest(base::Bind( 299 CopyOutputRequest::CreateBitmapRequest(base::Bind(
297 &LayerTreeHostCopyRequestTestInHiddenSubtree::CopyOutputCallback, 300 &LayerTreeHostCopyRequestTestInHiddenSubtree::CopyOutputCallback,
298 base::Unretained(this)))); 301 base::Unretained(this))));
299 } 302 }
300 303
301 void BeginTest() override { 304 void BeginTest() override {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 parent_layer_->SetBounds(gfx::Size(15, 15)); 385 parent_layer_->SetBounds(gfx::Size(15, 15));
383 parent_layer_->SetForceRenderSurface(true); 386 parent_layer_->SetForceRenderSurface(true);
384 grand_parent_layer_->AddChild(parent_layer_); 387 grand_parent_layer_->AddChild(parent_layer_);
385 388
386 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 389 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
387 copy_layer_->SetBounds(gfx::Size(10, 10)); 390 copy_layer_->SetBounds(gfx::Size(10, 10));
388 parent_layer_->AddChild(copy_layer_); 391 parent_layer_->AddChild(copy_layer_);
389 392
390 layer_tree_host()->SetRootLayer(root_); 393 layer_tree_host()->SetRootLayer(root_);
391 LayerTreeHostCopyRequestTest::SetupTree(); 394 LayerTreeHostCopyRequestTest::SetupTree();
395 client_.set_bounds(root_->bounds());
392 } 396 }
393 397
394 void BeginTest() override { 398 void BeginTest() override {
395 did_draw_ = false; 399 did_draw_ = false;
396 PostSetNeedsCommitToMainThread(); 400 PostSetNeedsCommitToMainThread();
397 401
398 copy_layer_->RequestCopyOfOutput( 402 copy_layer_->RequestCopyOfOutput(
399 CopyOutputRequest::CreateBitmapRequest(base::Bind( 403 CopyOutputRequest::CreateBitmapRequest(base::Bind(
400 &LayerTreeHostTestHiddenSurfaceNotAllocatedForSubtreeCopyRequest:: 404 &LayerTreeHostTestHiddenSurfaceNotAllocatedForSubtreeCopyRequest::
401 CopyOutputCallback, 405 CopyOutputCallback,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 parent_layer_->SetMasksToBounds(true); 459 parent_layer_->SetMasksToBounds(true);
456 root_->AddChild(parent_layer_); 460 root_->AddChild(parent_layer_);
457 461
458 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 462 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
459 copy_layer_->SetPosition(gfx::PointF(15.f, 15.f)); 463 copy_layer_->SetPosition(gfx::PointF(15.f, 15.f));
460 copy_layer_->SetBounds(gfx::Size(10, 10)); 464 copy_layer_->SetBounds(gfx::Size(10, 10));
461 parent_layer_->AddChild(copy_layer_); 465 parent_layer_->AddChild(copy_layer_);
462 466
463 layer_tree_host()->SetRootLayer(root_); 467 layer_tree_host()->SetRootLayer(root_);
464 LayerTreeHostCopyRequestTest::SetupTree(); 468 LayerTreeHostCopyRequestTest::SetupTree();
469 client_.set_bounds(root_->bounds());
465 } 470 }
466 471
467 void BeginTest() override { 472 void BeginTest() override {
468 PostSetNeedsCommitToMainThread(); 473 PostSetNeedsCommitToMainThread();
469 474
470 copy_layer_->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( 475 copy_layer_->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest(
471 base::Bind(&LayerTreeHostCopyRequestTestClippedOut::CopyOutputCallback, 476 base::Bind(&LayerTreeHostCopyRequestTestClippedOut::CopyOutputCallback,
472 base::Unretained(this)))); 477 base::Unretained(this))));
473 } 478 }
474 479
(...skipping 22 matching lines...) Expand all
497 void SetupTree() override { 502 void SetupTree() override {
498 root_ = FakePictureLayer::Create(layer_settings(), &client_); 503 root_ = FakePictureLayer::Create(layer_settings(), &client_);
499 root_->SetBounds(gfx::Size(20, 20)); 504 root_->SetBounds(gfx::Size(20, 20));
500 505
501 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 506 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
502 copy_layer_->SetBounds(gfx::Size(10, 10)); 507 copy_layer_->SetBounds(gfx::Size(10, 10));
503 root_->AddChild(copy_layer_); 508 root_->AddChild(copy_layer_);
504 509
505 layer_tree_host()->SetRootLayer(root_); 510 layer_tree_host()->SetRootLayer(root_);
506 LayerTreeHostCopyRequestTest::SetupTree(); 511 LayerTreeHostCopyRequestTest::SetupTree();
512 client_.set_bounds(root_->bounds());
507 } 513 }
508 514
509 void AddCopyRequest(Layer* layer) { 515 void AddCopyRequest(Layer* layer) {
510 layer->RequestCopyOfOutput( 516 layer->RequestCopyOfOutput(
511 CopyOutputRequest::CreateBitmapRequest(base::Bind( 517 CopyOutputRequest::CreateBitmapRequest(base::Bind(
512 &LayerTreeHostTestAsyncTwoReadbacksWithoutDraw::CopyOutputCallback, 518 &LayerTreeHostTestAsyncTwoReadbacksWithoutDraw::CopyOutputCallback,
513 base::Unretained(this)))); 519 base::Unretained(this))));
514 } 520 }
515 521
516 void BeginTest() override { 522 void BeginTest() override {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 void SetupTree() override { 598 void SetupTree() override {
593 root_ = FakePictureLayer::Create(layer_settings(), &client_); 599 root_ = FakePictureLayer::Create(layer_settings(), &client_);
594 root_->SetBounds(gfx::Size(20, 20)); 600 root_->SetBounds(gfx::Size(20, 20));
595 601
596 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 602 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
597 copy_layer_->SetBounds(gfx::Size(10, 10)); 603 copy_layer_->SetBounds(gfx::Size(10, 10));
598 root_->AddChild(copy_layer_); 604 root_->AddChild(copy_layer_);
599 605
600 layer_tree_host()->SetRootLayer(root_); 606 layer_tree_host()->SetRootLayer(root_);
601 LayerTreeHostCopyRequestTest::SetupTree(); 607 LayerTreeHostCopyRequestTest::SetupTree();
608 client_.set_bounds(root_->bounds());
602 } 609 }
603 610
604 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 611 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
605 612
606 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) { 613 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {
607 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); 614 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
608 EXPECT_EQ(gfx::Size(10, 10).ToString(), result->size().ToString()); 615 EXPECT_EQ(gfx::Size(10, 10).ToString(), result->size().ToString());
609 EXPECT_TRUE(result->HasTexture()); 616 EXPECT_TRUE(result->HasTexture());
610 617
611 // Save the result for later. 618 // Save the result for later.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 723
717 root_ = FakePictureLayer::Create(layer_settings(), &client_); 724 root_ = FakePictureLayer::Create(layer_settings(), &client_);
718 root_->SetBounds(gfx::Size(20, 20)); 725 root_->SetBounds(gfx::Size(20, 20));
719 726
720 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 727 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
721 copy_layer_->SetBounds(gfx::Size(10, 10)); 728 copy_layer_->SetBounds(gfx::Size(10, 10));
722 root_->AddChild(copy_layer_); 729 root_->AddChild(copy_layer_);
723 730
724 layer_tree_host()->SetRootLayer(root_); 731 layer_tree_host()->SetRootLayer(root_);
725 LayerTreeHostCopyRequestTest::SetupTree(); 732 LayerTreeHostCopyRequestTest::SetupTree();
733 client_.set_bounds(root_->bounds());
726 } 734 }
727 735
728 void BeginTest() override { 736 void BeginTest() override {
729 num_textures_without_readback_ = 0; 737 num_textures_without_readback_ = 0;
730 num_textures_with_readback_ = 0; 738 num_textures_with_readback_ = 0;
731 waited_sync_token_after_readback_.Clear(); 739 waited_sync_token_after_readback_.Clear();
732 PostSetNeedsCommitToMainThread(); 740 PostSetNeedsCommitToMainThread();
733 } 741 }
734 742
735 virtual void RequestCopy(Layer* layer) = 0; 743 virtual void RequestCopy(Layer* layer) = 0;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 void SetupTree() override { 878 void SetupTree() override {
871 root_ = FakePictureLayer::Create(layer_settings(), &client_); 879 root_ = FakePictureLayer::Create(layer_settings(), &client_);
872 root_->SetBounds(gfx::Size(20, 20)); 880 root_->SetBounds(gfx::Size(20, 20));
873 881
874 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 882 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
875 copy_layer_->SetBounds(gfx::Size(10, 10)); 883 copy_layer_->SetBounds(gfx::Size(10, 10));
876 root_->AddChild(copy_layer_); 884 root_->AddChild(copy_layer_);
877 885
878 layer_tree_host()->SetRootLayer(root_); 886 layer_tree_host()->SetRootLayer(root_);
879 LayerTreeHostCopyRequestTest::SetupTree(); 887 LayerTreeHostCopyRequestTest::SetupTree();
888 client_.set_bounds(root_->bounds());
880 } 889 }
881 890
882 void BeginTest() override { 891 void BeginTest() override {
883 callback_count_ = 0; 892 callback_count_ = 0;
884 PostSetNeedsCommitToMainThread(); 893 PostSetNeedsCommitToMainThread();
885 } 894 }
886 895
887 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) { 896 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {
888 EXPECT_TRUE(result->IsEmpty()); 897 EXPECT_TRUE(result->IsEmpty());
889 ++callback_count_; 898 ++callback_count_;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 void SetupTree() override { 956 void SetupTree() override {
948 root_ = FakePictureLayer::Create(layer_settings(), &client_); 957 root_ = FakePictureLayer::Create(layer_settings(), &client_);
949 root_->SetBounds(gfx::Size(20, 20)); 958 root_->SetBounds(gfx::Size(20, 20));
950 959
951 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 960 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
952 copy_layer_->SetBounds(gfx::Size(10, 10)); 961 copy_layer_->SetBounds(gfx::Size(10, 10));
953 root_->AddChild(copy_layer_); 962 root_->AddChild(copy_layer_);
954 963
955 layer_tree_host()->SetRootLayer(root_); 964 layer_tree_host()->SetRootLayer(root_);
956 LayerTreeHostCopyRequestTest::SetupTree(); 965 LayerTreeHostCopyRequestTest::SetupTree();
966 client_.set_bounds(root_->bounds());
957 } 967 }
958 968
959 void BeginTest() override { 969 void BeginTest() override {
960 callback_count_ = 0; 970 callback_count_ = 0;
961 PostSetNeedsCommitToMainThread(); 971 PostSetNeedsCommitToMainThread();
962 } 972 }
963 973
964 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) { 974 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {
965 EXPECT_TRUE(result->IsEmpty()); 975 EXPECT_TRUE(result->IsEmpty());
966 ++callback_count_; 976 ++callback_count_;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 FakePictureLayer::Create(layer_settings(), &client_); 1030 FakePictureLayer::Create(layer_settings(), &client_);
1021 root->SetBounds(gfx::Size(20, 20)); 1031 root->SetBounds(gfx::Size(20, 20));
1022 1032
1023 child_ = FakePictureLayer::Create(layer_settings(), &client_); 1033 child_ = FakePictureLayer::Create(layer_settings(), &client_);
1024 child_->SetBounds(gfx::Size(10, 10)); 1034 child_->SetBounds(gfx::Size(10, 10));
1025 root->AddChild(child_); 1035 root->AddChild(child_);
1026 child_->SetHideLayerAndSubtree(true); 1036 child_->SetHideLayerAndSubtree(true);
1027 1037
1028 layer_tree_host()->SetRootLayer(root); 1038 layer_tree_host()->SetRootLayer(root);
1029 LayerTreeHostCopyRequestTest::SetupTree(); 1039 LayerTreeHostCopyRequestTest::SetupTree();
1040 client_.set_bounds(root->bounds());
1030 } 1041 }
1031 1042
1032 void BeginTest() override { 1043 void BeginTest() override {
1033 num_draws_ = 0; 1044 num_draws_ = 0;
1034 copy_happened_ = false; 1045 copy_happened_ = false;
1035 draw_happened_ = false; 1046 draw_happened_ = false;
1036 PostSetNeedsCommitToMainThread(); 1047 PostSetNeedsCommitToMainThread();
1037 } 1048 }
1038 1049
1039 void DidCommitAndDrawFrame() override { 1050 void DidCommitAndDrawFrame() override {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 int num_draws_; 1134 int num_draws_;
1124 bool copy_happened_; 1135 bool copy_happened_;
1125 bool draw_happened_; 1136 bool draw_happened_;
1126 }; 1137 };
1127 1138
1128 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 1139 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
1129 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest); 1140 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest);
1130 1141
1131 } // namespace 1142 } // namespace
1132 } // namespace cc 1143 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_context.cc ('k') | cc/trees/layer_tree_host_unittest_damage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698