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

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

Issue 1455023002: cc: Replace Pass() with std::move() in some subdirs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pass-cc
Patch Set: pass-cc2: . Created 5 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
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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 603
604 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 604 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
605 605
606 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) { 606 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {
607 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); 607 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
608 EXPECT_EQ(gfx::Size(10, 10).ToString(), result->size().ToString()); 608 EXPECT_EQ(gfx::Size(10, 10).ToString(), result->size().ToString());
609 EXPECT_TRUE(result->HasTexture()); 609 EXPECT_TRUE(result->HasTexture());
610 610
611 // Save the result for later. 611 // Save the result for later.
612 EXPECT_FALSE(result_); 612 EXPECT_FALSE(result_);
613 result_ = result.Pass(); 613 result_ = std::move(result);
614 614
615 // Post a commit to lose the output surface. 615 // Post a commit to lose the output surface.
616 layer_tree_host()->SetNeedsCommit(); 616 layer_tree_host()->SetNeedsCommit();
617 } 617 }
618 618
619 void DidCommitAndDrawFrame() override { 619 void DidCommitAndDrawFrame() override {
620 switch (layer_tree_host()->source_frame_number()) { 620 switch (layer_tree_host()->source_frame_number()) {
621 case 1: 621 case 1:
622 // The layers have been pushed to the impl side. The layer textures have 622 // The layers have been pushed to the impl side. The layer textures have
623 // been allocated. 623 // been allocated.
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 base::Unretained(this))); 839 base::Unretained(this)));
840 840
841 gpu::gles2::GLES2Interface* gl = external_context_provider_->ContextGL(); 841 gpu::gles2::GLES2Interface* gl = external_context_provider_->ContextGL();
842 gpu::Mailbox mailbox; 842 gpu::Mailbox mailbox;
843 gl->GenMailboxCHROMIUM(mailbox.name); 843 gl->GenMailboxCHROMIUM(mailbox.name);
844 sync_token_ = gpu::SyncToken(gl->InsertSyncPointCHROMIUM()); 844 sync_token_ = gpu::SyncToken(gl->InsertSyncPointCHROMIUM());
845 request->SetTextureMailbox( 845 request->SetTextureMailbox(
846 TextureMailbox(mailbox, sync_token_, GL_TEXTURE_2D)); 846 TextureMailbox(mailbox, sync_token_, GL_TEXTURE_2D));
847 EXPECT_TRUE(request->has_texture_mailbox()); 847 EXPECT_TRUE(request->has_texture_mailbox());
848 848
849 copy_layer_->RequestCopyOfOutput(request.Pass()); 849 copy_layer_->RequestCopyOfOutput(std::move(request));
850 } 850 }
851 851
852 void AfterTest() override { 852 void AfterTest() override {
853 // Expect the compositor to have waited for the sync point in the provided 853 // Expect the compositor to have waited for the sync point in the provided
854 // TextureMailbox. 854 // TextureMailbox.
855 EXPECT_EQ(sync_token_, waited_sync_token_after_readback_); 855 EXPECT_EQ(sync_token_, waited_sync_token_after_readback_);
856 // Except the copy to have *not* made another texture. 856 // Except the copy to have *not* made another texture.
857 EXPECT_EQ(num_textures_without_readback_, num_textures_with_readback_); 857 EXPECT_EQ(num_textures_without_readback_, num_textures_with_readback_);
858 } 858 }
859 859
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 switch (layer_tree_host()->source_frame_number()) { 900 switch (layer_tree_host()->source_frame_number()) {
901 case 1: { 901 case 1: {
902 EXPECT_EQ(0, callback_count_); 902 EXPECT_EQ(0, callback_count_);
903 // Put a copy request on the layer, but then don't allow any 903 // Put a copy request on the layer, but then don't allow any
904 // drawing to take place. 904 // drawing to take place.
905 scoped_ptr<CopyOutputRequest> request = 905 scoped_ptr<CopyOutputRequest> request =
906 CopyOutputRequest::CreateRequest( 906 CopyOutputRequest::CreateRequest(
907 base::Bind(&LayerTreeHostCopyRequestTestDestroyBeforeCopy:: 907 base::Bind(&LayerTreeHostCopyRequestTestDestroyBeforeCopy::
908 CopyOutputCallback, 908 CopyOutputCallback,
909 base::Unretained(this))); 909 base::Unretained(this)));
910 copy_layer_->RequestCopyOfOutput(request.Pass()); 910 copy_layer_->RequestCopyOfOutput(std::move(request));
911 911
912 layer_tree_host()->SetViewportSize(gfx::Size()); 912 layer_tree_host()->SetViewportSize(gfx::Size());
913 break; 913 break;
914 } 914 }
915 case 2: 915 case 2:
916 EXPECT_EQ(0, callback_count_); 916 EXPECT_EQ(0, callback_count_);
917 // Remove the copy layer before we were able to draw. 917 // Remove the copy layer before we were able to draw.
918 copy_layer_->RemoveFromParent(); 918 copy_layer_->RemoveFromParent();
919 break; 919 break;
920 case 3: 920 case 3:
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 switch (layer_tree_host()->source_frame_number()) { 977 switch (layer_tree_host()->source_frame_number()) {
978 case 1: { 978 case 1: {
979 EXPECT_EQ(0, callback_count_); 979 EXPECT_EQ(0, callback_count_);
980 // Put a copy request on the layer, but then don't allow any 980 // Put a copy request on the layer, but then don't allow any
981 // drawing to take place. 981 // drawing to take place.
982 scoped_ptr<CopyOutputRequest> request = 982 scoped_ptr<CopyOutputRequest> request =
983 CopyOutputRequest::CreateRequest( 983 CopyOutputRequest::CreateRequest(
984 base::Bind(&LayerTreeHostCopyRequestTestShutdownBeforeCopy:: 984 base::Bind(&LayerTreeHostCopyRequestTestShutdownBeforeCopy::
985 CopyOutputCallback, 985 CopyOutputCallback,
986 base::Unretained(this))); 986 base::Unretained(this)));
987 copy_layer_->RequestCopyOfOutput(request.Pass()); 987 copy_layer_->RequestCopyOfOutput(std::move(request));
988 988
989 layer_tree_host()->SetViewportSize(gfx::Size()); 989 layer_tree_host()->SetViewportSize(gfx::Size());
990 break; 990 break;
991 } 991 }
992 case 2: 992 case 2:
993 DestroyLayerTreeHost(); 993 DestroyLayerTreeHost();
994 // End the test after the copy result has had a chance to get back to 994 // End the test after the copy result has had a chance to get back to
995 // the main thread. 995 // the main thread.
996 MainThreadTaskRunner()->PostTask( 996 MainThreadTaskRunner()->PostTask(
997 FROM_HERE, 997 FROM_HERE,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 int num_draws_; 1123 int num_draws_;
1124 bool copy_happened_; 1124 bool copy_happened_;
1125 bool draw_happened_; 1125 bool draw_happened_;
1126 }; 1126 };
1127 1127
1128 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 1128 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
1129 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest); 1129 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest);
1130 1130
1131 } // namespace 1131 } // namespace
1132 } // namespace cc 1132 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_context.cc ('k') | cc/trees/layer_tree_host_unittest_delegated.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698