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

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

Issue 1529063004: Pass MojoMediaClient instance to MojoMediaApplication constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments 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
« no previous file with comments | « media/mojo/services/mojo_media_client.h ('k') | media/mojo/services/service_factory_impl.h » ('j') | 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/mojo_media_client.h" 5 #include "media/mojo/services/mojo_media_client.h"
6 6
7 namespace media { 7 namespace media {
8 8
9 // PlatformMojoMediaClient default implementations. 9 // PlatformMojoMediaClient default implementations.
10 10
(...skipping 16 matching lines...) Expand all
27 27
28 scoped_ptr<CdmFactory> PlatformMojoMediaClient::CreateCdmFactory( 28 scoped_ptr<CdmFactory> PlatformMojoMediaClient::CreateCdmFactory(
29 mojo::ServiceProvider* service_provider) { 29 mojo::ServiceProvider* service_provider) {
30 return nullptr; 30 return nullptr;
31 } 31 }
32 32
33 namespace internal { 33 namespace internal {
34 extern scoped_ptr<PlatformMojoMediaClient> CreatePlatformMojoMediaClient(); 34 extern scoped_ptr<PlatformMojoMediaClient> CreatePlatformMojoMediaClient();
35 } // namespace internal 35 } // namespace internal
36 36
37 static base::LazyInstance<MojoMediaClient>::Leaky g_mojo_media_client =
38 LAZY_INSTANCE_INITIALIZER;
39
40 // static 37 // static
41 MojoMediaClient* MojoMediaClient::Get() { 38 scoped_ptr<MojoMediaClient> MojoMediaClient::Create() {
42 return g_mojo_media_client.Pointer(); 39 return make_scoped_ptr(
40 new MojoMediaClient(internal::CreatePlatformMojoMediaClient()));
43 } 41 }
44 42
45 scoped_ptr<RendererFactory> MojoMediaClient::CreateRendererFactory( 43 scoped_ptr<RendererFactory> MojoMediaClient::CreateRendererFactory(
46 const scoped_refptr<MediaLog>& media_log) { 44 const scoped_refptr<MediaLog>& media_log) {
47 return mojo_media_client_->CreateRendererFactory(media_log); 45 return platform_client_->CreateRendererFactory(media_log);
48 } 46 }
49 47
50 scoped_refptr<AudioRendererSink> MojoMediaClient::CreateAudioRendererSink() { 48 scoped_refptr<AudioRendererSink> MojoMediaClient::CreateAudioRendererSink() {
51 return mojo_media_client_->CreateAudioRendererSink(); 49 return platform_client_->CreateAudioRendererSink();
52 } 50 }
53 51
54 scoped_ptr<VideoRendererSink> MojoMediaClient::CreateVideoRendererSink( 52 scoped_ptr<VideoRendererSink> MojoMediaClient::CreateVideoRendererSink(
55 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { 53 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) {
56 return mojo_media_client_->CreateVideoRendererSink(task_runner); 54 return platform_client_->CreateVideoRendererSink(task_runner);
57 } 55 }
58 56
59 scoped_ptr<CdmFactory> MojoMediaClient::CreateCdmFactory( 57 scoped_ptr<CdmFactory> MojoMediaClient::CreateCdmFactory(
60 mojo::ServiceProvider* service_provider) { 58 mojo::ServiceProvider* service_provider) {
61 return mojo_media_client_->CreateCdmFactory(service_provider); 59 return platform_client_->CreateCdmFactory(service_provider);
62 } 60 }
63 61
64 MojoMediaClient::MojoMediaClient() 62 MojoMediaClient::MojoMediaClient(
65 : mojo_media_client_(internal::CreatePlatformMojoMediaClient()) { 63 scoped_ptr<PlatformMojoMediaClient> platform_client)
66 DCHECK(mojo_media_client_); 64 : platform_client_(platform_client.Pass()) {
xhwang 2015/12/16 23:43:36 nit: std::move
alokp 2015/12/16 23:57:43 Done.
65 DCHECK(platform_client_);
67 } 66 }
68 67
69 MojoMediaClient::~MojoMediaClient() { 68 MojoMediaClient::~MojoMediaClient() {
70 } 69 }
71 70
72 } // namespace media 71 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_media_client.h ('k') | media/mojo/services/service_factory_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698