Bug 1371514. P1 - remove AbstractMediaDecoder::IsOggDecoderShutdown() and its friends. r=gerald
authorJW Wang <jwwang@mozilla.com>
Fri, 09 Jun 2017 11:24:45 +0800
changeset 411540 6cb63e92bc902cb701f8ad65a32218d1e6ee66bf
parent 411539 1ce78807187af4d8243ee751d3176f77d3a30068
child 411541 3df6d3c1bebfeeb501e8f1485da21d9170602736
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1371514
milestone55.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 1371514. P1 - remove AbstractMediaDecoder::IsOggDecoderShutdown() and its friends. r=gerald MozReview-Commit-ID: 5HOqH6YtB8b
dom/media/AbstractMediaDecoder.h
dom/media/MediaDecoder.cpp
dom/media/MediaDecoder.h
dom/media/ogg/OggDecoder.h
--- a/dom/media/AbstractMediaDecoder.h
+++ b/dom/media/AbstractMediaDecoder.h
@@ -41,20 +41,16 @@ static inline bool IsCurrentThread(nsITh
 
 /**
  * The AbstractMediaDecoder class describes the public interface for a media decoder
  * and is used by the MediaReader classes.
  */
 class AbstractMediaDecoder : public nsIObserver
 {
 public:
-  // A special version of the above for the ogg decoder that is allowed to be
-  // called cross-thread.
-  virtual bool IsOggDecoderShutdown() { return false; }
-
   // Get the current MediaResource being used. Its URI will be returned
   // by currentSrc. Returns what was passed to Load(), if Load() has been called.
   virtual MediaResource* GetResource() const = 0;
 
   // Increments the parsed, decoded and dropped frame counters by the passed in
   // counts.
   // Can be called on any thread.
   virtual void NotifyDecodedFrames(const FrameStatisticsData& aStats) = 0;
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -422,20 +422,16 @@ MediaDecoder::MediaDecoder(MediaDecoderI
 
   //
   // Initialize watchers.
   //
 
   // mDuration
   mWatchManager.Watch(mStateMachineDuration, &MediaDecoder::DurationChanged);
 
-  // mStateMachineIsShutdown
-  mWatchManager.Watch(mStateMachineIsShutdown,
-                      &MediaDecoder::ShutdownBitChanged);
-
   // readyState
   mWatchManager.Watch(mPlayState, &MediaDecoder::UpdateReadyState);
   mWatchManager.Watch(mNextFrameStatus, &MediaDecoder::UpdateReadyState);
   // ReadyState computation depends on MediaDecoder::CanPlayThrough, which
   // depends on the download rate.
   mWatchManager.Watch(mBuffered, &MediaDecoder::UpdateReadyState);
 
   // mLogicalPosition
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -533,19 +533,16 @@ protected:
 
   // Called by the state machine to notify the decoder that the duration
   // has changed.
   void DurationChanged();
 
   // State-watching manager.
   WatchManager<MediaDecoder> mWatchManager;
 
-  // Used by the ogg decoder to watch mStateMachineIsShutdown.
-  virtual void ShutdownBitChanged() {}
-
   double ExplicitDuration() { return mExplicitDuration.Ref().ref(); }
 
   void SetExplicitDuration(double aValue)
   {
     MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
     mExplicitDuration.Set(Some(aValue));
 
     // We Invoke DurationChanged explicitly, rather than using a watcher, so
--- a/dom/media/ogg/OggDecoder.h
+++ b/dom/media/ogg/OggDecoder.h
@@ -12,49 +12,27 @@ namespace mozilla {
 
 class MediaContainerType;
 
 class OggDecoder : public MediaDecoder
 {
 public:
   explicit OggDecoder(MediaDecoderInit& aInit)
     : MediaDecoder(aInit)
-    , mShutdownBitMonitor("mShutdownBitMonitor")
-    , mShutdownBit(false)
   {}
 
   MediaDecoder* Clone(MediaDecoderInit& aInit) override {
     if (!IsOggEnabled()) {
       return nullptr;
     }
     return new OggDecoder(aInit);
   }
   MediaDecoderStateMachine* CreateStateMachine() override;
 
-  // For yucky legacy reasons, the ogg decoder needs to do a cross-thread read
-  // to check for shutdown while it hogs its own task queue. We don't want to
-  // protect the general state with a lock, so we make a special copy and a
-  // special-purpose lock. This method may be called on any thread.
-  bool IsOggDecoderShutdown() override
-  {
-    MonitorAutoLock lock(mShutdownBitMonitor);
-    return mShutdownBit;
-  }
-
   // Returns true if aContainerType is an Ogg type that we think we can render
   // with an enabled platform decoder backend.
   // If provided, codecs are checked for support.
   static bool IsSupportedType(const MediaContainerType& aContainerType);
-
-protected:
-  void ShutdownBitChanged() override
-  {
-    MonitorAutoLock lock(mShutdownBitMonitor);
-    mShutdownBit = mStateMachineIsShutdown;
-  }
-
-  Monitor mShutdownBitMonitor;
-  bool mShutdownBit;
 };
 
 } // namespace mozilla
 
 #endif