Bug 1109390 part 13 - Cancel pending pauses as well as pending plays; r=jwatt

This patch simply updates the method that cancels pending plays to also cancel
pending pauses. As it stands, for some of places where this is called it might
not be appropriate to cancel pending pauses but we will adjust each of these
call sites one-by-one in subsequent patches in this series.
This commit is contained in:
Brian Birtles 2015-03-27 15:56:45 +09:00
Родитель c66558469d
Коммит 46a68f9a61
2 изменённых файлов: 15 добавлений и 9 удалений

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

@ -61,7 +61,7 @@ AnimationPlayer::SetStartTime(const Nullable<TimeDuration>& aNewStartTime)
mHoldTime = previousCurrentTime;
}
CancelPendingPlay();
CancelPendingTasks();
if (mReady) {
// We may have already resolved mReady, but in that case calling
// MaybeResolve is a no-op, so that's okay.
@ -334,7 +334,7 @@ void
AnimationPlayer::Cancel()
{
if (mPendingState != PendingState::NotPending) {
CancelPendingPlay();
CancelPendingTasks();
if (mReady) {
mReady->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
}
@ -466,7 +466,7 @@ void
AnimationPlayer::DoPause()
{
if (mPendingState == PendingState::PlayPending) {
CancelPendingPlay();
CancelPendingTasks();
// Resolve the ready promise since we currently only use it for
// players that are waiting to play. Later (in bug 1109390), we will
// use this for players waiting to pause as well and then we won't
@ -541,7 +541,7 @@ AnimationPlayer::PostUpdate()
}
void
AnimationPlayer::CancelPendingPlay()
AnimationPlayer::CancelPendingTasks()
{
if (mPendingState == PendingState::NotPending) {
return;
@ -551,7 +551,11 @@ AnimationPlayer::CancelPendingPlay()
if (doc) {
PendingPlayerTracker* tracker = doc->GetPendingPlayerTracker();
if (tracker) {
tracker->RemovePlayPending(*this);
if (mPendingState == PendingState::PlayPending) {
tracker->RemovePlayPending(*this);
} else {
tracker->RemovePausePending(*this);
}
}
}

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

@ -242,10 +242,12 @@ protected:
void UpdateSourceContent();
void FlushStyle() const;
void PostUpdate();
// Remove this player from the pending player tracker and reset
// mPendingState as necessary. The caller is responsible for resolving or
// aborting the mReady promise as necessary.
void CancelPendingPlay();
/**
* Remove this player from the pending player tracker and reset
* mPendingState as necessary. The caller is responsible for resolving or
* aborting the mReady promise as necessary.
*/
void CancelPendingTasks();
bool IsPossiblyOrphanedPendingPlayer() const;
StickyTimeDuration SourceContentEnd() const;