Bug 1288040 (Part 6) - Don't call GetTimeoutForFrame() in RasterImage. r=edwin
authorSeth Fowler <mark.seth.fowler@gmail.com>
Tue, 19 Jul 2016 13:51:01 -0700
changeset 345990 725304d2b48bcdd9924c0b0300e77d99f913f84d
parent 345989 3760df5754587ef476f339032068eb22b682c87e
child 345991 76ad9c12237689a490d756def046bd6e4b8901ac
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedwin
bugs1288040
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1288040 (Part 6) - Don't call GetTimeoutForFrame() in RasterImage. r=edwin
image/FrameAnimator.h
image/RasterImage.cpp
--- a/image/FrameAnimator.h
+++ b/image/FrameAnimator.h
@@ -83,20 +83,21 @@ public:
   /*
    * Set number of times to loop the image.
    * @note -1 means loop forever.
    */
   void SetLoopCount(int32_t aLoopCount) { mLoopCount = aLoopCount; }
   int32_t LoopCount() const { return mLoopCount; }
 
   /*
-   * Set the timeout for the first frame. This is used to allow animation
+   * Get or set the timeout for the first frame. This is used to allow animation
    * scheduling even before a full decode runs for this image.
    */
   void SetFirstFrameTimeout(FrameTimeout aTimeout) { mFirstFrameTimeout = aTimeout; }
+  FrameTimeout FirstFrameTimeout() const { return mFirstFrameTimeout; }
 
 private:
   friend class FrameAnimator;
 
   //! Area of the first frame that needs to be redrawn on subsequent loops.
   nsIntRect mFirstFrameRefreshArea;
 
   //! the time that the animation advanced to the current frame
--- a/image/RasterImage.cpp
+++ b/image/RasterImage.cpp
@@ -474,19 +474,17 @@ RasterImage::GetFirstFrameDelay()
   }
 
   bool animated = false;
   if (NS_FAILED(GetAnimated(&animated)) || !animated) {
     return -1;
   }
 
   MOZ_ASSERT(mAnimationState, "Animated images should have an AnimationState");
-  MOZ_ASSERT(mFrameAnimator, "Animated images should have a FrameAnimator");
-  return mFrameAnimator->
-    GetTimeoutForFrame(*mAnimationState, 0).AsEncodedValueDeprecated();
+  return mAnimationState->FirstFrameTimeout().AsEncodedValueDeprecated();
 }
 
 already_AddRefed<SourceSurface>
 RasterImage::CopyFrame(uint32_t aWhichFrame, uint32_t aFlags)
 {
   if (aWhichFrame > FRAME_MAX_VALUE) {
     return nullptr;
   }
@@ -917,23 +915,19 @@ RasterImage::StartAnimation()
 
   // If we're not ready to animate, then set mPendingAnimation, which will cause
   // us to start animating if and when we do become ready.
   mPendingAnimation = !mAnimationState || GetNumFrames() < 2;
   if (mPendingAnimation) {
     return NS_OK;
   }
 
-  MOZ_ASSERT(mFrameAnimator,
-             "Should have a FrameAnimator if we have AnimationState");
-
   // Don't bother to animate if we're displaying the first frame forever.
   if (GetCurrentFrameIndex() == 0 &&
-      mFrameAnimator->GetTimeoutForFrame(*mAnimationState, 0)
-        == FrameTimeout::Forever()) {
+      mAnimationState->FirstFrameTimeout() == FrameTimeout::Forever()) {
     mAnimationFinished = true;
     return NS_ERROR_ABORT;
   }
 
   // We need to set the time that this initial frame was first displayed, as
   // this is used in AdvanceFrame().
   mAnimationState->InitAnimationFrameTimeIfNecessary();