Bug 1290809 - Remove MediaDecoder::IsEndedOrShutdown(). r=gerald

MozReview-Commit-ID: 4XUcJyQlmfk

--HG--
extra : rebase_source : fc2a044ca2776744ef0fff32300faf647666e73c
This commit is contained in:
JW Wang 2016-08-01 15:22:32 +08:00
Родитель 40cb773d8f
Коммит aace2f0c8d
3 изменённых файлов: 10 добавлений и 25 удалений

Просмотреть файл

@ -870,11 +870,7 @@ HTMLMediaElement::Ended()
return stream->IsFinished();
}
if (mDecoder) {
return mDecoder->IsEndedOrShutdown();
}
return false;
return mDecoder && mDecoder->IsEnded();
}
NS_IMETHODIMP HTMLMediaElement::GetEnded(bool* aEnded)
@ -2670,7 +2666,7 @@ HTMLMediaElement::PlayInternal(bool aCallerIsChrome)
// Even if we just did Load() or ResumeLoad(), we could already have a decoder
// here if we managed to clone an existing decoder.
if (mDecoder) {
if (mDecoder->IsEndedOrShutdown()) {
if (mDecoder->IsEnded()) {
SetCurrentTime(0);
}
if (!mPausedForInactiveDocumentOrChannel) {
@ -4083,7 +4079,7 @@ void HTMLMediaElement::PlaybackEnded()
// We changed state which can affect AddRemoveSelfReference
AddRemoveSelfReference();
NS_ASSERTION(!mDecoder || mDecoder->IsEndedOrShutdown(),
NS_ASSERTION(!mDecoder || mDecoder->IsEnded(),
"Decoder fired ended, but not in ended state");
// Discard all output streams that have finished now.
@ -4350,7 +4346,8 @@ HTMLMediaElement::UpdateReadyStateInternal()
return;
}
if (mDownloadSuspendedByCache && mDecoder && !mDecoder->IsEndedOrShutdown() &&
if (mDownloadSuspendedByCache &&
mDecoder && !mDecoder->IsEnded() &&
mFirstFrameLoaded) {
// The decoder has signaled that the download has been suspended by the
// media cache. So move readyState into HAVE_ENOUGH_DATA, in case there's
@ -4756,7 +4753,7 @@ bool HTMLMediaElement::IsPlaybackEnded() const
// the current playback position is equal to the effective end of the media resource.
// See bug 449157.
return mReadyState >= nsIDOMHTMLMediaElement::HAVE_METADATA &&
mDecoder ? mDecoder->IsEndedOrShutdown() : false;
mDecoder && mDecoder->IsEnded();
}
already_AddRefed<nsIPrincipal> HTMLMediaElement::GetCurrentPrincipal()
@ -4870,7 +4867,7 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE
#endif
if (mDecoder) {
mDecoder->Resume();
if (!mPaused && !mDecoder->IsEndedOrShutdown()) {
if (!mPaused && !mDecoder->IsEnded()) {
mDecoder->Play();
}
}
@ -4956,7 +4953,7 @@ void HTMLMediaElement::AddRemoveSelfReference()
bool needSelfReference = !mShuttingDown &&
ownerDoc->IsActive() &&
(mDelayingLoadEvent ||
(!mPaused && mDecoder && !mDecoder->IsEndedOrShutdown()) ||
(!mPaused && mDecoder && !mDecoder->IsEnded()) ||
(!mPaused && mSrcStream && !mSrcStream->IsFinished()) ||
(mDecoder && mDecoder->IsSeeking()) ||
CanActivateAutoplay() ||

Просмотреть файл

@ -1075,13 +1075,6 @@ MediaDecoder::IsSeeking() const
return mLogicallySeeking;
}
bool
MediaDecoder::IsEndedOrShutdown() const
{
MOZ_ASSERT(NS_IsMainThread());
return IsEnded() || IsShutdown();
}
bool
MediaDecoder::OwnerHasError() const
{

Просмотреть файл

@ -241,10 +241,8 @@ public:
// Call on the main thread only.
bool IsSeeking() const;
// Return true if the decoder has reached the end of playback or the decoder
// has shutdown.
// Call on the main thread only.
bool IsEndedOrShutdown() const;
// Return true if the decoder has reached the end of playback.
bool IsEnded() const;
// Return true if the MediaDecoderOwner's error attribute is not null.
// Must be called before Shutdown().
@ -531,9 +529,6 @@ protected:
// Cancel a timer for heuristic dormant.
void CancelDormantTimer();
// Return true if the decoder has reached the end of playback
bool IsEnded() const;
bool IsShutdown() const;
// Called by the state machine to notify the decoder that the duration