Bug 1501212 - Fix faulty assert when requesting a frame from a previously discarded animated image. r=tnikkel

We should only assert that the caller is requesting the first frame or
we have advanced to or beyond the expected initial frame, when we
successfully return a frame. This is because FrameAnimator will request
on refresh ticks for the current frame again, until it observes it. If
decoding is still behind, then we likely still have frames to
auto-advance, and we will trip the assert.

Differential Revision: https://phabricator.services.mozilla.com/D9507
This commit is contained in:
Andrew Osmond 2018-10-23 08:20:04 -04:00
Родитель 8066d5c0b3
Коммит d78eab076c
1 изменённых файлов: 4 добавлений и 4 удалений

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

@ -240,10 +240,6 @@ AnimationFrameDiscardingQueue::AdvanceInternal()
imgFrame*
AnimationFrameDiscardingQueue::Get(size_t aFrame, bool aForDisplay)
{
// If we are advancing on behalf of the animation, we don't expect it to be
// getting any frames (besides the first) until we get the desired frame.
MOZ_ASSERT(aFrame == 0 || mAdvance == 0);
// The first frame is stored separately. If we only need the frame for
// display purposes, we can return it right away. If we need it for advancing
// the animation, we want to verify the recreated first frame is available
@ -271,6 +267,10 @@ AnimationFrameDiscardingQueue::Get(size_t aFrame, bool aForDisplay)
return nullptr;
}
// If we are advancing on behalf of the animation, we don't expect it to be
// getting any frames (besides the first) until we get the desired frame.
MOZ_ASSERT(aFrame == 0 || mAdvance == 0);
// If we have space for the frame, it should always be available.
MOZ_ASSERT(mDisplay[offset]);
return mDisplay[offset].get();