From 46a68f9a61b1b1cb454dbdbe47c7639dce0e410e Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Fri, 27 Mar 2015 15:56:45 +0900 Subject: [PATCH] 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. --- dom/animation/AnimationPlayer.cpp | 14 +++++++++----- dom/animation/AnimationPlayer.h | 10 ++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/dom/animation/AnimationPlayer.cpp b/dom/animation/AnimationPlayer.cpp index c2246a3a55ee..7b3791488025 100644 --- a/dom/animation/AnimationPlayer.cpp +++ b/dom/animation/AnimationPlayer.cpp @@ -61,7 +61,7 @@ AnimationPlayer::SetStartTime(const Nullable& 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); + } } } diff --git a/dom/animation/AnimationPlayer.h b/dom/animation/AnimationPlayer.h index 255f406ed136..eadfdd86388b 100644 --- a/dom/animation/AnimationPlayer.h +++ b/dom/animation/AnimationPlayer.h @@ -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;