Bug 1265315. Part 2 - rename mReaderWrapper to mReader for less verbose coding. r=kaku. draft
authorJW Wang <jwwang@mozilla.com>
Mon, 18 Apr 2016 17:22:32 +0800
changeset 352725 fd423a15997372a59802dfc42b23c7ac51da4e2a
parent 352724 adb412a1febdbb788abb4bae30f25240c90af2df
child 518714 9f51a9b8403f30627bd2a108a067a0d254947a79
push id15763
push userjwwang@mozilla.com
push dateMon, 18 Apr 2016 14:55:08 +0000
reviewerskaku
bugs1265315
milestone48.0a1
Bug 1265315. Part 2 - rename mReaderWrapper to mReader for less verbose coding. r=kaku. MozReview-Commit-ID: KILbcrPoLCs
dom/media/SeekTask.cpp
dom/media/SeekTask.h
--- a/dom/media/SeekTask.cpp
+++ b/dom/media/SeekTask.cpp
@@ -33,39 +33,39 @@ extern LazyLogModule gMediaSampleLog;
 // when __VA_ARGS__ expands to nothing. This is a workaround for it.
 #define DECODER_WARN_HELPER(a, b) NS_WARNING b
 #define DECODER_WARN(x, ...) \
   DECODER_WARN_HELPER(0, (nsPrintfCString("Decoder=%p " x, mDecoderID, ##__VA_ARGS__).get()))
 
 /*static*/ already_AddRefed<SeekTask>
 SeekTask::CreateSeekTask(const void* aDecoderID,
                          AbstractThread* aThread,
-                         MediaDecoderReaderWrapper* aReaderWrapper,
+                         MediaDecoderReaderWrapper* aReader,
                          SeekJob&& aSeekJob,
                          const MediaInfo& aInfo,
                          const media::TimeUnit& aDuration,
                          int64_t aCurrentMediaTime)
 {
   RefPtr<SeekTask> task(new SeekTask(aDecoderID, aThread,
-                                     aReaderWrapper, Move(aSeekJob), aInfo,
+                                     aReader, Move(aSeekJob), aInfo,
                                      aDuration, aCurrentMediaTime));
 
   return task.forget();
 }
 
 SeekTask::SeekTask(const void* aDecoderID,
                    AbstractThread* aThread,
-                   MediaDecoderReaderWrapper* aReaderWrapper,
+                   MediaDecoderReaderWrapper* aReader,
                    SeekJob&& aSeekJob,
                    const MediaInfo& aInfo,
                    const media::TimeUnit& aDuration,
                    int64_t aCurrentMediaTime)
   : mDecoderID(aDecoderID)
   , mOwnerThread(aThread)
-  , mReaderWrapper(aReaderWrapper)
+  , mReader(aReader)
   , mSeekJob(Move(aSeekJob))
   , mCurrentTimeBeforeSeek(aCurrentMediaTime)
   , mAudioRate(aInfo.mAudio.mRate)
   , mHasAudio(aInfo.HasAudio())
   , mHasVideo(aInfo.HasVideo())
   , mDropAudioUntilNextDiscontinuity(false)
   , mDropVideoUntilNextDiscontinuity(false)
   , mIsDiscarded(false)
@@ -181,17 +181,17 @@ SeekTask::Exists()
 }
 
 RefPtr<SeekTask::SeekTaskPromise>
 SeekTask::Seek(const media::TimeUnit& aDuration)
 {
   AssertOwnerThread();
 
   // Do the seek.
-  mSeekRequest.Begin(mReaderWrapper->Seek(mSeekJob.mTarget, aDuration)
+  mSeekRequest.Begin(mReader->Seek(mSeekJob.mTarget, aDuration)
     ->Then(OwnerThread(), __func__, this,
            &SeekTask::OnSeekResolved, &SeekTask::OnSeekRejected));
 
   return mSeekTaskPromise.Ensure(__func__);
 }
 
 bool
 SeekTask::IsVideoDecoding() const
@@ -272,37 +272,37 @@ SeekTask::VideoRequestStatus()
 }
 
 void
 SeekTask::RequestAudioData()
 {
   AssertOwnerThread();
 
   SAMPLE_LOG("Queueing audio task - queued=%i, decoder-queued=%o",
-             !!mSeekedAudioData, mReaderWrapper->SizeOfAudioQueueInFrames());
+             !!mSeekedAudioData, mReader->SizeOfAudioQueueInFrames());
 
-  mAudioDataRequest.Begin(mReaderWrapper->RequestAudioData()
+  mAudioDataRequest.Begin(mReader->RequestAudioData()
     ->Then(OwnerThread(), __func__, this,
            &SeekTask::OnAudioDecoded, &SeekTask::OnAudioNotDecoded));
 }
 
 void
 SeekTask::RequestVideoData()
 {
   AssertOwnerThread();
   //These two variables are not used in the SEEKING state.
   const bool skipToNextKeyFrame = false;
   const media::TimeUnit currentTime = media::TimeUnit::FromMicroseconds(0);
 
   SAMPLE_LOG("Queueing video task - queued=%i, decoder-queued=%o, skip=%i, time=%lld",
-               !!mSeekedVideoData, mReaderWrapper->SizeOfVideoQueueInFrames(), skipToNextKeyFrame,
+               !!mSeekedVideoData, mReader->SizeOfVideoQueueInFrames(), skipToNextKeyFrame,
                currentTime.ToMicroseconds());
 
   mVideoDataRequest.Begin(
-    mReaderWrapper->RequestVideoData(skipToNextKeyFrame, currentTime)
+    mReader->RequestVideoData(skipToNextKeyFrame, currentTime)
     ->Then(OwnerThread(), __func__, this,
            &SeekTask::OnVideoDecoded, &SeekTask::OnVideoNotDecoded));
 }
 
 nsresult
 SeekTask::DropAudioUpToSeekTarget(MediaData* aSample)
 {
   AssertOwnerThread();
@@ -559,20 +559,20 @@ SeekTask::OnAudioNotDecoded(MediaDecoder
     // If this is a decode error, delegate to the generic error path.
     RejectIfExist(__func__);
     return;
   }
 
   // If the decoder is waiting for data, we tell it to call us back when the
   // data arrives.
   if (aReason == MediaDecoderReader::WAITING_FOR_DATA) {
-    MOZ_ASSERT(mReaderWrapper->IsWaitForDataSupported(),
+    MOZ_ASSERT(mReader->IsWaitForDataSupported(),
                "Readers that send WAITING_FOR_DATA need to implement WaitForData");
     RefPtr<SeekTask> self = this;
-    mAudioWaitRequest.Begin(mReaderWrapper->WaitForData(MediaData::AUDIO_DATA)
+    mAudioWaitRequest.Begin(mReader->WaitForData(MediaData::AUDIO_DATA)
       ->Then(OwnerThread(), __func__,
              [self] (MediaData::Type aType) -> void {
                self->mAudioWaitRequest.Complete();
                self->EnsureAudioDecodeTaskQueued();
              },
              [self] (WaitForDataRejectValue aRejection) -> void {
                self->mAudioWaitRequest.Complete();
              }));
@@ -663,20 +663,20 @@ SeekTask::OnVideoNotDecoded(MediaDecoder
     // If this is a decode error, delegate to the generic error path.
     RejectIfExist(__func__);
     return;
   }
 
   // If the decoder is waiting for data, we tell it to call us back when the
   // data arrives.
   if (aReason == MediaDecoderReader::WAITING_FOR_DATA) {
-    MOZ_ASSERT(mReaderWrapper->IsWaitForDataSupported(),
+    MOZ_ASSERT(mReader->IsWaitForDataSupported(),
                "Readers that send WAITING_FOR_DATA need to implement WaitForData");
     RefPtr<SeekTask> self = this;
-    mVideoWaitRequest.Begin(mReaderWrapper->WaitForData(MediaData::VIDEO_DATA)
+    mVideoWaitRequest.Begin(mReader->WaitForData(MediaData::VIDEO_DATA)
       ->Then(OwnerThread(), __func__,
              [self] (MediaData::Type aType) -> void {
                self->mVideoWaitRequest.Complete();
                self->EnsureVideoDecodeTaskQueued();
              },
              [self] (WaitForDataRejectValue aRejection) -> void {
                self->mVideoWaitRequest.Complete();
              }));
--- a/dom/media/SeekTask.h
+++ b/dom/media/SeekTask.h
@@ -42,17 +42,17 @@ public:
   static const bool IsExclusive = true;
 
   using SeekTaskPromise =
     MozPromise<SeekTaskResolveValue, SeekTaskRejectValue, IsExclusive>;
 
   static already_AddRefed<SeekTask>
   CreateSeekTask(const void* aDecoderID,
                  AbstractThread* aThread,
-                 MediaDecoderReaderWrapper* aReaderWrapper,
+                 MediaDecoderReaderWrapper* aReader,
                  SeekJob&& aSeekJob,
                  const MediaInfo& aInfo,
                  const media::TimeUnit& aDuration,
                  int64_t aCurrentMediaTime);
 
   virtual void Discard();
 
   virtual RefPtr<SeekTaskPromise> Seek(const media::TimeUnit& aDuration);
@@ -61,17 +61,17 @@ public:
 
   SeekJob& GetSeekJob();
 
   bool Exists();
 
 protected:
   SeekTask(const void* aDecoderID,
            AbstractThread* aThread,
-           MediaDecoderReaderWrapper* aReaderWrapper,
+           MediaDecoderReaderWrapper* aReader,
            SeekJob&& aSeekJob,
            const MediaInfo& aInfo,
            const media::TimeUnit& aDuration,
            int64_t aCurrentMediaTime);
 
   virtual ~SeekTask();
 
   void Resolve(const char* aCallSite);
@@ -126,17 +126,17 @@ protected:
 
   virtual void OnVideoNotDecoded(MediaDecoderReader::NotDecodedReason aReason);
 
   /*
    * Data shared with MDSM.
    */
   const void* mDecoderID; // For logging.
   const RefPtr<AbstractThread> mOwnerThread;
-  const RefPtr<MediaDecoderReaderWrapper> mReaderWrapper;
+  const RefPtr<MediaDecoderReaderWrapper> mReader;
 
   /*
    * Internal state.
    */
   SeekJob mSeekJob;
   MozPromiseHolder<SeekTaskPromise> mSeekTaskPromise;
   int64_t mCurrentTimeBeforeSeek;
   const uint32_t mAudioRate;  // Audio sample rate.