Bug 1314884. Part 6 - remove SeekTarget::mEventVisibility. r=kaku
authorJW Wang <jwwang@mozilla.com>
Thu, 03 Nov 2016 15:34:11 +0800
changeset 351721 392e20da09634e91a33b4ab7724b8c49a520f7e4
parent 351720 c2d1763308e6694c7247c7c82060059fac289446
child 351722 3a67958e318a8603588e8403fc1926a978e86633
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskaku
bugs1314884
milestone52.0a1
Bug 1314884. Part 6 - remove SeekTarget::mEventVisibility. r=kaku Note it is fine to always assume MediaDecoderEventVisibility::Observable in SeekJob::Resolve() because no one will wait for the promise of internal seeks (where EventVisibility::Suppressed is passed). MozReview-Commit-ID: Dx7AF5VhLmL
dom/media/MediaDecoderStateMachine.cpp
dom/media/SeekJob.cpp
dom/media/SeekTarget.h
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -413,18 +413,17 @@ public:
     if (mMaster->IsPlaying()) {
       mMaster->StopPlayback();
     }
 
     // Calculate the position to seek to when exiting dormant.
     auto t = mMaster->mMediaSink->IsStarted()
       ? mMaster->GetClock()
       : mMaster->GetMediaTime();
-    mPendingSeek.mTarget = SeekTarget(
-      t, SeekTarget::Accurate, MediaDecoderEventVisibility::Suppressed);
+    mPendingSeek.mTarget = SeekTarget(t, SeekTarget::Accurate);
     // SeekJob asserts |mTarget.IsValid() == !mPromise.IsEmpty()| so we
     // need to create the promise even it is not used at all.
     RefPtr<MediaDecoder::SeekPromise> x = mPendingSeek.mPromise.Ensure(__func__);
 
     mMaster->Reset();
     mMaster->mReader->ReleaseResources();
   }
 
@@ -1205,17 +1204,16 @@ StateObject::HandleResumeVideoDecoding()
   SeekJob seekJob;
 
   const SeekTarget::Type type = mMaster->HasAudio()
                                 ? SeekTarget::Type::Accurate
                                 : SeekTarget::Type::PrevSyncPoint;
 
   seekJob.mTarget = SeekTarget(mMaster->GetMediaTime(),
                                type,
-                               MediaDecoderEventVisibility::Suppressed,
                                true /* aVideoOnly */);
 
   SetState<SeekingState>(Move(seekJob), EventVisibility::Suppressed)->Then(
     AbstractThread::MainThread(), __func__,
     [start, info, hw](){ ReportRecoveryTelemetry(start, info, hw); },
     [](){});
 }
 
--- a/dom/media/SeekJob.cpp
+++ b/dom/media/SeekJob.cpp
@@ -36,17 +36,17 @@ SeekJob& SeekJob::operator=(SeekJob&& aO
 bool SeekJob::Exists() const
 {
   MOZ_ASSERT(mTarget.IsValid() == !mPromise.IsEmpty());
   return mTarget.IsValid();
 }
 
 void SeekJob::Resolve(bool aAtEnd, const char* aCallSite)
 {
-  MediaDecoder::SeekResolveValue val(aAtEnd, mTarget.mEventVisibility);
+  MediaDecoder::SeekResolveValue val(aAtEnd, MediaDecoderEventVisibility::Observable);
   mPromise.Resolve(val, aCallSite);
   mTarget.Reset();
 }
 
 void SeekJob::RejectIfExists(const char* aCallSite)
 {
   mTarget.Reset();
   mPromise.RejectIfExists(true, aCallSite);
--- a/dom/media/SeekTarget.h
+++ b/dom/media/SeekTarget.h
@@ -22,47 +22,39 @@ enum class MediaDecoderEventVisibility :
 struct SeekTarget {
   enum Type {
     Invalid,
     PrevSyncPoint,
     Accurate,
     NextFrame,
   };
   SeekTarget()
-    : mEventVisibility(MediaDecoderEventVisibility::Observable)
-    , mTime(media::TimeUnit::Invalid())
+    : mTime(media::TimeUnit::Invalid())
     , mType(SeekTarget::Invalid)
     , mVideoOnly(false)
   {
   }
   SeekTarget(int64_t aTimeUsecs,
              Type aType,
-             MediaDecoderEventVisibility aEventVisibility =
-               MediaDecoderEventVisibility::Observable,
              bool aVideoOnly = false)
-    : mEventVisibility(aEventVisibility)
-    , mTime(media::TimeUnit::FromMicroseconds(aTimeUsecs))
+    : mTime(media::TimeUnit::FromMicroseconds(aTimeUsecs))
     , mType(aType)
     , mVideoOnly(aVideoOnly)
   {
   }
   SeekTarget(const media::TimeUnit& aTime,
              Type aType,
-             MediaDecoderEventVisibility aEventVisibility =
-               MediaDecoderEventVisibility::Observable,
              bool aVideoOnly = false)
-    : mEventVisibility(aEventVisibility)
-    , mTime(aTime)
+    : mTime(aTime)
     , mType(aType)
     , mVideoOnly(aVideoOnly)
   {
   }
   SeekTarget(const SeekTarget& aOther)
-    : mEventVisibility(aOther.mEventVisibility)
-    , mTime(aOther.mTime)
+    : mTime(aOther.mTime)
     , mType(aOther.mType)
     , mVideoOnly(aOther.mVideoOnly)
   {
   }
   bool IsValid() const {
     return mType != SeekTarget::Invalid;
   }
   void Reset() {
@@ -92,18 +84,16 @@ struct SeekTarget {
   }
   bool IsNextFrame() const {
     return mType == SeekTarget::Type::NextFrame;
   }
   bool IsVideoOnly() const {
     return mVideoOnly;
   }
 
-  MediaDecoderEventVisibility mEventVisibility;
-
 private:
   // Seek target time.
   media::TimeUnit mTime;
   // Whether we should seek "Fast", or "Accurate".
   // "Fast" seeks to the seek point preceding mTime, whereas
   // "Accurate" seeks as close as possible to mTime.
   Type mType;
   bool mVideoOnly;