OLD | NEW |
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_renderer_factory.h" | 5 #include "media/mojo/services/mojo_renderer_factory.h" |
6 | 6 |
7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
8 #include "media/mojo/interfaces/media_renderer.mojom.h" | 8 #include "media/mojo/interfaces/media_renderer.mojom.h" |
9 #include "media/mojo/services/mojo_renderer_impl.h" | 9 #include "media/mojo/services/mojo_renderer_impl.h" |
10 #include "mojo/public/cpp/application/connect.h" | |
11 | 10 |
12 namespace media { | 11 namespace media { |
13 | 12 |
14 MojoRendererFactory::MojoRendererFactory( | 13 MojoRendererFactory::MojoRendererFactory( |
15 mojo::ServiceProviderPtr renderer_service_provider) | 14 scoped_ptr<ServiceProvider> service_provider) |
16 : renderer_service_provider_(renderer_service_provider.Pass()) { | 15 : service_provider_(service_provider.Pass()) { |
| 16 DCHECK(service_provider_.get()); |
17 } | 17 } |
18 | 18 |
19 MojoRendererFactory::~MojoRendererFactory() { | 19 MojoRendererFactory::~MojoRendererFactory() { |
20 } | 20 } |
21 | 21 |
22 scoped_ptr<Renderer> MojoRendererFactory::CreateRenderer( | 22 scoped_ptr<Renderer> MojoRendererFactory::CreateRenderer( |
23 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, | 23 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, |
24 AudioRendererSink* /* audio_renderer_sink */) { | 24 AudioRendererSink* /* audio_renderer_sink */) { |
25 DCHECK(renderer_service_provider_.get()); | |
26 mojo::MediaRendererPtr mojo_media_renderer; | 25 mojo::MediaRendererPtr mojo_media_renderer; |
27 mojo::ConnectToService(renderer_service_provider_.get(), | 26 service_provider_->ConnectToService(&mojo_media_renderer); |
28 &mojo_media_renderer); | |
29 return scoped_ptr<Renderer>( | 27 return scoped_ptr<Renderer>( |
30 new MojoRendererImpl(media_task_runner, mojo_media_renderer.Pass())); | 28 new MojoRendererImpl(media_task_runner, mojo_media_renderer.Pass())); |
31 } | 29 } |
32 | 30 |
33 } // namespace media | 31 } // namespace media |
OLD | NEW |