Bug 1289957 (Part 2) - Notify RasterImage about new frames in NotifyProgress() and remove OnAddedFrame(). r=edwin
This commit is contained in:
@@ -25,20 +25,23 @@ NotifyProgress(NotNull<Decoder*> aDecoder)
|
||||
MOZ_ASSERT(aDecoder->HasProgress() && !aDecoder->IsMetadataDecode());
|
||||
|
||||
Progress progress = aDecoder->TakeProgress();
|
||||
nsIntRect invalidRect = aDecoder->TakeInvalidRect();
|
||||
IntRect invalidRect = aDecoder->TakeInvalidRect();
|
||||
Maybe<uint32_t> frameCount = aDecoder->TakeCompleteFrameCount();
|
||||
SurfaceFlags surfaceFlags = aDecoder->GetSurfaceFlags();
|
||||
|
||||
// Synchronously notify if we can.
|
||||
if (NS_IsMainThread() &&
|
||||
!(aDecoder->GetDecoderFlags() & DecoderFlags::ASYNC_NOTIFY)) {
|
||||
aDecoder->GetImage()->NotifyProgress(progress, invalidRect, surfaceFlags);
|
||||
aDecoder->GetImage()->NotifyProgress(progress, invalidRect,
|
||||
frameCount, surfaceFlags);
|
||||
return;
|
||||
}
|
||||
|
||||
// We're forced to notify asynchronously.
|
||||
NotNull<RefPtr<Decoder>> decoder = aDecoder;
|
||||
NS_DispatchToMainThread(NS_NewRunnableFunction([=]() -> void {
|
||||
decoder->GetImage()->NotifyProgress(progress, invalidRect, surfaceFlags);
|
||||
decoder->GetImage()->NotifyProgress(progress, invalidRect,
|
||||
frameCount, surfaceFlags);
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user