diff --git a/image/FrameAnimator.cpp b/image/FrameAnimator.cpp index 076f884dab48..d7d1312cde0e 100644 --- a/image/FrameAnimator.cpp +++ b/image/FrameAnimator.cpp @@ -57,9 +57,11 @@ AnimationState::UpdateStateInternal(LookupResult& aResult, // no frames yet, but a decoder is or will be working on it. mDiscarded = false; mIsCurrentlyDecoded = false; + mHasRequestedDecode = true; } else { MOZ_ASSERT(aResult.Type() == MatchType::EXACT); mDiscarded = false; + mHasRequestedDecode = true; // If mHasBeenDecoded is true then we know the true total frame count and // we can use it to determine if we have all the frames now so we know if @@ -99,7 +101,7 @@ AnimationState::UpdateStateInternal(LookupResult& aResult, mCompositedFrameInvalid = false; } else if (aResult.Type() == MatchType::NOT_FOUND || aResult.Type() == MatchType::PENDING) { - if (mHasBeenDecoded) { + if (mHasRequestedDecode) { MOZ_ASSERT(gfxPrefs::ImageMemAnimatedDiscardable()); mCompositedFrameInvalid = true; } @@ -209,7 +211,7 @@ FrameAnimator::GetCurrentImgFrameEndTime(AnimationState& aState, GetTimeoutForFrame(aState, aFrames, aState.mCurrentAnimationFrameIndex); if (timeout.isNothing()) { - MOZ_ASSERT(aState.GetHasBeenDecoded() && !aState.GetIsCurrentlyDecoded()); + MOZ_ASSERT(aState.GetHasRequestedDecode() && !aState.GetIsCurrentlyDecoded()); return Nothing(); } @@ -416,7 +418,7 @@ FrameAnimator::RequestRefresh(AnimationState& aState, GetCurrentImgFrameEndTime(aState, result.Surface()); if (currentFrameEndTime.isNothing()) { MOZ_ASSERT(gfxPrefs::ImageMemAnimatedDiscardable()); - MOZ_ASSERT(aState.GetHasBeenDecoded() && !aState.GetIsCurrentlyDecoded()); + MOZ_ASSERT(aState.GetHasRequestedDecode() && !aState.GetIsCurrentlyDecoded()); MOZ_ASSERT(aState.mCompositedFrameInvalid); // Nothing we can do but wait for our previous current frame to be decoded // again so we can determine what to do next. @@ -465,7 +467,7 @@ FrameAnimator::GetCompositedFrame(AnimationState& aState) if (aState.mCompositedFrameInvalid) { MOZ_ASSERT(gfxPrefs::ImageMemAnimatedDiscardable()); - MOZ_ASSERT(aState.GetHasBeenDecoded()); + MOZ_ASSERT(aState.GetHasRequestedDecode()); MOZ_ASSERT(!aState.GetIsCurrentlyDecoded()); if (result.Type() == MatchType::NOT_FOUND) { return result; @@ -512,7 +514,7 @@ FrameAnimator::GetTimeoutForFrame(AnimationState& aState, return Some(data.mTimeout); } - MOZ_ASSERT(aState.mHasBeenDecoded && !aState.mIsCurrentlyDecoded); + MOZ_ASSERT(aState.mHasRequestedDecode && !aState.mIsCurrentlyDecoded); return Nothing(); } diff --git a/image/FrameAnimator.h b/image/FrameAnimator.h index b8136872292a..9a5fa39f7416 100644 --- a/image/FrameAnimator.h +++ b/image/FrameAnimator.h @@ -34,6 +34,7 @@ public: , mFirstFrameTimeout(FrameTimeout::FromRawMilliseconds(0)) , mAnimationMode(aAnimationMode) , mHasBeenDecoded(false) + , mHasRequestedDecode(false) , mIsCurrentlyDecoded(false) , mCompositedFrameInvalid(false) , mDiscarded(false) @@ -66,6 +67,11 @@ public: */ bool GetHasBeenDecoded() { return mHasBeenDecoded; } + /** + * Returns true if this image has ever requested a decode before. + */ + bool GetHasRequestedDecode() { return mHasRequestedDecode; } + /** * Returns true if this image has been discarded and a decoded has not yet * been created to redecode it. @@ -221,6 +227,9 @@ private: //! Whether this image has been decoded at least once. bool mHasBeenDecoded; + //! Whether this image has ever requested a decode. + bool mHasRequestedDecode; + //! Whether this image is currently fully decoded. bool mIsCurrentlyDecoded;