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

Side by Side Diff: content/common/gpu/media/video_decode_accelerator_unittest.cc

Issue 1918823007: vdatest: Initialize weak decoder pointer and factory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // The bulk of this file is support code; sorry about that. Here's an overview 5 // The bulk of this file is support code; sorry about that. Here's an overview
6 // to hopefully help readers of this code: 6 // to hopefully help readers of this code:
7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or 7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or
8 // Win/EGL. 8 // Win/EGL.
9 // - ClientState is an enum for the state of the decode client used by the test. 9 // - ClientState is an enum for the state of the decode client used by the test.
10 // - ClientStateNotification is a barrier abstraction that allows the test code 10 // - ClientStateNotification is a barrier abstraction that allows the test code
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 } 625 }
626 gpu::GpuPreferences gpu_preferences; 626 gpu::GpuPreferences gpu_preferences;
627 decoder_ = vda_factory_->CreateVDA(this, config, gpu_preferences); 627 decoder_ = vda_factory_->CreateVDA(this, config, gpu_preferences);
628 } 628 }
629 629
630 LOG_ASSERT(decoder_) << "Failed creating a VDA"; 630 LOG_ASSERT(decoder_) << "Failed creating a VDA";
631 631
632 decoder_->TryToSetupDecodeOnSeparateThread( 632 decoder_->TryToSetupDecodeOnSeparateThread(
633 weak_this_, base::ThreadTaskRunnerHandle::Get()); 633 weak_this_, base::ThreadTaskRunnerHandle::Get());
634 634
635 weak_vda_ptr_factory_.reset(
636 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get()));
637 weak_vda_ = weak_vda_ptr_factory_->GetWeakPtr();
638
635 SetState(CS_DECODER_SET); 639 SetState(CS_DECODER_SET);
636 FinishInitialization(); 640 FinishInitialization();
637 } 641 }
638 642
639 void GLRenderingVDAClient::ProvidePictureBuffers( 643 void GLRenderingVDAClient::ProvidePictureBuffers(
640 uint32_t requested_num_of_buffers, 644 uint32_t requested_num_of_buffers,
641 uint32_t textures_per_buffer, 645 uint32_t textures_per_buffer,
642 const gfx::Size& dimensions, 646 const gfx::Size& dimensions,
643 uint32_t texture_target) { 647 uint32_t texture_target) {
644 if (decoder_deleted()) 648 if (decoder_deleted())
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 } 885 }
882 886
883 for (int i = 0; i < num_in_flight_decodes_; ++i) 887 for (int i = 0; i < num_in_flight_decodes_; ++i)
884 DecodeNextFragment(); 888 DecodeNextFragment();
885 DCHECK_EQ(outstanding_decodes_, num_in_flight_decodes_); 889 DCHECK_EQ(outstanding_decodes_, num_in_flight_decodes_);
886 } 890 }
887 891
888 void GLRenderingVDAClient::DeleteDecoder() { 892 void GLRenderingVDAClient::DeleteDecoder() {
889 if (decoder_deleted()) 893 if (decoder_deleted())
890 return; 894 return;
891 weak_vda_ptr_factory_.reset(); 895 weak_vda_ptr_factory_->InvalidateWeakPtrs();
892 decoder_.reset(); 896 decoder_.reset();
893 STLClearObject(&encoded_data_); 897 STLClearObject(&encoded_data_);
894 active_textures_.clear(); 898 active_textures_.clear();
895 899
896 // Cascade through the rest of the states to simplify test code below. 900 // Cascade through the rest of the states to simplify test code below.
897 for (int i = state_ + 1; i < CS_MAX; ++i) 901 for (int i = state_ + 1; i < CS_MAX; ++i)
898 SetState(static_cast<ClientState>(i)); 902 SetState(static_cast<ClientState>(i));
899 } 903 }
900 904
901 std::string GLRenderingVDAClient::GetBytesForFirstFragment( 905 std::string GLRenderingVDAClient::GetBytesForFirstFragment(
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 content::VaapiWrapper::PreSandboxInitialization(); 1704 content::VaapiWrapper::PreSandboxInitialization();
1701 #endif 1705 #endif
1702 1706
1703 content::g_env = 1707 content::g_env =
1704 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( 1708 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>(
1705 testing::AddGlobalTestEnvironment( 1709 testing::AddGlobalTestEnvironment(
1706 new content::VideoDecodeAcceleratorTestEnvironment())); 1710 new content::VideoDecodeAcceleratorTestEnvironment()));
1707 1711
1708 return RUN_ALL_TESTS(); 1712 return RUN_ALL_TESTS();
1709 } 1713 }
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