зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1291071 (Part 6) - Stop passing a decoder to FinalizeDecoder() and rename it NotifyDecodeComplete(). r=edwin
This commit is contained in:
Родитель
0403b4baba
Коммит
ec7c520520
|
@ -75,17 +75,16 @@ IDecodingTask::NotifyDecodeComplete(NotNull<RasterImage*> aImage,
|
|||
// Synchronously notify if we can.
|
||||
if (NS_IsMainThread() &&
|
||||
!(aDecoder->GetDecoderFlags() & DecoderFlags::ASYNC_NOTIFY)) {
|
||||
aImage->FinalizeDecoder(aDecoder, finalStatus, metadata, telemetry, progress,
|
||||
invalidRect, frameCount, surfaceFlags);
|
||||
aImage->NotifyDecodeComplete(finalStatus, metadata, telemetry, progress,
|
||||
invalidRect, frameCount, surfaceFlags);
|
||||
return;
|
||||
}
|
||||
|
||||
// We're forced to notify asynchronously.
|
||||
NotNull<RefPtr<RasterImage>> image = aImage;
|
||||
NotNull<RefPtr<Decoder>> decoder = aDecoder;
|
||||
NS_DispatchToMainThread(NS_NewRunnableFunction([=]() -> void {
|
||||
image->FinalizeDecoder(decoder.get(), finalStatus, metadata, telemetry,
|
||||
progress, invalidRect, frameCount, surfaceFlags);
|
||||
image->NotifyDecodeComplete(finalStatus, metadata, telemetry, progress,
|
||||
invalidRect, frameCount, surfaceFlags);
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
@ -1562,21 +1562,19 @@ RasterImage::NotifyProgress(Progress aProgress,
|
|||
}
|
||||
|
||||
void
|
||||
RasterImage::FinalizeDecoder(Decoder* aDecoder,
|
||||
const DecoderFinalStatus& aStatus,
|
||||
const ImageMetadata& aMetadata,
|
||||
const DecoderTelemetry& aTelemetry,
|
||||
Progress aProgress,
|
||||
const IntRect& aInvalidRect,
|
||||
const Maybe<uint32_t>& aFrameCount,
|
||||
SurfaceFlags aSurfaceFlags)
|
||||
RasterImage::NotifyDecodeComplete(const DecoderFinalStatus& aStatus,
|
||||
const ImageMetadata& aMetadata,
|
||||
const DecoderTelemetry& aTelemetry,
|
||||
Progress aProgress,
|
||||
const IntRect& aInvalidRect,
|
||||
const Maybe<uint32_t>& aFrameCount,
|
||||
SurfaceFlags aSurfaceFlags)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aDecoder);
|
||||
|
||||
// If the decoder detected an error, log it to the error console.
|
||||
if (aStatus.mShouldReportError && !aStatus.mWasAborted) {
|
||||
ReportDecoderError(aDecoder);
|
||||
ReportDecoderError();
|
||||
}
|
||||
|
||||
// Record all the metadata the decoder gathered about this image.
|
||||
|
@ -1645,7 +1643,7 @@ RasterImage::FinalizeDecoder(Decoder* aDecoder,
|
|||
}
|
||||
|
||||
void
|
||||
RasterImage::ReportDecoderError(Decoder* aDecoder)
|
||||
RasterImage::ReportDecoderError()
|
||||
{
|
||||
nsCOMPtr<nsIConsoleService> consoleService =
|
||||
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
|
||||
|
|
|
@ -199,21 +199,33 @@ public:
|
|||
SurfaceFlags aSurfaceFlags = DefaultSurfaceFlags());
|
||||
|
||||
/**
|
||||
* Records telemetry and does final teardown of the provided decoder.
|
||||
* Records decoding results, sends out any final notifications, updates the
|
||||
* state of this image, and records telemetry.
|
||||
*
|
||||
* Main-thread only.
|
||||
*
|
||||
* @param aStatus Final status information about the decoder. (Whether it
|
||||
* encountered an error, etc.)
|
||||
* @param aMetadata Metadata about this image that the decoder gathered.
|
||||
* @param aTelemetry Telemetry data about the decoder.
|
||||
* @param aProgress Any final progress notifications to send.
|
||||
* @param aInvalidRect Any final invalidation rect to send.
|
||||
* @param aFrameCount If Some(), a final updated count of the number of frames
|
||||
* of animation the decoder has finished decoding so far.
|
||||
* This is a lower bound for the total number of animation
|
||||
* frames this image has.
|
||||
* @param aFlags The surface flags used by the decoder.
|
||||
*/
|
||||
void FinalizeDecoder(Decoder* aDecoder,
|
||||
const DecoderFinalStatus& aStatus,
|
||||
const ImageMetadata& aMetadata,
|
||||
const DecoderTelemetry& aTelemetry,
|
||||
Progress aProgress,
|
||||
const gfx::IntRect& aInvalidRect,
|
||||
const Maybe<uint32_t>& aFrameCount,
|
||||
SurfaceFlags aSurfaceFlags);
|
||||
void NotifyDecodeComplete(const DecoderFinalStatus& aStatus,
|
||||
const ImageMetadata& aMetadata,
|
||||
const DecoderTelemetry& aTelemetry,
|
||||
Progress aProgress,
|
||||
const gfx::IntRect& aInvalidRect,
|
||||
const Maybe<uint32_t>& aFrameCount,
|
||||
SurfaceFlags aSurfaceFlags);
|
||||
|
||||
// Helper method for FinalizeDecoder.
|
||||
void ReportDecoderError(Decoder* aDecoder);
|
||||
// Helper method for NotifyDecodeComplete.
|
||||
void ReportDecoderError();
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Загрузка…
Ссылка в новой задаче