Bug 1314524. Part 4 - remove DormantState::HandleDormant(). draft
authorJW Wang <jwwang@mozilla.com>
Fri, 28 Oct 2016 16:10:49 +0800
changeset 433066 732fbc32d217dae870b50710790aaa7ebdab345e
parent 433065 522a60f93b7e204907970074fafe0bddc9272ce4
child 433067 0d652e7b55a5073fc8c7e3e88c6c4f35ccfa02ec
push id34474
push userjwwang@mozilla.com
push dateThu, 03 Nov 2016 03:26:05 +0000
bugs1314524
milestone52.0a1
Bug 1314524. Part 4 - remove DormantState::HandleDormant(). MozReview-Commit-ID: JSkpvglJzpN
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -448,37 +448,29 @@ public:
     mPendingSeek.RejectIfExists(__func__);
   }
 
   State GetState() const override
   {
     return DECODER_STATE_DORMANT;
   }
 
-  bool HandleDormant(bool aDormant);
-
   RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget) override;
 
   void HandleVideoSuspendTimeout() override
   {
     // Do nothing since we've released decoders in Enter().
   }
 
   void HandleResumeVideoDecoding() override
   {
     // Do nothing since we won't resume decoding until exiting dormant.
   }
 
-  void HandlePlayStateChanged(MediaDecoder::PlayState aPlayState) override
-  {
-    if (aPlayState == MediaDecoder::PLAY_STATE_PLAYING) {
-      // Exit dormant when the user wants to play.
-      HandleDormant(false);
-    }
-  }
+  void HandlePlayStateChanged(MediaDecoder::PlayState aPlayState) override;
 
 private:
   SeekJob mPendingSeek;
 };
 
 /**
  * Purpose: decode the 1st audio and video frames to fire the 'loadeddata' event.
  *
@@ -1361,38 +1353,38 @@ DecodeMetadataState::OnMetadataRead(Meta
 bool
 MediaDecoderStateMachine::
 WaitForCDMState::HandleDormant(bool aDormant)
 {
   mPendingDormant = aDormant;
   return true;
 }
 
-bool
-MediaDecoderStateMachine::
-DormantState::HandleDormant(bool aDormant)
-{
-  if (!aDormant) {
-    MOZ_ASSERT(!Info().IsEncrypted() || mMaster->mCDMProxy);
-    SetState<DecodingFirstFrameState>(Move(mPendingSeek));
-  }
-  return true;
-}
-
 RefPtr<MediaDecoder::SeekPromise>
 MediaDecoderStateMachine::
 DormantState::HandleSeek(SeekTarget aTarget)
 {
   // Exit dormant when the user wants to seek.
   mPendingSeek.RejectIfExists(__func__);
   SeekJob seekJob;
   seekJob.mTarget = aTarget;
   return SetState<SeekingState>(Move(seekJob));
 }
 
+void
+MediaDecoderStateMachine::
+DormantState::HandlePlayStateChanged(MediaDecoder::PlayState aPlayState)
+{
+  if (aPlayState == MediaDecoder::PLAY_STATE_PLAYING) {
+    // Exit dormant when the user wants to play.
+    MOZ_ASSERT(!Info().IsEncrypted() || mMaster->mCDMProxy);
+    SetState<DecodingFirstFrameState>(Move(mPendingSeek));
+  }
+}
+
 bool
 MediaDecoderStateMachine::
 WaitForCDMState::HandleCDMProxyReady()
 {
   if (mPendingDormant) {
     SetState<DormantState>(Move(mPendingSeek));
   } else {
     SetState<DecodingFirstFrameState>(Move(mPendingSeek));