mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-11 01:57:00 +00:00
Bug 1155332 - If we don't have enough memory to fully decode an image, discard it immediately. r=tn
This commit is contained in:
parent
fdc5ab88b6
commit
26a4965347
@ -500,12 +500,15 @@ Decoder::InternalAddFrame(uint32_t aFrameNum,
|
|||||||
aDecodeFlags,
|
aDecodeFlags,
|
||||||
aFrameNum),
|
aFrameNum),
|
||||||
Lifetime::Persistent);
|
Lifetime::Persistent);
|
||||||
if (outcome != InsertOutcome::SUCCESS) {
|
if (outcome == InsertOutcome::FAILURE) {
|
||||||
// We either hit InsertOutcome::FAILURE, which is a temporary failure due to
|
// We couldn't insert the surface, almost certainly due to low memory. We
|
||||||
// low memory (we know it's not permanent because we checked CanHold()
|
// treat this as a permanent error to help the system recover; otherwise, we
|
||||||
// above), or InsertOutcome::FAILURE_ALREADY_PRESENT, which means that
|
// might just end up attempting to decode this image again immediately.
|
||||||
// another decoder beat us to decoding this frame. Either way, we should
|
ref->Abort();
|
||||||
// abort this decoder rather than treat this as a real error.
|
return RawAccessFrameRef();
|
||||||
|
} else if (outcome == InsertOutcome::FAILURE_ALREADY_PRESENT) {
|
||||||
|
// Another decoder beat us to decoding this frame. We abort this decoder
|
||||||
|
// rather than treat this as a real error.
|
||||||
mDecodeAborted = true;
|
mDecodeAborted = true;
|
||||||
ref->Abort();
|
ref->Abort();
|
||||||
return RawAccessFrameRef();
|
return RawAccessFrameRef();
|
||||||
|
@ -1946,6 +1946,22 @@ RasterImage::DoError()
|
|||||||
// Put the container in an error state.
|
// Put the container in an error state.
|
||||||
mError = true;
|
mError = true;
|
||||||
|
|
||||||
|
// Stop animation and release our FrameAnimator.
|
||||||
|
if (mAnimating) {
|
||||||
|
StopAnimation();
|
||||||
|
}
|
||||||
|
mAnim.release();
|
||||||
|
|
||||||
|
// Release all locks.
|
||||||
|
mLockCount = 0;
|
||||||
|
SurfaceCache::UnlockImage(ImageKey(this));
|
||||||
|
|
||||||
|
// Release all frames from the surface cache.
|
||||||
|
SurfaceCache::RemoveImage(ImageKey(this));
|
||||||
|
|
||||||
|
// Invalidate to get rid of any partially-drawn image content.
|
||||||
|
NotifyProgress(NoProgress, IntRect(0, 0, mSize.width, mSize.height));
|
||||||
|
|
||||||
// Log our error
|
// Log our error
|
||||||
LOG_CONTAINER_ERROR;
|
LOG_CONTAINER_ERROR;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user