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

Side by Side Diff: media/mojo/services/test_mojo_media_client.cc

Issue 2544523002: Pass Connector* into MojoMediaClient::Initialize(). (Closed)
Patch Set: Rebase Created 4 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
« no previous file with comments | « media/mojo/services/test_mojo_media_client.h ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "media/mojo/services/test_mojo_media_client.h" 5 #include "media/mojo/services/test_mojo_media_client.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 15 matching lines...) Expand all
26 26
27 TestMojoMediaClient::~TestMojoMediaClient() { 27 TestMojoMediaClient::~TestMojoMediaClient() {
28 DVLOG(1) << __func__; 28 DVLOG(1) << __func__;
29 // AudioManager destructor requires MessageLoop. 29 // AudioManager destructor requires MessageLoop.
30 // Destroy it before the message loop goes away. 30 // Destroy it before the message loop goes away.
31 audio_manager_.reset(); 31 audio_manager_.reset();
32 // Flush the message loop to ensure that the audio manager is destroyed. 32 // Flush the message loop to ensure that the audio manager is destroyed.
33 base::RunLoop().RunUntilIdle(); 33 base::RunLoop().RunUntilIdle();
34 } 34 }
35 35
36 void TestMojoMediaClient::Initialize() { 36 void TestMojoMediaClient::Initialize(
37 service_manager::Connector* /* connector */) {
37 InitializeMediaLibrary(); 38 InitializeMediaLibrary();
38 // TODO(dalecurtis): We should find a single owner per process for the audio 39 // TODO(dalecurtis): We should find a single owner per process for the audio
39 // manager or make it a lazy instance. It's not safe to call Get()/Create() 40 // manager or make it a lazy instance. It's not safe to call Get()/Create()
40 // across multiple threads... 41 // across multiple threads...
41 AudioManager* audio_manager = AudioManager::Get(); 42 AudioManager* audio_manager = AudioManager::Get();
42 if (!audio_manager) { 43 if (!audio_manager) {
43 audio_manager_ = media::AudioManager::CreateForTesting( 44 audio_manager_ = media::AudioManager::CreateForTesting(
44 base::ThreadTaskRunnerHandle::Get()); 45 base::ThreadTaskRunnerHandle::Get());
45 audio_manager = audio_manager_.get(); 46 audio_manager = audio_manager_.get();
46 // Flush the message loop to ensure that the audio manager is initialized. 47 // Flush the message loop to ensure that the audio manager is initialized.
(...skipping 14 matching lines...) Expand all
61 } 62 }
62 63
63 std::unique_ptr<RendererFactory> TestMojoMediaClient::CreateRendererFactory( 64 std::unique_ptr<RendererFactory> TestMojoMediaClient::CreateRendererFactory(
64 const scoped_refptr<MediaLog>& media_log) { 65 const scoped_refptr<MediaLog>& media_log) {
65 return base::MakeUnique<DefaultRendererFactory>( 66 return base::MakeUnique<DefaultRendererFactory>(
66 std::move(media_log), nullptr, 67 std::move(media_log), nullptr,
67 DefaultRendererFactory::GetGpuFactoriesCB()); 68 DefaultRendererFactory::GetGpuFactoriesCB());
68 } 69 }
69 70
70 std::unique_ptr<CdmFactory> TestMojoMediaClient::CreateCdmFactory( 71 std::unique_ptr<CdmFactory> TestMojoMediaClient::CreateCdmFactory(
71 service_manager::mojom::InterfaceProvider* /* interface_provider */) { 72 service_manager::mojom::InterfaceProvider* /* host_interfaces */) {
72 DVLOG(1) << __func__; 73 DVLOG(1) << __func__;
73 return base::MakeUnique<DefaultCdmFactory>(); 74 return base::MakeUnique<DefaultCdmFactory>();
74 } 75 }
75 76
76 } // namespace media 77 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/test_mojo_media_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698