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:
Martok 2022-12-31 22:55:46 +01:00 committed by roytam1
commit e96122ede2
25 changed files with 925 additions and 63 deletions

View file

@ -87,6 +87,12 @@ public:
mMonitor.NotifyAll();
}
bool IsShuttingDown() const
{
MonitorAutoLock lock(mMonitor);
return mShuttingDown;
}
/// Pushes a new decode work item.
void PushWork(IDecodingTask* aTask)
{
@ -150,7 +156,7 @@ private:
nsThreadPoolNaming mThreadNaming;
// mMonitor guards the queues and mShuttingDown.
Monitor mMonitor;
mutable Monitor mMonitor;
nsTArray<RefPtr<IDecodingTask>> mHighPriorityQueue;
nsTArray<RefPtr<IDecodingTask>> mLowPriorityQueue;
bool mShuttingDown;
@ -299,6 +305,12 @@ DecodePool::Observe(nsISupports*, const char* aTopic, const char16_t*)
return NS_OK;
}
bool
DecodePool::IsShuttingDown() const
{
return mImpl->IsShuttingDown();
}
void
DecodePool::AsyncRun(IDecodingTask* aTask)
{