Backed out changeset 89c9d42ef78e (bug 1109954) for colliding with bug 1108701 on a CLOSED TREE.
authorBobby Holley <bobbyholley@gmail.com>
Wed, 10 Dec 2014 22:56:09 -0800
changeset 245086 c90dea32c778f0f682f03192c1895fed08a265e3
parent 245085 89c9d42ef78ef5556f88c0d5eae45ef105c6eeec
child 245087 0830740262fe108825cc60aeb94a2bdeac300082
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1109954, 1108701
milestone37.0a1
backs out89c9d42ef78ef5556f88c0d5eae45ef105c6eeec
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
Backed out changeset 89c9d42ef78e (bug 1109954) for colliding with bug 1108701 on a CLOSED TREE.
dom/media/MediaDecoderStateMachine.cpp
dom/media/MediaDecoderStateMachine.h
dom/media/MediaPromise.h
dom/media/mediasource/MediaSourceReader.cpp
dom/media/mediasource/MediaSourceReader.h
dom/media/mediasource/TrackBuffer.cpp
dom/media/mediasource/TrackBuffer.h
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2486,19 +2486,20 @@ MediaDecoderStateMachine::ShutdownReader
 {
   MOZ_ASSERT(OnDecodeThread());
   mReader->Shutdown()->Then(GetStateMachineThread(), __func__, this,
                             &MediaDecoderStateMachine::FinishShutdown,
                             &MediaDecoderStateMachine::FinishShutdown);
 }
 
 void
-MediaDecoderStateMachine::FinishShutdown()
+MediaDecoderStateMachine::FinishShutdown(bool aSuccess)
 {
   MOZ_ASSERT(OnStateMachineThread());
+  MOZ_ASSERT(aSuccess);
   ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
 
   // The reader's listeners hold references to the state machine,
   // creating a cycle which keeps the state machine and its shared
   // thread pools alive. So break it here.
   AudioQueue().ClearListeners();
   VideoQueue().ClearListeners();
 
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -158,17 +158,17 @@ public:
   void SetAudioCaptured(bool aCapture);
 
   // Check if the decoder needs to become dormant state.
   bool IsDormantNeeded();
   // Set/Unset dormant state.
   void SetDormant(bool aDormant);
   void Shutdown();
   void ShutdownReader();
-  void FinishShutdown();
+  void FinishShutdown(bool aSuccess);
 
   // Called from the main thread to get the duration. The decoder monitor
   // must be obtained before calling this. It is in units of microseconds.
   int64_t GetDuration();
 
   // Called from the main thread to set the duration of the media resource
   // if it is able to be obtained via HTTP headers. Called from the
   // state machine thread to set the duration if it is obtained from the
--- a/dom/media/MediaPromise.h
+++ b/dom/media/MediaPromise.h
@@ -150,33 +150,16 @@ protected:
     virtual ~ThenValueBase() { MOZ_COUNT_DTOR(ThenValueBase); }
 
     virtual void DoResolve(ResolveValueType aResolveValue) = 0;
     virtual void DoReject(RejectValueType aRejectValue) = 0;
 
     const char* mCallSite;
   };
 
-  /*
-   * We create two specializations for invoking Resolve/Reject Methods so as to
-   * make the resolve/reject value argument "optional" via SFINAE.
-   */
-
-  template<typename ThisType, typename ValueType>
-  static void InvokeCallbackMethod(ThisType* aThisVal, void(ThisType::*aMethod)(ValueType), ValueType aValue)
-  {
-      ((*aThisVal).*aMethod)(aValue);
-  }
-
-  template<typename ThisType, typename ValueType>
-  static void InvokeCallbackMethod(ThisType* aThisVal, void(ThisType::*aMethod)(), ValueType aValue)
-  {
-      ((*aThisVal).*aMethod)();
-  }
-
   template<typename TargetType, typename ThisType,
            typename ResolveMethodType, typename RejectMethodType>
   class ThenValue : public ThenValueBase
   {
   public:
     ThenValue(TargetType* aResponseTarget, ThisType* aThisVal,
               ResolveMethodType aResolveMethod, RejectMethodType aRejectMethod,
               const char* aCallSite)
@@ -199,22 +182,22 @@ protected:
                   runnable.get(), aPromise, this);
       DebugOnly<nsresult> rv = detail::DispatchMediaPromiseRunnable(mResponseTarget, runnable);
       MOZ_ASSERT(NS_SUCCEEDED(rv));
     }
 
   protected:
     virtual void DoResolve(ResolveValueType aResolveValue)
     {
-      InvokeCallbackMethod(mThisVal.get(), mResolveMethod, aResolveValue);
+      ((*mThisVal).*mResolveMethod)(aResolveValue);
     }
 
     virtual void DoReject(RejectValueType aRejectValue)
     {
-      InvokeCallbackMethod(mThisVal.get(), mRejectMethod, aRejectValue);
+      ((*mThisVal).*mRejectMethod)(aRejectValue);
     }
 
     virtual ~ThenValue() {}
 
   private:
     nsRefPtr<TargetType> mResponseTarget;
     nsRefPtr<ThisType> mThisVal;
     ResolveMethodType mResolveMethod;
--- a/dom/media/mediasource/MediaSourceReader.cpp
+++ b/dom/media/mediasource/MediaSourceReader.cpp
@@ -294,23 +294,24 @@ MediaSourceReader::OnVideoNotDecoded(Not
 }
 
 nsRefPtr<ShutdownPromise>
 MediaSourceReader::Shutdown()
 {
   MOZ_ASSERT(mMediaSourceShutdownPromise.IsEmpty());
   nsRefPtr<ShutdownPromise> p = mMediaSourceShutdownPromise.Ensure(__func__);
 
-  ContinueShutdown();
+  ContinueShutdown(true);
   return p;
 }
 
 void
-MediaSourceReader::ContinueShutdown()
+MediaSourceReader::ContinueShutdown(bool aSuccess)
 {
+  MOZ_ASSERT(aSuccess);
   if (mTrackBuffers.Length()) {
     mTrackBuffers[0]->Shutdown()->Then(GetTaskQueue(), __func__, this,
                                        &MediaSourceReader::ContinueShutdown,
                                        &MediaSourceReader::ContinueShutdown);
     mShutdownTrackBuffers.AppendElement(mTrackBuffers[0]);
     mTrackBuffers.RemoveElementAt(0);
     return;
   }
--- a/dom/media/mediasource/MediaSourceReader.h
+++ b/dom/media/mediasource/MediaSourceReader.h
@@ -175,17 +175,17 @@ private:
   // first decoded sample. These flags are set during seeking
   // so we can detect when we have the first decoded sample
   // after a seek.
   bool mAudioIsSeeking;
   bool mVideoIsSeeking;
 
   bool mHasEssentialTrackBuffers;
 
-  void ContinueShutdown();
+  void ContinueShutdown(bool aSuccess);
   MediaPromiseHolder<ShutdownPromise> mMediaSourceShutdownPromise;
 #ifdef MOZ_FMP4
   nsRefPtr<SharedDecoderManager> mSharedDecoderManager;
 #endif
 };
 
 } // namespace mozilla
 
--- a/dom/media/mediasource/TrackBuffer.cpp
+++ b/dom/media/mediasource/TrackBuffer.cpp
@@ -107,18 +107,19 @@ TrackBuffer::Shutdown()
   queue->BeginShutdown()
        ->Then(mParentDecoder->GetReader()->GetTaskQueue(), __func__, this,
               &TrackBuffer::ContinueShutdown, &TrackBuffer::ContinueShutdown);
 
   return p;
 }
 
 void
-TrackBuffer::ContinueShutdown()
+TrackBuffer::ContinueShutdown(bool aSuccess)
 {
+  MOZ_ASSERT(aSuccess);
   ReentrantMonitorAutoEnter mon(mParentDecoder->GetReentrantMonitor());
   if (mDecoders.Length()) {
     mDecoders[0]->GetReader()->Shutdown()
                 ->Then(mParentDecoder->GetReader()->GetTaskQueue(), __func__, this,
                        &TrackBuffer::ContinueShutdown, &TrackBuffer::ContinueShutdown);
     mShutdownDecoders.AppendElement(mDecoders[0]);
     mDecoders.RemoveElementAt(0);
     return;
--- a/dom/media/mediasource/TrackBuffer.h
+++ b/dom/media/mediasource/TrackBuffer.h
@@ -155,14 +155,14 @@ private:
   // AppendData.  Accessed on the main thread only.
   int64_t mLastStartTimestamp;
   Maybe<int64_t> mLastEndTimestamp;
 
   // Set when the first decoder used by this TrackBuffer is initialized.
   // Protected by mParentDecoder's monitor.
   MediaInfo mInfo;
 
-  void ContinueShutdown();
+  void ContinueShutdown(bool aSuccess);
   MediaPromiseHolder<ShutdownPromise> mShutdownPromise;
 };
 
 } // namespace mozilla
 #endif /* MOZILLA_TRACKBUFFER_H_ */