Bug 1393386. P2 - remove MediaDecoder::GetResource(). r=gerald
authorJW Wang <jwwang@mozilla.com>
Thu, 24 Aug 2017 18:10:31 +0800
changeset 377360 9b9102b84ebc0a86b3a1f4f63a0c51b17c78cb09
parent 377359 96a77311197afb493fc0df71eeaf571fc1fda195
child 377361 ca5dcf6d7ff1a53b938e7b2272f3a4872740a1c2
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)
reviewersgerald
bugs1393386
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 1393386. P2 - remove MediaDecoder::GetResource(). r=gerald MozReview-Commit-ID: 7OfkJthwfoM
dom/media/ChannelMediaDecoder.cpp
dom/media/ChannelMediaDecoder.h
dom/media/MediaDecoder.h
dom/media/hls/HLSDecoder.cpp
dom/media/hls/HLSDecoder.h
dom/media/mediasource/MediaSourceDecoder.cpp
dom/media/mediasource/MediaSourceDecoder.h
--- a/dom/media/ChannelMediaDecoder.cpp
+++ b/dom/media/ChannelMediaDecoder.cpp
@@ -187,22 +187,16 @@ ChannelMediaDecoder::Clone(MediaDecoderI
   nsresult rv = decoder->Load(mResource);
   if (NS_FAILED(rv)) {
     decoder->Shutdown();
     return nullptr;
   }
   return decoder.forget();
 }
 
-MediaResource*
-ChannelMediaDecoder::GetResource() const
-{
-  return mResource;
-}
-
 MediaDecoderStateMachine* ChannelMediaDecoder::CreateStateMachine()
 {
   MOZ_ASSERT(NS_IsMainThread());
   MediaFormatReaderInit init;
   init.mVideoFrameContainer = GetVideoFrameContainer();
   init.mKnowsCompositor = GetCompositor();
   init.mCrashHelper = GetOwner()->CreateGMPCrashHelper();
   init.mFrameStats = mFrameStats;
--- a/dom/media/ChannelMediaDecoder.h
+++ b/dom/media/ChannelMediaDecoder.h
@@ -81,17 +81,16 @@ public:
   void AddSizeOfResources(ResourceSizes* aSizes) override;
   already_AddRefed<nsIPrincipal> GetCurrentPrincipal() override;
   bool IsTransportSeekable() override;
   void SetLoadInBackground(bool aLoadInBackground) override;
   void Suspend() override;
   void Resume() override;
 
 private:
-  MediaResource* GetResource() const override final;
   void PinForSeek() override;
   void UnpinForSeek() override;
 
   // Create a new state machine to run this decoder.
   MediaDecoderStateMachine* CreateStateMachine();
 
   nsresult OpenResource(nsIStreamListener** aStreamListener);
   nsresult Load(BaseMediaResource* aOriginal);
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -476,25 +476,16 @@ protected:
 
   // Amount of buffered data ahead of current time required to consider that
   // the next frame is available.
   // An arbitrary value of 250ms is used.
   static constexpr auto DEFAULT_NEXT_FRAME_AVAILABLE_BUFFERED =
     media::TimeUnit::FromMicroseconds(250000);
 
 private:
-  // Get the current MediaResource being used.
-  // Note: The MediaResource is refcounted, but it outlives the MediaDecoder,
-  // so it's OK to use the reference returned by this function without
-  // refcounting, *unless* you need to store and use the reference after the
-  // MediaDecoder has been destroyed. You might need to do this if you're
-  // wrapping the MediaResource in some kind of byte stream interface to be
-  // passed to a platform decoder.
-  virtual MediaResource* GetResource() const = 0;
-
   // Ensures our media resource has been pinned.
   virtual void PinForSeek() = 0;
 
   // Ensures our media resource has been unpinned.
   virtual void UnpinForSeek() = 0;
 
   nsCString GetDebugInfo();
 
--- a/dom/media/hls/HLSDecoder.cpp
+++ b/dom/media/hls/HLSDecoder.cpp
@@ -14,22 +14,16 @@
 #include "MediaDecoderStateMachine.h"
 #include "MediaFormatReader.h"
 #include "MediaPrefs.h"
 #include "MediaShutdownManager.h"
 #include "nsNetUtil.h"
 
 namespace mozilla {
 
-MediaResource*
-HLSDecoder::GetResource() const
-{
-  return mResource;
-}
-
 void
 HLSDecoder::Shutdown()
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (mResource) {
     mResource->Detach();
   }
   MediaDecoder::Shutdown();
--- a/dom/media/hls/HLSDecoder.h
+++ b/dom/media/hls/HLSDecoder.h
@@ -39,17 +39,16 @@ public:
 
   void AddSizeOfResources(ResourceSizes* aSizes) override;
   already_AddRefed<nsIPrincipal> GetCurrentPrincipal() override;
   bool IsTransportSeekable() override { return true; }
   void Suspend() override;
   void Resume() override;
 
 private:
-  MediaResource* GetResource() const override final;
   void PinForSeek() override {}
   void UnpinForSeek() override {}
 
   MediaDecoderStateMachine* CreateStateMachine();
 
   bool CanPlayThroughImpl() override final
   {
     // TODO: We don't know how to estimate 'canplaythrough' for this decoder.
--- a/dom/media/mediasource/MediaSourceDecoder.cpp
+++ b/dom/media/mediasource/MediaSourceDecoder.cpp
@@ -28,22 +28,16 @@ namespace mozilla {
 MediaSourceDecoder::MediaSourceDecoder(MediaDecoderInit& aInit)
   : MediaDecoder(aInit)
   , mMediaSource(nullptr)
   , mEnded(false)
 {
   mExplicitDuration.emplace(UnspecifiedNaN<double>());
 }
 
-MediaResource*
-MediaSourceDecoder::GetResource() const
-{
-  return mResource;
-}
-
 MediaDecoderStateMachine*
 MediaSourceDecoder::CreateStateMachine()
 {
   MOZ_ASSERT(NS_IsMainThread());
   mDemuxer = new MediaSourceDemuxer(AbstractMainThread());
   MediaFormatReaderInit init;
   init.mVideoFrameContainer = GetVideoFrameContainer();
   init.mKnowsCompositor = GetCompositor();
--- a/dom/media/mediasource/MediaSourceDecoder.h
+++ b/dom/media/mediasource/MediaSourceDecoder.h
@@ -61,17 +61,16 @@ public:
 
   MediaDecoderOwner::NextFrameStatus NextFrameBufferedStatus() override;
 
   bool IsMSE() const override { return true; }
 
   void NotifyInitDataArrived();
 
 private:
-  MediaResource* GetResource() const override final;
   void PinForSeek() override {}
   void UnpinForSeek() override {}
   MediaDecoderStateMachine* CreateStateMachine();
   void DoSetMediaSourceDuration(double aDuration);
   media::TimeInterval ClampIntervalToEnd(const media::TimeInterval& aInterval);
   bool CanPlayThroughImpl() override;
   bool IsLiveStream() override final { return !mEnded; }