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

Side by Side Diff: media/mojo/services/mojo_renderer_impl.h

Issue 1821153004: media: Use PassInterface() in mojo media classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 4 years, 9 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 | « media/mojo/services/mojo_audio_decoder.cc ('k') | media/mojo/services/mojo_renderer_impl.cc » ('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 #ifndef MEDIA_MOJO_SERVICES_MOJO_RENDERER_IMPL_H_ 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_RENDERER_IMPL_H_
6 #define MEDIA_MOJO_SERVICES_MOJO_RENDERER_IMPL_H_ 6 #define MEDIA_MOJO_SERVICES_MOJO_RENDERER_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 12 matching lines...) Expand all
23 // A media::Renderer that proxies to a interfaces::Renderer. That 23 // A media::Renderer that proxies to a interfaces::Renderer. That
24 // interfaces::Renderer proxies back to the MojoRendererImpl via the 24 // interfaces::Renderer proxies back to the MojoRendererImpl via the
25 // interfaces::RendererClient interface. 25 // interfaces::RendererClient interface.
26 // 26 //
27 // This class can be created on any thread, where the |remote_renderer| is 27 // This class can be created on any thread, where the |remote_renderer| is
28 // connected and passed in the constructor. Then Initialize() will be called on 28 // connected and passed in the constructor. Then Initialize() will be called on
29 // the |task_runner| and starting from that point this class is bound to the 29 // the |task_runner| and starting from that point this class is bound to the
30 // |task_runner|*. That means all Renderer and RendererClient methods will be 30 // |task_runner|*. That means all Renderer and RendererClient methods will be
31 // called/dispached on the |task_runner|. The only exception is GetMediaTime(), 31 // called/dispached on the |task_runner|. The only exception is GetMediaTime(),
32 // which can be called on any thread. 32 // which can be called on any thread.
33 //
34 // * Threading details:
35 // mojo::GetProxy() doesn't bind an InterfacePtr to a thread. Then when
36 // InterfacePtr::operator->() or InterfacePtr::get() is called for the first
37 // time, e.g. to call remote_renderer->Initialize(), the InterfacePtr is bound
38 // the thread where the call is made.
39
40 class MojoRendererImpl : public Renderer, public interfaces::RendererClient { 33 class MojoRendererImpl : public Renderer, public interfaces::RendererClient {
41 public: 34 public:
42 MojoRendererImpl( 35 MojoRendererImpl(
43 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 36 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
44 interfaces::RendererPtr remote_renderer); 37 interfaces::RendererPtr remote_renderer);
45 ~MojoRendererImpl() override; 38 ~MojoRendererImpl() override;
46 39
47 // Renderer implementation. 40 // Renderer implementation.
48 void Initialize(DemuxerStreamProvider* demuxer_stream_provider, 41 void Initialize(DemuxerStreamProvider* demuxer_stream_provider,
49 const PipelineStatusCB& init_cb, 42 const PipelineStatusCB& init_cb,
(...skipping 27 matching lines...) Expand all
77 void OnInitialized(bool success); 70 void OnInitialized(bool success);
78 71
79 // |task_runner| on which all methods are invoked, except for GetMediaTime(), 72 // |task_runner| on which all methods are invoked, except for GetMediaTime(),
80 // which can be called on any thread. 73 // which can be called on any thread.
81 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 74 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
82 75
83 // Provider of audio/video DemuxerStreams. Must be valid throughout the 76 // Provider of audio/video DemuxerStreams. Must be valid throughout the
84 // lifetime of |this|. 77 // lifetime of |this|.
85 DemuxerStreamProvider* demuxer_stream_provider_; 78 DemuxerStreamProvider* demuxer_stream_provider_;
86 79
87 // Remote Renderer, bound to |task_runner_|. 80 // This class is constructed on one thread and used exclusively on another
81 // thread. This member is used to safely pass the RendererPtr from one thread
82 // to another. It is set in the constructor and is consumed in Initialize().
83 interfaces::RendererPtrInfo remote_renderer_info_;
84
85 // Remote Renderer, bound to |task_runner_| during Initialize().
88 interfaces::RendererPtr remote_renderer_; 86 interfaces::RendererPtr remote_renderer_;
89 87
90 // Binding for RendererClient, bound to the |task_runner_|. 88 // Binding for RendererClient, bound to the |task_runner_|.
91 mojo::Binding<RendererClient> binding_; 89 mojo::Binding<RendererClient> binding_;
92 90
93 // Callbacks passed to Initialize() that we forward messages from 91 // Callbacks passed to Initialize() that we forward messages from
94 // |remote_renderer_| through. 92 // |remote_renderer_| through.
95 PipelineStatusCB init_cb_; 93 PipelineStatusCB init_cb_;
96 base::Closure ended_cb_; 94 base::Closure ended_cb_;
97 PipelineStatusCB error_cb_; 95 PipelineStatusCB error_cb_;
98 BufferingStateCB buffering_state_cb_; 96 BufferingStateCB buffering_state_cb_;
99 97
100 // Lock used to serialize access for |time_|. 98 // Lock used to serialize access for |time_|.
101 mutable base::Lock lock_; 99 mutable base::Lock lock_;
102 base::TimeDelta time_; 100 base::TimeDelta time_;
103 101
104 DISALLOW_COPY_AND_ASSIGN(MojoRendererImpl); 102 DISALLOW_COPY_AND_ASSIGN(MojoRendererImpl);
105 }; 103 };
106 104
107 } // namespace media 105 } // namespace media
108 106
109 #endif // MEDIA_MOJO_SERVICES_MOJO_RENDERER_IMPL_H_ 107 #endif // MEDIA_MOJO_SERVICES_MOJO_RENDERER_IMPL_H_
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_audio_decoder.cc ('k') | media/mojo/services/mojo_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698