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
3 // found in the LICENSE file.
5 #include "media/mojo/services/mojo_renderer_factory.h"
7 #include "base/single_thread_task_runner.h"
8 #include "media/mojo/interfaces/service_factory.mojom.h"
9 #include "media/mojo/services/mojo_renderer_impl.h"
10 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
14 MojoRendererFactory::MojoRendererFactory(
15 interfaces::ServiceFactory
* service_factory
)
16 : service_factory_(service_factory
) {
17 DCHECK(service_factory_
);
20 MojoRendererFactory::~MojoRendererFactory() {
23 scoped_ptr
<Renderer
> MojoRendererFactory::CreateRenderer(
24 const scoped_refptr
<base::SingleThreadTaskRunner
>& media_task_runner
,
25 const scoped_refptr
<base::TaskRunner
>& /* worker_task_runner */,
26 AudioRendererSink
* /* audio_renderer_sink */,
27 VideoRendererSink
* /* video_renderer_sink */) {
28 DCHECK(service_factory_
);
30 interfaces::RendererPtr mojo_renderer
;
31 service_factory_
->CreateRenderer(mojo::GetProxy(&mojo_renderer
));
33 return scoped_ptr
<Renderer
>(
34 new MojoRendererImpl(media_task_runner
, mojo_renderer
.Pass()));