Bug 1527472 - devirtualize IPC methods in PVideoDecoder and PRemoteVideoDecoder. r=Alex_Gaynor
authorMichael Froman <mfroman@mozilla.com>
Wed, 13 Feb 2019 14:11:45 +0000
changeset 458895 d8c0471be578
parent 458894 f72ae300612f
child 458896 203309bfe541
push id35551
push usershindli@mozilla.com
push dateWed, 13 Feb 2019 21:34:09 +0000
treeherdermozilla-central@08f794a4928e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersAlex_Gaynor
bugs1527472
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1527472 - devirtualize IPC methods in PVideoDecoder and PRemoteVideoDecoder. r=Alex_Gaynor Differential Revision: https://phabricator.services.mozilla.com/D19578
dom/media/ipc/RemoteVideoDecoderChild.h
dom/media/ipc/RemoteVideoDecoderParent.h
dom/media/ipc/VideoDecoderChild.h
dom/media/ipc/VideoDecoderParent.h
dom/media/ipc/moz.build
ipc/ipdl/ipdl/direct_call.py
--- a/dom/media/ipc/RemoteVideoDecoderChild.h
+++ b/dom/media/ipc/RemoteVideoDecoderChild.h
@@ -15,33 +15,34 @@ namespace layers {
 class BufferRecycleBin;
 }
 }  // namespace mozilla
 
 namespace mozilla {
 
 class RemoteDecoderManagerChild;
 using mozilla::MediaDataDecoder;
+using mozilla::ipc::IPCResult;
 
 class RemoteVideoDecoderChild final : public PRemoteVideoDecoderChild,
                                       public IRemoteDecoderChild {
+  friend class PRemoteVideoDecoderChild;
+
  public:
   explicit RemoteVideoDecoderChild();
 
   // PRemoteVideoDecoderChild
-  mozilla::ipc::IPCResult RecvVideoOutput(
-      const RemoteVideoDataIPDL& aData) override;
-  mozilla::ipc::IPCResult RecvInputExhausted() override;
-  mozilla::ipc::IPCResult RecvDrainComplete() override;
-  mozilla::ipc::IPCResult RecvError(const nsresult& aError) override;
-  mozilla::ipc::IPCResult RecvInitComplete(
-      const nsCString& aDecoderDescription,
-      const ConversionRequired& aConversion) override;
-  mozilla::ipc::IPCResult RecvInitFailed(const nsresult& aReason) override;
-  mozilla::ipc::IPCResult RecvFlushComplete() override;
+  IPCResult RecvVideoOutput(const RemoteVideoDataIPDL& aData);
+  IPCResult RecvInputExhausted();
+  IPCResult RecvDrainComplete();
+  IPCResult RecvError(const nsresult& aError);
+  IPCResult RecvInitComplete(const nsCString& aDecoderDescription,
+                             const ConversionRequired& aConversion);
+  IPCResult RecvInitFailed(const nsresult& aReason);
+  IPCResult RecvFlushComplete();
 
   void ActorDestroy(ActorDestroyReason aWhy) override;
 
   // IRemoteDecoderChild
   RefPtr<MediaDataDecoder::InitPromise> Init() override;
   RefPtr<MediaDataDecoder::DecodePromise> Decode(
       MediaRawData* aSample) override;
   RefPtr<MediaDataDecoder::DecodePromise> Drain() override;
--- a/dom/media/ipc/RemoteVideoDecoderParent.h
+++ b/dom/media/ipc/RemoteVideoDecoderParent.h
@@ -5,39 +5,42 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #ifndef include_dom_media_ipc_RemoteVideoDecoderParent_h
 #define include_dom_media_ipc_RemoteVideoDecoderParent_h
 #include "mozilla/PRemoteVideoDecoderParent.h"
 
 namespace mozilla {
 
 class RemoteDecoderManagerParent;
+using mozilla::ipc::IPCResult;
 
 class RemoteVideoDecoderParent final : public PRemoteVideoDecoderParent {
+  friend class PRemoteVideoDecoderParent;
+
  public:
   // We refcount this class since the task queue can have runnables
   // that reference us.
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RemoteVideoDecoderParent)
 
   RemoteVideoDecoderParent(RemoteDecoderManagerParent* aParent,
                            const VideoInfo& aVideoInfo, float aFramerate,
                            const CreateDecoderParams::OptionSet& aOptions,
                            TaskQueue* aManagerTaskQueue,
                            TaskQueue* aDecodeTaskQueue, bool* aSuccess,
                            nsCString* aErrorDescription);
 
   void Destroy();
 
   // PRemoteVideoDecoderParent
-  mozilla::ipc::IPCResult RecvInit() override;
-  mozilla::ipc::IPCResult RecvInput(const MediaRawDataIPDL& aData) override;
-  mozilla::ipc::IPCResult RecvFlush() override;
-  mozilla::ipc::IPCResult RecvDrain() override;
-  mozilla::ipc::IPCResult RecvShutdown() override;
-  mozilla::ipc::IPCResult RecvSetSeekThreshold(const int64_t& aTime) override;
+  IPCResult RecvInit();
+  IPCResult RecvInput(const MediaRawDataIPDL& aData);
+  IPCResult RecvFlush();
+  IPCResult RecvDrain();
+  IPCResult RecvShutdown();
+  IPCResult RecvSetSeekThreshold(const int64_t& aTime);
 
   void ActorDestroy(ActorDestroyReason aWhy) override;
 
  private:
   bool OnManagerThread();
   void Error(const MediaResult& aError);
 
   ~RemoteVideoDecoderParent();
--- a/dom/media/ipc/VideoDecoderChild.h
+++ b/dom/media/ipc/VideoDecoderChild.h
@@ -11,32 +11,36 @@
 #include "mozilla/PVideoDecoderChild.h"
 #include "IRemoteDecoderChild.h"
 
 namespace mozilla {
 
 class RemoteVideoDecoder;
 class RemoteDecoderModule;
 class VideoDecoderManagerChild;
+using mozilla::ipc::IPCResult;
 
 class VideoDecoderChild final : public PVideoDecoderChild,
                                 public IRemoteDecoderChild {
+  friend class PVideoDecoderChild;
+
  public:
   explicit VideoDecoderChild();
 
   // PVideoDecoderChild
-  mozilla::ipc::IPCResult RecvOutput(const VideoDataIPDL& aData) override;
-  mozilla::ipc::IPCResult RecvInputExhausted() override;
-  mozilla::ipc::IPCResult RecvDrainComplete() override;
-  mozilla::ipc::IPCResult RecvError(const nsresult& aError) override;
-  mozilla::ipc::IPCResult RecvInitComplete(
-      const nsCString& aDecoderDescription, const bool& aHardware,
-      const nsCString& aHardwareReason, const uint32_t& aConversion) override;
-  mozilla::ipc::IPCResult RecvInitFailed(const nsresult& aReason) override;
-  mozilla::ipc::IPCResult RecvFlushComplete() override;
+  IPCResult RecvOutput(const VideoDataIPDL& aData);
+  IPCResult RecvInputExhausted();
+  IPCResult RecvDrainComplete();
+  IPCResult RecvError(const nsresult& aError);
+  IPCResult RecvInitComplete(const nsCString& aDecoderDescription,
+                             const bool& aHardware,
+                             const nsCString& aHardwareReason,
+                             const uint32_t& aConversion);
+  IPCResult RecvInitFailed(const nsresult& aReason);
+  IPCResult RecvFlushComplete();
 
   void ActorDestroy(ActorDestroyReason aWhy) override;
 
   RefPtr<MediaDataDecoder::InitPromise> Init() override;
   RefPtr<MediaDataDecoder::DecodePromise> Decode(
       MediaRawData* aSample) override;
   RefPtr<MediaDataDecoder::DecodePromise> Drain() override;
   RefPtr<MediaDataDecoder::FlushPromise> Flush() override;
--- a/dom/media/ipc/VideoDecoderParent.h
+++ b/dom/media/ipc/VideoDecoderParent.h
@@ -12,39 +12,42 @@
 #include "VideoDecoderManagerParent.h"
 #include "mozilla/MozPromise.h"
 #include "mozilla/PVideoDecoderParent.h"
 #include "mozilla/layers/TextureForwarder.h"
 
 namespace mozilla {
 
 class KnowsCompositorVideo;
+using mozilla::ipc::IPCResult;
 
 class VideoDecoderParent final : public PVideoDecoderParent {
+  friend class PVideoDecoderParent;
+
  public:
   // We refcount this class since the task queue can have runnables
   // that reference us.
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VideoDecoderParent)
 
   VideoDecoderParent(VideoDecoderManagerParent* aParent,
                      const VideoInfo& aVideoInfo, float aFramerate,
                      const CreateDecoderParams::OptionSet& aOptions,
                      const layers::TextureFactoryIdentifier& aIdentifier,
                      TaskQueue* aManagerTaskQueue, TaskQueue* aDecodeTaskQueue,
                      bool* aSuccess, nsCString* aErrorDescription);
 
   void Destroy();
 
   // PVideoDecoderParent
-  mozilla::ipc::IPCResult RecvInit() override;
-  mozilla::ipc::IPCResult RecvInput(const MediaRawDataIPDL& aData) override;
-  mozilla::ipc::IPCResult RecvFlush() override;
-  mozilla::ipc::IPCResult RecvDrain() override;
-  mozilla::ipc::IPCResult RecvShutdown() override;
-  mozilla::ipc::IPCResult RecvSetSeekThreshold(const int64_t& aTime) override;
+  IPCResult RecvInit();
+  IPCResult RecvInput(const MediaRawDataIPDL& aData);
+  IPCResult RecvFlush();
+  IPCResult RecvDrain();
+  IPCResult RecvShutdown();
+  IPCResult RecvSetSeekThreshold(const int64_t& aTime);
 
   void ActorDestroy(ActorDestroyReason aWhy) override;
 
  private:
   bool OnManagerThread();
   void Error(const MediaResult& aError);
 
   ~VideoDecoderParent();
--- a/dom/media/ipc/moz.build
+++ b/dom/media/ipc/moz.build
@@ -11,27 +11,32 @@ IPDL_SOURCES += [
     'PRemoteDecoderManager.ipdl',
     'PRemoteVideoDecoder.ipdl',
     'PVideoDecoder.ipdl',
     'PVideoDecoderManager.ipdl',
 ]
 
 EXPORTS.mozilla += [
     'GpuDecoderModule.h',
+    'IRemoteDecoderChild.h',
     'RDDChild.h',
     'RDDParent.h',
     'RDDProcessHost.h',
     'RDDProcessImpl.h',
     'RDDProcessManager.h',
     'RemoteDecoderManagerChild.h',
     'RemoteDecoderManagerParent.h',
     'RemoteDecoderModule.h',
     'RemoteMediaDataDecoder.h',
+    'RemoteVideoDecoderChild.h',
+    'RemoteVideoDecoderParent.h',
+    'VideoDecoderChild.h',
     'VideoDecoderManagerChild.h',
     'VideoDecoderManagerParent.h',
+    'VideoDecoderParent.h',
 ]
 
 EXPORTS.mozilla.dom += [
     'MediaIPCUtils.h',
 ]
 
 SOURCES += [
     'GpuDecoderModule.cpp',
--- a/ipc/ipdl/ipdl/direct_call.py
+++ b/ipc/ipdl/ipdl/direct_call.py
@@ -249,28 +249,24 @@ VIRTUAL_CALL_CLASSES = set([
     ("PPluginBackgroundDestroyer", "parent"),
     ("PPrintProgressDialog", "child"),
     ("PPrintProgressDialog", "parent"),
     ("PPrintSettingsDialog", "child"),
     ("PPrintSettingsDialog", "parent"),
     ("PQuota", "child"),
     ("PQuotaRequest", "child"),
     ("PQuotaUsageRequest", "child"),
-    ("PRemoteVideoDecoder", "child"),
-    ("PRemoteVideoDecoder", "parent"),
     ("PServiceWorker", "child"),
     ("PServiceWorker", "parent"),
     ("PServiceWorkerContainer", "child"),
     ("PServiceWorkerContainer", "parent"),
     ("PServiceWorkerRegistration", "child"),
     ("PServiceWorkerRegistration", "parent"),
     ("PServiceWorkerUpdater", "child"),
     ("PServiceWorkerUpdater", "parent"),
-    ("PVideoDecoder", "child"),
-    ("PVideoDecoder", "parent"),
     ("PVRLayer", "parent"),
     ("PWebBrowserPersistResources", "child"),
     ("PWebBrowserPersistResources", "parent"),
     ("PWebBrowserPersistSerialize", "child"),
     ("PWebBrowserPersistSerialize", "parent"),
     ("PWebrtcGlobal", "child"),
     ("PWebrtcGlobal", "parent"),