Bug 1289957 (Part 2) - Notify RasterImage about new frames in NotifyProgress() and remove OnAddedFrame(). r=edwin

This commit is contained in:
Seth Fowler
2016-07-27 17:12:25 -07:00
parent 0d3a6a15a7
commit cb1acecf4d
7 changed files with 131 additions and 110 deletions

View File

@@ -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);
}));
}