mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1291071 (Part 2) - Pass decoder progress explicitly to FinalizeDecoder. r=edwin
This commit is contained in:
parent
b765419db3
commit
e3510bdeff
@ -65,11 +65,16 @@ IDecodingTask::NotifyDecodeComplete(NotNull<RasterImage*> aImage,
|
||||
|
||||
// Capture the decoder's state.
|
||||
ImageMetadata metadata = aDecoder->GetImageMetadata();
|
||||
Progress progress = aDecoder->TakeProgress();
|
||||
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)) {
|
||||
aImage->FinalizeDecoder(aDecoder, metadata);
|
||||
aImage->FinalizeDecoder(aDecoder, metadata, progress, invalidRect,
|
||||
frameCount, surfaceFlags);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -77,7 +82,8 @@ IDecodingTask::NotifyDecodeComplete(NotNull<RasterImage*> aImage,
|
||||
NotNull<RefPtr<RasterImage>> image = aImage;
|
||||
NotNull<RefPtr<Decoder>> decoder = aDecoder;
|
||||
NS_DispatchToMainThread(NS_NewRunnableFunction([=]() -> void {
|
||||
image->FinalizeDecoder(decoder.get(), metadata);
|
||||
image->FinalizeDecoder(decoder.get(), metadata, progress, invalidRect,
|
||||
frameCount, surfaceFlags);
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -1563,7 +1563,11 @@ RasterImage::NotifyProgress(Progress aProgress,
|
||||
|
||||
void
|
||||
RasterImage::FinalizeDecoder(Decoder* aDecoder,
|
||||
const ImageMetadata& aMetadata)
|
||||
const ImageMetadata& aMetadata,
|
||||
Progress aProgress,
|
||||
const IntRect& aInvalidRect,
|
||||
const Maybe<uint32_t>& aFrameCount,
|
||||
SurfaceFlags aSurfaceFlags)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aDecoder);
|
||||
@ -1582,10 +1586,8 @@ RasterImage::FinalizeDecoder(Decoder* aDecoder,
|
||||
// This indicates a serious error that requires us to discard all existing
|
||||
// surfaces and redecode to recover. We'll drop the results from this
|
||||
// decoder on the floor, since they aren't valid.
|
||||
aDecoder->TakeProgress();
|
||||
aDecoder->TakeInvalidRect();
|
||||
RecoverFromInvalidFrames(mSize,
|
||||
FromSurfaceFlags(aDecoder->GetSurfaceFlags()));
|
||||
FromSurfaceFlags(aSurfaceFlags));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1598,10 +1600,7 @@ RasterImage::FinalizeDecoder(Decoder* aDecoder,
|
||||
}
|
||||
|
||||
// Send out any final notifications.
|
||||
NotifyProgress(aDecoder->TakeProgress(),
|
||||
aDecoder->TakeInvalidRect(),
|
||||
aDecoder->TakeCompleteFrameCount(),
|
||||
aDecoder->GetSurfaceFlags());
|
||||
NotifyProgress(aProgress, aInvalidRect, aFrameCount, aSurfaceFlags);
|
||||
|
||||
if (mHasBeenDecoded && mAnimationState) {
|
||||
// We're done decoding and our AnimationState has been notified about all
|
||||
|
@ -202,7 +202,11 @@ public:
|
||||
* Main-thread only.
|
||||
*/
|
||||
void FinalizeDecoder(Decoder* aDecoder,
|
||||
const ImageMetadata& aMetadata);
|
||||
const ImageMetadata& aMetadata,
|
||||
Progress aProgress,
|
||||
const gfx::IntRect& aInvalidRect,
|
||||
const Maybe<uint32_t>& aFrameCount,
|
||||
SurfaceFlags aSurfaceFlags);
|
||||
|
||||
// Helper method for FinalizeDecoder.
|
||||
void ReportDecoderError(Decoder* aDecoder);
|
||||
|
Loading…
Reference in New Issue
Block a user