Bug 1308147. Part 6 - remove unused MDSM::mQueuedSeek for there is no code to modify it. draft
authorJW Wang <jwwang@mozilla.com>
Wed, 19 Oct 2016 18:27:50 +0800
changeset 428545 6ceeea177d74ac1143912c60b1e64047d957db57
parent 428544 1a29b84bc0c72e470d8bae8acf5144bc9dea395b
child 428552 01cba1ee0271fbcf42cfee9efbe5d985937700b3
push id33335
push userjwwang@mozilla.com
push dateMon, 24 Oct 2016 07:05:42 +0000
bugs1308147
milestone52.0a1
Bug 1308147. Part 6 - remove unused MDSM::mQueuedSeek for there is no code to modify it. MozReview-Commit-ID: BlQydjfm4DI
dom/media/MediaDecoderStateMachine.cpp
dom/media/MediaDecoderStateMachine.h
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -366,21 +366,16 @@ class MediaDecoderStateMachine::WaitForC
   : public MediaDecoderStateMachine::StateObject
 {
 public:
   explicit WaitForCDMState(Master* aPtr) : StateObject(aPtr) {}
 
   void Enter(bool aPendingDormant)
   {
     MOZ_ASSERT(!mMaster->mVideoDecodeSuspended);
-
-    // WAIT_FOR_CDM is transitioned from DECODING_METADATA
-    // where mQueuedSeek must be empty.
-    MOZ_ASSERT(!mMaster->mQueuedSeek.Exists());
-
     mPendingDormant = aPendingDormant;
   }
 
   void Exit() override
   {
     // mPendingSeek is either moved in HandleCDMProxyReady() or should be
     // rejected here before transition to SHUTDOWN.
     mPendingSeek.RejectIfExists(__func__);
@@ -428,17 +423,16 @@ private:
 class MediaDecoderStateMachine::DormantState
   : public MediaDecoderStateMachine::StateObject
 {
 public:
   explicit DormantState(Master* aPtr) : StateObject(aPtr) {}
 
   void Enter(SeekJob aPendingSeek)
   {
-    MOZ_ASSERT(!mMaster->mQueuedSeek.Exists());
     mPendingSeek = Move(aPendingSeek);
     if (mMaster->IsPlaying()) {
       mMaster->StopPlayback();
     }
     mMaster->Reset();
     mMaster->mReader->ReleaseResources();
   }
 
@@ -801,17 +795,16 @@ public:
       ->Then(OwnerThread(), __func__,
              [this] (const SeekTaskResolveValue& aValue) {
                OnSeekTaskResolved(aValue);
              },
              [this] (const SeekTaskRejectValue& aValue) {
                OnSeekTaskRejected(aValue);
              }));
 
-    MOZ_ASSERT(!mMaster->mQueuedSeek.Exists());
     return mSeekJob.mPromise.Ensure(__func__);
   }
 
   void Exit() override
   {
     mSeekTaskRequest.DisconnectIfExists();
     mSeekJob.RejectIfExists(__func__);
     mSeekTask->Discard();
@@ -1126,20 +1119,16 @@ public:
 
 bool
 MediaDecoderStateMachine::
 StateObject::HandleDormant(bool aDormant)
 {
   if (!aDormant) {
     return true;
   }
-  // This member function is inherited by DecodingState, BufferingState and
-  // CompletedState which can handle seek immediately without queuing a seek.
-  // Therefore mQueuedSeek must be empty here.
-  MOZ_ASSERT(!mMaster->mQueuedSeek.Exists());
   SeekJob seekJob;
   seekJob.mTarget = SeekTarget(mMaster->mCurrentPosition,
                                SeekTarget::Accurate,
                                MediaDecoderEventVisibility::Suppressed);
   // SeekJob asserts |mTarget.IsValid() == !mPromise.IsEmpty()| so we
   // need to create the promise even it is not used at all.
   RefPtr<MediaDecoder::SeekPromise> unused = seekJob.mPromise.Ensure(__func__);
   SetState<DormantState>(Move(seekJob));
@@ -1335,17 +1324,16 @@ DecodingFirstFrameState::Enter(SeekJob a
 
   // Transition to DECODING if we've decoded first frames.
   if (mMaster->mSentFirstFrameLoadedEvent) {
     SetState<DecodingState>();
     return;
   }
 
   MOZ_ASSERT(!mMaster->mVideoDecodeSuspended);
-  MOZ_ASSERT(!mMaster->mQueuedSeek.Exists());
 
   mPendingSeek = Move(aPendingSeek);
 
   // Dispatch tasks to decode first frames.
   mMaster->DispatchDecodeTasksIfNeeded();
 }
 
 RefPtr<MediaDecoder::SeekPromise>
@@ -1405,19 +1393,16 @@ DecodingFirstFrameState::MaybeFinishDeco
   }
 }
 
 void
 MediaDecoderStateMachine::
 DecodingState::Enter()
 {
   MOZ_ASSERT(mMaster->mSentFirstFrameLoadedEvent);
-  // Pending seek should've been handled by DECODING_FIRSTFRAME before
-  // transitioning to DECODING.
-  MOZ_ASSERT(!mMaster->mQueuedSeek.Exists());
 
   if (!mMaster->mIsVisible &&
       !mMaster->mVideoDecodeSuspendTimer.IsScheduled() &&
       !mMaster->mVideoDecodeSuspended) {
     // If we are not visible and the timer is not schedule, it means the timer
     // has timed out and we should suspend video decoding now if necessary.
     HandleVideoSuspendTimeout();
   }
@@ -1436,17 +1421,16 @@ DecodingState::Enter()
 
   mMaster->ScheduleStateMachine();
 }
 
 RefPtr<MediaDecoder::SeekPromise>
 MediaDecoderStateMachine::
 DecodingState::HandleSeek(SeekTarget aTarget)
 {
-  mMaster->mQueuedSeek.RejectIfExists(__func__);
   SLOG("Changed state to SEEKING (to %lld)", aTarget.GetTime().ToMicroseconds());
   SeekJob seekJob;
   seekJob.mTarget = aTarget;
   return SetState<SeekingState>(Move(seekJob));
 }
 
 bool
 MediaDecoderStateMachine::
@@ -1499,17 +1483,16 @@ DecodingState::MaybeStartBuffering()
 
 bool
 MediaDecoderStateMachine::
 SeekingState::HandleDormant(bool aDormant)
 {
   if (!aDormant) {
     return true;
   }
-  MOZ_ASSERT(!mMaster->mQueuedSeek.Exists());
   MOZ_ASSERT(mSeekJob.Exists());
   // Because both audio and video decoders are going to be reset in this
   // method later, we treat a VideoOnly seek task as a normal Accurate
   // seek task so that while it is resumed, both audio and video playback
   // are handled.
   if (mSeekJob.mTarget.IsVideoOnly()) {
     mSeekJob.mTarget.SetType(SeekTarget::Accurate);
     mSeekJob.mTarget.SetVideoOnly(false);
@@ -1518,17 +1501,16 @@ SeekingState::HandleDormant(bool aDorman
   SetState<DormantState>(Move(seekJob));
   return true;
 }
 
 RefPtr<MediaDecoder::SeekPromise>
 MediaDecoderStateMachine::
 SeekingState::HandleSeek(SeekTarget aTarget)
 {
-  mMaster->mQueuedSeek.RejectIfExists(__func__);
   SLOG("Changed state to SEEKING (to %lld)", aTarget.GetTime().ToMicroseconds());
   SeekJob seekJob;
   seekJob.mTarget = aTarget;
   return SetState<SeekingState>(Move(seekJob));
 }
 
 void
 MediaDecoderStateMachine::
@@ -1667,44 +1649,41 @@ BufferingState::HandleEndOfStream()
   }
   return true;
 }
 
 RefPtr<MediaDecoder::SeekPromise>
 MediaDecoderStateMachine::
 BufferingState::HandleSeek(SeekTarget aTarget)
 {
-  mMaster->mQueuedSeek.RejectIfExists(__func__);
   SLOG("Changed state to SEEKING (to %lld)", aTarget.GetTime().ToMicroseconds());
   SeekJob seekJob;
   seekJob.mTarget = aTarget;
   return SetState<SeekingState>(Move(seekJob));
 }
 
 RefPtr<MediaDecoder::SeekPromise>
 MediaDecoderStateMachine::
 CompletedState::HandleSeek(SeekTarget aTarget)
 {
-  mMaster->mQueuedSeek.RejectIfExists(__func__);
   SLOG("Changed state to SEEKING (to %lld)", aTarget.GetTime().ToMicroseconds());
   SeekJob seekJob;
   seekJob.mTarget = aTarget;
   return SetState<SeekingState>(Move(seekJob));
 }
 
 RefPtr<ShutdownPromise>
 MediaDecoderStateMachine::
 ShutdownState::Enter()
 {
   auto master = mMaster;
 
   master->mIsShutdown = true;
   master->mDelayedScheduler.Reset();
   master->mBufferedUpdateRequest.DisconnectIfExists();
-  master->mQueuedSeek.RejectIfExists(__func__);
 
   // Shutdown happens while decode timer is active, we need to disconnect and
   // dispose of the timer.
   master->mVideoDecodeSuspendTimer.Reset();
 
   master->mCDMProxyPromise.DisconnectIfExists();
 
   if (master->IsPlaying()) {
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -591,19 +591,16 @@ private:
   // The decoder monitor must be held.
   bool IsLogicallyPlaying()
   {
     MOZ_ASSERT(OnTaskQueue());
     return mPlayState == MediaDecoder::PLAY_STATE_PLAYING ||
            mNextPlayState == MediaDecoder::PLAY_STATE_PLAYING;
   }
 
-  // Queued seek - moves to mCurrentSeek when DecodeFirstFrame completes.
-  SeekJob mQueuedSeek;
-
   // Media Fragment end time in microseconds. Access controlled by decoder monitor.
   int64_t mFragmentEndTime;
 
   // The media sink resource.  Used on the state machine thread.
   RefPtr<media::MediaSink> mMediaSink;
 
   const RefPtr<MediaDecoderReaderWrapper> mReader;