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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
Index: media/mojo/services/mojo_renderer_impl.h
diff --git a/media/mojo/services/mojo_renderer_impl.h b/media/mojo/services/mojo_renderer_impl.h
index 85c47aaed8ad875287445744295c931fce271357..5cf98964000ab474ca0235b66bd6dbdd30846ad5 100644
--- a/media/mojo/services/mojo_renderer_impl.h
+++ b/media/mojo/services/mojo_renderer_impl.h
@@ -11,6 +11,7 @@
#include "media/base/renderer.h"
#include "media/mojo/interfaces/renderer.mojom.h"
#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/interface_ptr_info.h"
namespace base {
class SingleThreadTaskRunner;
@@ -30,13 +31,6 @@ class DemuxerStreamProvider;
// |task_runner|*. That means all Renderer and RendererClient methods will be
// called/dispached on the |task_runner|. The only exception is GetMediaTime(),
// which can be called on any thread.
-//
-// * Threading details:
-// mojo::GetProxy() doesn't bind an InterfacePtr to a thread. Then when
-// InterfacePtr::operator->() or InterfacePtr::get() is called for the first
-// time, e.g. to call remote_renderer->Initialize(), the InterfacePtr is bound
-// the thread where the call is made.
-
class MojoRendererImpl : public Renderer, public interfaces::RendererClient {
public:
MojoRendererImpl(
@@ -84,7 +78,12 @@ class MojoRendererImpl : public Renderer, public interfaces::RendererClient {
// lifetime of |this|.
DemuxerStreamProvider* demuxer_stream_provider_;
- // Remote Renderer, bound to |task_runner_|.
+ // This class is constructed on one thread and used exclusively on another
+ // thread. This member is used to safely pass the RendererPtr from one thread
+ // to another. It is set in the constructor and is consumed in Initialize().
+ mojo::InterfacePtrInfo<interfaces::Renderer> remote_renderer_info_;
yzshen1 2016/03/22 19:15:04 optional: interfaces::RendererPtrInfo
xhwang 2016/03/22 19:45:26 Done.
+
+ // Remote Renderer, bound to |task_runner_| during Initialize().
interfaces::RendererPtr remote_renderer_;
// Binding for RendererClient, bound to the |task_runner_|.

Powered by Google App Engine
This is Rietveld 408576698