Bug 1394316 - provide default implementation to MediaDecoderOwner methods that involve Gecko specific types. r=cpearce
authorJW Wang <jwwang@mozilla.com>
Mon, 28 Aug 2017 14:36:00 +0800
changeset 377357 516f6999e9ce443eb4cb66cd223202b497e88d95
parent 377356 3947c7efc55d1546f60219cf6724a0c4daf80960
child 377358 ed62367e3c70c7613874867ce72dea91d8217d2e
push id32407
push userarchaeopteryx@coole-files.de
push dateTue, 29 Aug 2017 18:28:36 +0000
treeherdermozilla-central@d814f791de3b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1394316
milestone57.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 1394316 - provide default implementation to MediaDecoderOwner methods that involve Gecko specific types. r=cpearce MozReview-Commit-ID: 7hhJgeYH7ys
dom/media/MediaDecoderOwner.h
dom/media/gtest/MockMediaDecoderOwner.h
--- a/dom/media/MediaDecoderOwner.h
+++ b/dom/media/MediaDecoderOwner.h
@@ -36,26 +36,16 @@ public:
   /**
    * Fires a timeupdate event. If aPeriodic is true, the event will only
    * be fired if we've not fired a timeupdate event (for any reason) in the
    * last 250ms, as required by the spec when the current time is periodically
    * increasing during playback.
    */
   virtual void FireTimeUpdate(bool aPeriodic) = 0;
 
-  // Get the HTMLMediaElement object if the decoder is being used from an
-  // HTML media element, and null otherwise.
-  virtual dom::HTMLMediaElement* GetMediaElement()
-  {
-    return nullptr;
-  }
-
-  // Return an abstract thread on which to run main thread runnables.
-  virtual AbstractThread* AbstractMainThread() const = 0;
-
   // Return true if decoding should be paused
   virtual bool GetPaused() = 0;
 
   // Called by the video decoder object, on the main thread,
   // when it has read the metadata containing video dimensions,
   // etc.
   // Must take ownership of MetadataTags aTags argument.
   virtual void MetadataLoaded(const MediaInfo* aInfo,
@@ -138,55 +128,74 @@ public:
   };
 
   // Check if the decoder owner is active.
   virtual bool IsActive() const = 0;
 
   // Check if the decoder owner is hidden.
   virtual bool IsHidden() const = 0;
 
-  // Called by the media decoder and the video frame to get the
-  // ImageContainer containing the video data.
-  virtual VideoFrameContainer* GetVideoFrameContainer() = 0;
-
   // Called by media decoder when the audible state changed
   virtual void SetAudibleState(bool aAudible) = 0;
 
   // Notified by the decoder that XPCOM shutdown has begun.
   // The decoder owner should call Shutdown() on the decoder and drop the
   // reference to the decoder to prevent further calls into the decoder.
   virtual void NotifyXPCOMShutdown() = 0;
 
   // Dispatches a "encrypted" event to the HTMLMediaElement, with the
   // provided init data. Actual dispatch may be delayed until HAVE_METADATA.
   // Main thread only.
   virtual void DispatchEncrypted(const nsTArray<uint8_t>& aInitData,
                                  const nsAString& aInitDataType) = 0;
 
-  // Return the decoder owner's owner document.
-  virtual nsIDocument* GetDocument() const = 0;
-
   // Called by the media decoder to create audio/video tracks and add to its
   // owner's track list.
   virtual void ConstructMediaTracks(const MediaInfo* aInfo) = 0;
 
   // Called by the media decoder to removes all audio/video tracks from its
   // owner's track list.
   virtual void RemoveMediaTracks() = 0;
 
-  // Called by the media decoder to create a GMPCrashHelper.
-  virtual already_AddRefed<GMPCrashHelper> CreateGMPCrashHelper() = 0;
-
   // Called by the media decoder to notify the owner to resolve a seek promise.
   virtual void AsyncResolveSeekDOMPromiseIfExists() = 0;
 
   // Called by the media decoder to notify the owner to reject a seek promise.
   virtual void AsyncRejectSeekDOMPromiseIfExists() = 0;
 
   // Notified by the decoder that a decryption key is required before emitting
   // further output.
   virtual void NotifyWaitingForKey() {}
+
+  /*
+   * Methods that are used only in Gecko go here. We provide defaul
+   * implementations so they can compile in Servo without modification.
+   */
+  // Return an abstract thread on which to run main thread runnables.
+  virtual AbstractThread* AbstractMainThread() const { return nullptr; }
+
+  // Get the HTMLMediaElement object if the decoder is being used from an
+  // HTML media element, and null otherwise.
+  virtual dom::HTMLMediaElement* GetMediaElement() { return nullptr; }
+
+  // Called by the media decoder and the video frame to get the
+  // ImageContainer containing the video data.
+  virtual VideoFrameContainer* GetVideoFrameContainer() { return nullptr; }
+
+  // Return the decoder owner's owner document.
+  virtual nsIDocument* GetDocument() const { return nullptr; }
+
+  // Called by the media decoder to create a GMPCrashHelper.
+  virtual already_AddRefed<GMPCrashHelper> CreateGMPCrashHelper()
+  {
+    return nullptr;
+  }
+
+  /*
+   * Servo only methods go here. Please provide default implementations so they
+   * can build in Gecko without any modification.
+   */
 };
 
 } // namespace mozilla
 
 #endif
 
--- a/dom/media/gtest/MockMediaDecoderOwner.h
+++ b/dom/media/gtest/MockMediaDecoderOwner.h
@@ -37,29 +37,23 @@ public:
   void DispatchEncrypted(const nsTArray<uint8_t>& aInitData,
                          const nsAString& aInitDataType) override {}
   bool IsActive() const override { return true; }
   bool IsHidden() const override { return false; }
   void DownloadSuspended() override {}
   void DownloadResumed(bool aForceNetworkLoading) override {}
   void NotifySuspendedByCache(bool aIsSuspended) override {}
   void NotifyDecoderPrincipalChanged() override {}
-  VideoFrameContainer* GetVideoFrameContainer() override
-  {
-    return nullptr;
-  }
   void SetAudibleState(bool aAudible) override {}
   void NotifyXPCOMShutdown() override {}
   AbstractThread* AbstractMainThread() const override
   {
     // Non-DocGroup version for Mock.
     return AbstractThread::MainThread();
   }
-  nsIDocument* GetDocument() const { return nullptr; }
   void ConstructMediaTracks(const MediaInfo* aInfo) {}
   void RemoveMediaTracks() {}
-  already_AddRefed<GMPCrashHelper> CreateGMPCrashHelper() { return nullptr; }
   void AsyncResolveSeekDOMPromiseIfExists() override {}
   void AsyncRejectSeekDOMPromiseIfExists() override {}
 };
 }
 
 #endif