mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-26 13:58:49 +00:00
Issue #2073 - m-c 523950: Discard decoded frames of very large GIF animations (squashed)
Controlled by image.animated.decode-on-demand.threshold-kb, default 256MB Includes squashed bugfixes/regressions: - m-c 1444537: Shutting down the decode pool should make animated decoders bail early - m-c 1628606: Make sure to mark the surface cache entry available before sending the frame complete notification - m-c 1502275: Skip recreating the decoder after redecode errors if an animated image is reset - m-c 1443232: Don't insert frames into our AnimationFrameBuffer that we consider in error and unusable
This commit is contained in:
@@ -181,7 +181,8 @@ DecoderFactory::CreateAnimationDecoder(DecoderType aType,
|
||||
NotNull<SourceBuffer*> aSourceBuffer,
|
||||
const IntSize& aIntrinsicSize,
|
||||
DecoderFlags aDecoderFlags,
|
||||
SurfaceFlags aSurfaceFlags)
|
||||
SurfaceFlags aSurfaceFlags,
|
||||
size_t aCurrentFrame)
|
||||
{
|
||||
if (aType == DecoderType::UNKNOWN) {
|
||||
return nullptr;
|
||||
@@ -213,7 +214,8 @@ DecoderFactory::CreateAnimationDecoder(DecoderType aType,
|
||||
NotNull<RefPtr<AnimationSurfaceProvider>> provider =
|
||||
WrapNotNull(new AnimationSurfaceProvider(aImage,
|
||||
surfaceKey,
|
||||
WrapNotNull(decoder)));
|
||||
WrapNotNull(decoder),
|
||||
aCurrentFrame));
|
||||
|
||||
// Attempt to insert the surface provider into the surface cache right away so
|
||||
// we won't trigger any more decoders with the same parameters.
|
||||
@@ -226,6 +228,29 @@ DecoderFactory::CreateAnimationDecoder(DecoderType aType,
|
||||
return task.forget();
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<Decoder>
|
||||
DecoderFactory::CloneAnimationDecoder(Decoder* aDecoder)
|
||||
{
|
||||
MOZ_ASSERT(aDecoder);
|
||||
MOZ_ASSERT(aDecoder->HasAnimation());
|
||||
|
||||
RefPtr<Decoder> decoder = GetDecoder(aDecoder->GetType(), nullptr,
|
||||
/* aIsRedecode = */ true);
|
||||
MOZ_ASSERT(decoder, "Should have a decoder now");
|
||||
|
||||
// Initialize the decoder.
|
||||
decoder->SetMetadataDecode(false);
|
||||
decoder->SetIterator(aDecoder->GetSourceBuffer()->Iterator());
|
||||
decoder->SetDecoderFlags(aDecoder->GetDecoderFlags());
|
||||
decoder->SetSurfaceFlags(aDecoder->GetSurfaceFlags());
|
||||
|
||||
if (NS_FAILED(decoder->Init())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return decoder.forget();
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<IDecodingTask>
|
||||
DecoderFactory::CreateMetadataDecoder(DecoderType aType,
|
||||
NotNull<RasterImage*> aImage,
|
||||
|
||||
Reference in New Issue
Block a user