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

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

Issue 2317753002: cc: Abstract the LayerTreeHost. (Closed)
Patch Set: Rebase Created 4 years, 3 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 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 void DidCommit() override { WaitForCallback(); } 53 void DidCommit() override { WaitForCallback(); }
54 54
55 void WaitForCallback() { 55 void WaitForCallback() {
56 base::ThreadTaskRunnerHandle::Get()->PostTask( 56 base::ThreadTaskRunnerHandle::Get()->PostTask(
57 FROM_HERE, 57 FROM_HERE,
58 base::Bind(&LayerTreeHostCopyRequestTestMultipleRequests::NextStep, 58 base::Bind(&LayerTreeHostCopyRequestTestMultipleRequests::NextStep,
59 base::Unretained(this))); 59 base::Unretained(this)));
60 } 60 }
61 61
62 void NextStep() { 62 void NextStep() {
63 int frame = layer_tree_host()->source_frame_number(); 63 int frame = layer_tree_host()->SourceFrameNumber();
64 switch (frame) { 64 switch (frame) {
65 case 1: 65 case 1:
66 child->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( 66 child->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest(
67 base::Bind(&LayerTreeHostCopyRequestTestMultipleRequests:: 67 base::Bind(&LayerTreeHostCopyRequestTestMultipleRequests::
68 CopyOutputCallback, 68 CopyOutputCallback,
69 base::Unretained(this), 0))); 69 base::Unretained(this), 0)));
70 EXPECT_EQ(0u, callbacks_.size()); 70 EXPECT_EQ(0u, callbacks_.size());
71 break; 71 break;
72 case 2: 72 case 2:
73 // This commit is triggered by the copy request having been completed. 73 // This commit is triggered by the copy request having been completed.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // The |root| was copied to a bitmap and passed back also in Case 2. 112 // The |root| was copied to a bitmap and passed back also in Case 2.
113 EXPECT_EQ(gfx::Size(20, 20).ToString(), callbacks_[2].ToString()); 113 EXPECT_EQ(gfx::Size(20, 20).ToString(), callbacks_[2].ToString());
114 // The |grand_child| was copied to a bitmap and passed back in Case 2. 114 // The |grand_child| was copied to a bitmap and passed back in Case 2.
115 EXPECT_EQ(gfx::Size(5, 5).ToString(), callbacks_[3].ToString()); 115 EXPECT_EQ(gfx::Size(5, 5).ToString(), callbacks_[3].ToString());
116 EndTest(); 116 EndTest();
117 break; 117 break;
118 } 118 }
119 } 119 }
120 120
121 void CopyOutputCallback(size_t id, std::unique_ptr<CopyOutputResult> result) { 121 void CopyOutputCallback(size_t id, std::unique_ptr<CopyOutputResult> result) {
122 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); 122 EXPECT_TRUE(layer_tree_host()->GetTaskRunnerProvider()->IsMainThread());
123 EXPECT_TRUE(result->HasBitmap()); 123 EXPECT_TRUE(result->HasBitmap());
124 std::unique_ptr<SkBitmap> bitmap = result->TakeBitmap(); 124 std::unique_ptr<SkBitmap> bitmap = result->TakeBitmap();
125 EXPECT_EQ(result->size().ToString(), 125 EXPECT_EQ(result->size().ToString(),
126 gfx::Size(bitmap->width(), bitmap->height()).ToString()); 126 gfx::Size(bitmap->width(), bitmap->height()).ToString());
127 callbacks_[id] = result->size(); 127 callbacks_[id] = result->size();
128 } 128 }
129 129
130 void AfterTest() override { EXPECT_EQ(4u, callbacks_.size()); } 130 void AfterTest() override { EXPECT_EQ(4u, callbacks_.size()); }
131 131
132 std::unique_ptr<OutputSurface> CreateDisplayOutputSurface( 132 std::unique_ptr<OutputSurface> CreateDisplayOutputSurface(
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 layer_tree()->SetRootLayer(root_); 207 layer_tree()->SetRootLayer(root_);
208 LayerTreeHostCopyRequestTest::SetupTree(); 208 LayerTreeHostCopyRequestTest::SetupTree();
209 client_.set_bounds(root_->bounds()); 209 client_.set_bounds(root_->bounds());
210 } 210 }
211 211
212 void BeginTest() override { 212 void BeginTest() override {
213 PostSetNeedsCommitToMainThread(); 213 PostSetNeedsCommitToMainThread();
214 } 214 }
215 215
216 void DidCommit() override { 216 void DidCommit() override {
217 int frame = layer_tree_host()->source_frame_number(); 217 int frame = layer_tree_host()->SourceFrameNumber();
218 switch (frame) { 218 switch (frame) {
219 case 1: 219 case 1:
220 layer_->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( 220 layer_->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest(
221 base::Bind(&LayerTreeHostCopyRequestCompletionCausesCommit:: 221 base::Bind(&LayerTreeHostCopyRequestCompletionCausesCommit::
222 CopyOutputCallback))); 222 CopyOutputCallback)));
223 break; 223 break;
224 case 2: 224 case 2:
225 // This commit is triggered by the copy request. 225 // This commit is triggered by the copy request.
226 break; 226 break;
227 case 3: 227 case 3:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 LayerTreeHostCopyRequestTest::SetupTree(); 263 LayerTreeHostCopyRequestTest::SetupTree();
264 client_.set_bounds(root_->bounds()); 264 client_.set_bounds(root_->bounds());
265 } 265 }
266 266
267 void BeginTest() override { 267 void BeginTest() override {
268 callback_count_ = 0; 268 callback_count_ = 0;
269 PostSetNeedsCommitToMainThread(); 269 PostSetNeedsCommitToMainThread();
270 } 270 }
271 271
272 void DidCommit() override { 272 void DidCommit() override {
273 int frame = layer_tree_host()->source_frame_number(); 273 int frame = layer_tree_host()->SourceFrameNumber();
274 switch (frame) { 274 switch (frame) {
275 case 1: 275 case 1:
276 main_destroyed_->RequestCopyOfOutput( 276 main_destroyed_->RequestCopyOfOutput(
277 CopyOutputRequest::CreateBitmapRequest(base::Bind( 277 CopyOutputRequest::CreateBitmapRequest(base::Bind(
278 &LayerTreeHostCopyRequestTestLayerDestroyed::CopyOutputCallback, 278 &LayerTreeHostCopyRequestTestLayerDestroyed::CopyOutputCallback,
279 base::Unretained(this)))); 279 base::Unretained(this))));
280 impl_destroyed_->RequestCopyOfOutput( 280 impl_destroyed_->RequestCopyOfOutput(
281 CopyOutputRequest::CreateBitmapRequest(base::Bind( 281 CopyOutputRequest::CreateBitmapRequest(base::Bind(
282 &LayerTreeHostCopyRequestTestLayerDestroyed::CopyOutputCallback, 282 &LayerTreeHostCopyRequestTestLayerDestroyed::CopyOutputCallback,
283 base::Unretained(this)))); 283 base::Unretained(this))));
(...skipping 30 matching lines...) Expand all
314 break; 314 break;
315 case 5: 315 case 5:
316 // We should get another callback with a NULL bitmap. 316 // We should get another callback with a NULL bitmap.
317 EXPECT_EQ(2, callback_count_); 317 EXPECT_EQ(2, callback_count_);
318 EndTest(); 318 EndTest();
319 break; 319 break;
320 } 320 }
321 } 321 }
322 322
323 void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) { 323 void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {
324 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); 324 EXPECT_TRUE(layer_tree_host()->GetTaskRunnerProvider()->IsMainThread());
325 EXPECT_TRUE(result->IsEmpty()); 325 EXPECT_TRUE(result->IsEmpty());
326 ++callback_count_; 326 ++callback_count_;
327 } 327 }
328 328
329 void AfterTest() override {} 329 void AfterTest() override {}
330 330
331 int callback_count_; 331 int callback_count_;
332 FakeContentLayerClient client_; 332 FakeContentLayerClient client_;
333 scoped_refptr<FakePictureLayer> root_; 333 scoped_refptr<FakePictureLayer> root_;
334 scoped_refptr<FakePictureLayer> main_destroyed_; 334 scoped_refptr<FakePictureLayer> main_destroyed_;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 372
373 void BeginTest() override { 373 void BeginTest() override {
374 callback_count_ = 0; 374 callback_count_ = 0;
375 PostSetNeedsCommitToMainThread(); 375 PostSetNeedsCommitToMainThread();
376 376
377 AddCopyRequest(copy_layer_.get()); 377 AddCopyRequest(copy_layer_.get());
378 } 378 }
379 379
380 void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) { 380 void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {
381 ++callback_count_; 381 ++callback_count_;
382 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); 382 EXPECT_TRUE(layer_tree_host()->GetTaskRunnerProvider()->IsMainThread());
383 EXPECT_EQ(copy_layer_->bounds().ToString(), result->size().ToString()) 383 EXPECT_EQ(copy_layer_->bounds().ToString(), result->size().ToString())
384 << callback_count_; 384 << callback_count_;
385 switch (callback_count_) { 385 switch (callback_count_) {
386 case 1: 386 case 1:
387 // Hide the copy request layer. 387 // Hide the copy request layer.
388 grand_parent_layer_->SetHideLayerAndSubtree(false); 388 grand_parent_layer_->SetHideLayerAndSubtree(false);
389 parent_layer_->SetHideLayerAndSubtree(false); 389 parent_layer_->SetHideLayerAndSubtree(false);
390 copy_layer_->SetHideLayerAndSubtree(true); 390 copy_layer_->SetHideLayerAndSubtree(true);
391 AddCopyRequest(copy_layer_.get()); 391 AddCopyRequest(copy_layer_.get());
392 break; 392 break;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 PostSetNeedsCommitToMainThread(); 477 PostSetNeedsCommitToMainThread();
478 478
479 copy_layer_->RequestCopyOfOutput( 479 copy_layer_->RequestCopyOfOutput(
480 CopyOutputRequest::CreateBitmapRequest(base::Bind( 480 CopyOutputRequest::CreateBitmapRequest(base::Bind(
481 &LayerTreeHostTestHiddenSurfaceNotAllocatedForSubtreeCopyRequest:: 481 &LayerTreeHostTestHiddenSurfaceNotAllocatedForSubtreeCopyRequest::
482 CopyOutputCallback, 482 CopyOutputCallback,
483 base::Unretained(this)))); 483 base::Unretained(this))));
484 } 484 }
485 485
486 void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) { 486 void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {
487 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); 487 EXPECT_TRUE(layer_tree_host()->GetTaskRunnerProvider()->IsMainThread());
488 EXPECT_EQ(copy_layer_->bounds().ToString(), result->size().ToString()); 488 EXPECT_EQ(copy_layer_->bounds().ToString(), result->size().ToString());
489 EndTest(); 489 EndTest();
490 } 490 }
491 491
492 void DisplayWillDrawAndSwapOnThread( 492 void DisplayWillDrawAndSwapOnThread(
493 bool will_draw_and_swap, 493 bool will_draw_and_swap,
494 const RenderPassList& render_passes) override { 494 const RenderPassList& render_passes) override {
495 EXPECT_TRUE(will_draw_and_swap) << did_swap_; 495 EXPECT_TRUE(will_draw_and_swap) << did_swap_;
496 if (did_swap_) { 496 if (did_swap_) {
497 // TODO(crbug.com/564832): Ignore the extra frame that occurs due to copy 497 // TODO(crbug.com/564832): Ignore the extra frame that occurs due to copy
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 PostSetNeedsCommitToMainThread(); 571 PostSetNeedsCommitToMainThread();
572 572
573 copy_layer_->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( 573 copy_layer_->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest(
574 base::Bind(&LayerTreeHostCopyRequestTestClippedOut::CopyOutputCallback, 574 base::Bind(&LayerTreeHostCopyRequestTestClippedOut::CopyOutputCallback,
575 base::Unretained(this)))); 575 base::Unretained(this))));
576 } 576 }
577 577
578 void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) { 578 void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {
579 // We should still get the content even if the copy requested layer was 579 // We should still get the content even if the copy requested layer was
580 // completely clipped away. 580 // completely clipped away.
581 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); 581 EXPECT_TRUE(layer_tree_host()->GetTaskRunnerProvider()->IsMainThread());
582 EXPECT_EQ(gfx::Size(10, 10).ToString(), result->size().ToString()); 582 EXPECT_EQ(gfx::Size(10, 10).ToString(), result->size().ToString());
583 EndTest(); 583 EndTest();
584 } 584 }
585 585
586 void AfterTest() override {} 586 void AfterTest() override {}
587 587
588 FakeContentLayerClient client_; 588 FakeContentLayerClient client_;
589 scoped_refptr<FakePictureLayer> root_; 589 scoped_refptr<FakePictureLayer> root_;
590 scoped_refptr<FakePictureLayer> parent_layer_; 590 scoped_refptr<FakePictureLayer> parent_layer_;
591 scoped_refptr<FakePictureLayer> copy_layer_; 591 scoped_refptr<FakePictureLayer> copy_layer_;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 } 680 }
681 681
682 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { 682 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
683 if (impl->active_tree()->source_frame_number() == 0) { 683 if (impl->active_tree()->source_frame_number() == 0) {
684 EXPECT_TRUE(impl->active_tree()->LayerById(copy_layer_->id())); 684 EXPECT_TRUE(impl->active_tree()->LayerById(copy_layer_->id()));
685 saw_copy_request_ = true; 685 saw_copy_request_ = true;
686 } 686 }
687 } 687 }
688 688
689 void DidCommit() override { 689 void DidCommit() override {
690 if (layer_tree_host()->source_frame_number() == 1) { 690 if (layer_tree_host()->SourceFrameNumber() == 1) {
691 // Allow drawing. 691 // Allow drawing.
692 layer_tree()->SetViewportSize(gfx::Size(root_->bounds())); 692 layer_tree()->SetViewportSize(gfx::Size(root_->bounds()));
693 693
694 AddCopyRequest(copy_layer_.get()); 694 AddCopyRequest(copy_layer_.get());
695 } 695 }
696 } 696 }
697 697
698 void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) { 698 void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {
699 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); 699 EXPECT_TRUE(layer_tree_host()->GetTaskRunnerProvider()->IsMainThread());
700 700
701 // The first frame can't be drawn. 701 // The first frame can't be drawn.
702 switch (callback_count_) { 702 switch (callback_count_) {
703 case 0: 703 case 0:
704 EXPECT_TRUE(result->IsEmpty()); 704 EXPECT_TRUE(result->IsEmpty());
705 EXPECT_EQ(gfx::Size(), result->size()); 705 EXPECT_EQ(gfx::Size(), result->size());
706 break; 706 break;
707 case 1: 707 case 1:
708 EXPECT_FALSE(result->IsEmpty()); 708 EXPECT_FALSE(result->IsEmpty());
709 EXPECT_EQ(copy_layer_->bounds().ToString(), result->size().ToString()); 709 EXPECT_EQ(copy_layer_->bounds().ToString(), result->size().ToString());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 747
748 layer_tree()->SetRootLayer(root_); 748 layer_tree()->SetRootLayer(root_);
749 LayerTreeHostCopyRequestTest::SetupTree(); 749 LayerTreeHostCopyRequestTest::SetupTree();
750 client_.set_bounds(root_->bounds()); 750 client_.set_bounds(root_->bounds());
751 } 751 }
752 752
753 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 753 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
754 754
755 void ReceiveCopyRequestOutputAndCommit( 755 void ReceiveCopyRequestOutputAndCommit(
756 std::unique_ptr<CopyOutputResult> result) { 756 std::unique_ptr<CopyOutputResult> result) {
757 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); 757 EXPECT_TRUE(layer_tree_host()->GetTaskRunnerProvider()->IsMainThread());
758 EXPECT_EQ(gfx::Size(10, 10).ToString(), result->size().ToString()); 758 EXPECT_EQ(gfx::Size(10, 10).ToString(), result->size().ToString());
759 EXPECT_TRUE(result->HasTexture()); 759 EXPECT_TRUE(result->HasTexture());
760 760
761 // Save the result for later. 761 // Save the result for later.
762 EXPECT_FALSE(result_); 762 EXPECT_FALSE(result_);
763 result_ = std::move(result); 763 result_ = std::move(result);
764 764
765 // Post a commit to lose the output surface. 765 // Post a commit to lose the output surface.
766 layer_tree_host()->SetNeedsCommit(); 766 layer_tree_host()->SetNeedsCommit();
767 } 767 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 } 881 }
882 882
883 void BeginTest() override { 883 void BeginTest() override {
884 waited_sync_token_after_readback_.Clear(); 884 waited_sync_token_after_readback_.Clear();
885 PostSetNeedsCommitToMainThread(); 885 PostSetNeedsCommitToMainThread();
886 } 886 }
887 887
888 virtual void RequestCopy(Layer* layer) = 0; 888 virtual void RequestCopy(Layer* layer) = 0;
889 889
890 void DidCommit() override { 890 void DidCommit() override {
891 switch (layer_tree_host()->source_frame_number()) { 891 switch (layer_tree_host()->SourceFrameNumber()) {
892 case 1: 892 case 1:
893 // The layers have been pushed to the impl side and drawn. Any textures 893 // The layers have been pushed to the impl side and drawn. Any textures
894 // that are created in that process will have been allocated. 894 // that are created in that process will have been allocated.
895 RequestCopy(copy_layer_.get()); 895 RequestCopy(copy_layer_.get());
896 break; 896 break;
897 } 897 }
898 } 898 }
899 899
900 void DisplayDidDrawAndSwapOnThread() override { 900 void DisplayDidDrawAndSwapOnThread() override {
901 switch (num_swaps_++) { 901 switch (num_swaps_++) {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 } 1053 }
1054 1054
1055 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { 1055 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
1056 MainThreadTaskRunner()->PostTask( 1056 MainThreadTaskRunner()->PostTask(
1057 FROM_HERE, 1057 FROM_HERE,
1058 base::Bind(&LayerTreeHostCopyRequestTestDestroyBeforeCopy::DidActivate, 1058 base::Bind(&LayerTreeHostCopyRequestTestDestroyBeforeCopy::DidActivate,
1059 base::Unretained(this))); 1059 base::Unretained(this)));
1060 } 1060 }
1061 1061
1062 void DidActivate() { 1062 void DidActivate() {
1063 switch (layer_tree_host()->source_frame_number()) { 1063 switch (layer_tree_host()->SourceFrameNumber()) {
1064 case 1: { 1064 case 1: {
1065 EXPECT_EQ(0, callback_count_); 1065 EXPECT_EQ(0, callback_count_);
1066 // Put a copy request on the layer, but then don't allow any 1066 // Put a copy request on the layer, but then don't allow any
1067 // drawing to take place. 1067 // drawing to take place.
1068 std::unique_ptr<CopyOutputRequest> request = 1068 std::unique_ptr<CopyOutputRequest> request =
1069 CopyOutputRequest::CreateRequest( 1069 CopyOutputRequest::CreateRequest(
1070 base::Bind(&LayerTreeHostCopyRequestTestDestroyBeforeCopy:: 1070 base::Bind(&LayerTreeHostCopyRequestTestDestroyBeforeCopy::
1071 CopyOutputCallback, 1071 CopyOutputCallback,
1072 base::Unretained(this))); 1072 base::Unretained(this)));
1073 copy_layer_->RequestCopyOfOutput(std::move(request)); 1073 copy_layer_->RequestCopyOfOutput(std::move(request));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 } 1129 }
1130 1130
1131 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { 1131 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
1132 MainThreadTaskRunner()->PostTask( 1132 MainThreadTaskRunner()->PostTask(
1133 FROM_HERE, 1133 FROM_HERE,
1134 base::Bind(&LayerTreeHostCopyRequestTestShutdownBeforeCopy::DidActivate, 1134 base::Bind(&LayerTreeHostCopyRequestTestShutdownBeforeCopy::DidActivate,
1135 base::Unretained(this))); 1135 base::Unretained(this)));
1136 } 1136 }
1137 1137
1138 void DidActivate() { 1138 void DidActivate() {
1139 switch (layer_tree_host()->source_frame_number()) { 1139 switch (layer_tree_host()->SourceFrameNumber()) {
1140 case 1: { 1140 case 1: {
1141 EXPECT_EQ(0, callback_count_); 1141 EXPECT_EQ(0, callback_count_);
1142 // Put a copy request on the layer, but then don't allow any 1142 // Put a copy request on the layer, but then don't allow any
1143 // drawing to take place. 1143 // drawing to take place.
1144 std::unique_ptr<CopyOutputRequest> request = 1144 std::unique_ptr<CopyOutputRequest> request =
1145 CopyOutputRequest::CreateRequest( 1145 CopyOutputRequest::CreateRequest(
1146 base::Bind(&LayerTreeHostCopyRequestTestShutdownBeforeCopy:: 1146 base::Bind(&LayerTreeHostCopyRequestTestShutdownBeforeCopy::
1147 CopyOutputCallback, 1147 CopyOutputCallback,
1148 base::Unretained(this))); 1148 base::Unretained(this)));
1149 copy_layer_->RequestCopyOfOutput(std::move(request)); 1149 copy_layer_->RequestCopyOfOutput(std::move(request));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 1192
1193 void BeginTest() override { 1193 void BeginTest() override {
1194 num_draws_ = 0; 1194 num_draws_ = 0;
1195 copy_happened_ = false; 1195 copy_happened_ = false;
1196 draw_happened_ = false; 1196 draw_happened_ = false;
1197 PostSetNeedsCommitToMainThread(); 1197 PostSetNeedsCommitToMainThread();
1198 } 1198 }
1199 1199
1200 void DidCommit() override { 1200 void DidCommit() override {
1201 // Send a copy request after the first commit. 1201 // Send a copy request after the first commit.
1202 if (layer_tree_host()->source_frame_number() == 1) { 1202 if (layer_tree_host()->SourceFrameNumber() == 1) {
1203 child_->RequestCopyOfOutput( 1203 child_->RequestCopyOfOutput(
1204 CopyOutputRequest::CreateBitmapRequest(base::Bind( 1204 CopyOutputRequest::CreateBitmapRequest(base::Bind(
1205 &LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest:: 1205 &LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest::
1206 CopyOutputCallback, 1206 CopyOutputCallback,
1207 base::Unretained(this)))); 1207 base::Unretained(this))));
1208 } 1208 }
1209 } 1209 }
1210 1210
1211 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 1211 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
1212 LayerTreeHostImpl::FrameData* frame_data, 1212 LayerTreeHostImpl::FrameData* frame_data,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 int num_draws_; 1284 int num_draws_;
1285 bool copy_happened_; 1285 bool copy_happened_;
1286 bool draw_happened_; 1286 bool draw_happened_;
1287 }; 1287 };
1288 1288
1289 SINGLE_AND_MULTI_THREAD_TEST_F( 1289 SINGLE_AND_MULTI_THREAD_TEST_F(
1290 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest); 1290 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest);
1291 1291
1292 } // namespace 1292 } // namespace
1293 } // namespace cc 1293 } // 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