Bug 1389988 Part 1: Prevent AnimationState::UpdateStateInternal from repeatedly setting mIsCurrentlyDecoded true every frame; avoiding race condition. draft
authorBrad Werth <bwerth@mozilla.com>
Tue, 23 Jan 2018 11:01:17 -0800
changeset 723763 c0c1c8158e503f18187f90a2435474cb6c37394b
parent 723473 e2bb11b88bd45bdb2e055042e1624b74d414e73c
child 746937 f8ef66e23bac5f3b657f03b8c08be58e8cec4748
push id96515
push userbwerth@mozilla.com
push dateTue, 23 Jan 2018 19:08:46 +0000
bugs1389988
milestone60.0a1
Bug 1389988 Part 1: Prevent AnimationState::UpdateStateInternal from repeatedly setting mIsCurrentlyDecoded true every frame; avoiding race condition. MozReview-Commit-ID: LDbCtJD6u3N
image/FrameAnimator.cpp
--- a/image/FrameAnimator.cpp
+++ b/image/FrameAnimator.cpp
@@ -63,24 +63,22 @@ AnimationState::UpdateStateInternal(Look
     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
     // we are currently fully decoded.
     // If mHasBeenDecoded is false then we'll get another UpdateState call
     // when the decode finishes.
-    if (mHasBeenDecoded) {
+    if (mHasBeenDecoded && !mIsCurrentlyDecoded) {
       Maybe<uint32_t> frameCount = FrameCount();
       MOZ_ASSERT(frameCount.isSome());
       if (NS_SUCCEEDED(aResult.Surface().Seek(*frameCount - 1)) &&
           aResult.Surface()->IsFinished()) {
         mIsCurrentlyDecoded = true;
-      } else {
-        mIsCurrentlyDecoded = false;
       }
     }
   }
 
   gfx::IntRect ret;
 
   if (aAllowInvalidation) {
     // Update the value of mCompositedFrameInvalid.