Bug 1343341. Rename mDoneDecoding to mHasBeenDecoded. r=aosmond

When we allow animated images to be discarded we still want to track if the image has been fully decoded before, but it would be confusing to say that it is "done decoding" because that sounds like the image is currently decoded, even though it could be discarded at the time.
This commit is contained in:
Timothy Nikkel 2017-03-01 22:45:54 -06:00
Родитель a6cb7b9d83
Коммит 362304b8ee
3 изменённых файлов: 16 добавлений и 12 удалений

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

@ -25,9 +25,9 @@ namespace image {
///////////////////////////////////////////////////////////////////////////////
void
AnimationState::SetDoneDecoding(bool aDone)
AnimationState::NotifyDecodeComplete()
{
mDoneDecoding = aDone;
mHasBeenDecoded = true;
}
void
@ -52,7 +52,7 @@ AnimationState::UpdateKnownFrameCount(uint32_t aFrameCount)
return;
}
MOZ_ASSERT(!mDoneDecoding, "Adding new frames after decoding is finished?");
MOZ_ASSERT(!mHasBeenDecoded, "Adding new frames after decoding is finished?");
MOZ_ASSERT(aFrameCount <= mFrameCount + 1, "Skipped a frame?");
mFrameCount = aFrameCount;
@ -61,7 +61,7 @@ AnimationState::UpdateKnownFrameCount(uint32_t aFrameCount)
Maybe<uint32_t>
AnimationState::FrameCount() const
{
return mDoneDecoding ? Some(mFrameCount) : Nothing();
return mHasBeenDecoded ? Some(mFrameCount) : Nothing();
}
void
@ -98,7 +98,7 @@ AnimationState::LoopLength() const
return FrameTimeout::Forever();
}
MOZ_ASSERT(mDoneDecoding, "We know the loop length but decoding isn't done?");
MOZ_ASSERT(mHasBeenDecoded, "We know the loop length but decoding isn't done?");
// If we're not looping, a single loop time has no meaning.
if (mAnimationMode != imgIContainer::kNormalAnimMode) {

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

@ -31,14 +31,18 @@ public:
, mLoopCount(-1)
, mFirstFrameTimeout(FrameTimeout::FromRawMilliseconds(0))
, mAnimationMode(aAnimationMode)
, mDoneDecoding(false)
, mHasBeenDecoded(false)
{ }
/**
* Call when this image is finished decoding so we know that there aren't any
* more frames coming.
* Call when a decode of this image has been completed.
*/
void SetDoneDecoding(bool aDone);
void NotifyDecodeComplete();
/**
* Returns true if this image has been fully decoded before.
*/
bool GetHasBeenDecoded() { return mHasBeenDecoded; }
/**
* Call when you need to re-start animating. Ensures we start from the first
@ -140,8 +144,8 @@ private:
//! The animation mode of this image. Constants defined in imgIContainer.
uint16_t mAnimationMode;
//! Whether this image is done being decoded.
bool mDoneDecoding;
//! Whether this image has been decoded at least once.
bool mHasBeenDecoded;
};
/**

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

@ -1648,7 +1648,7 @@ RasterImage::NotifyDecodeComplete(const DecoderFinalStatus& aStatus,
mHasBeenDecoded && mAnimationState) {
// We've finished a full decode of all animation frames and our AnimationState
// has been notified about them all, so let it know not to expect anymore.
mAnimationState->SetDoneDecoding(true);
mAnimationState->NotifyDecodeComplete();
}
// Do some telemetry if this isn't a metadata decode.