Bug 1187401 (Part 1) - Simplify the condition that determines whether we set RasterImage::mHasBeenDecoded. r=tn

This commit is contained in:
Seth Fowler 2015-08-18 10:19:22 -07:00
parent 6cfdfe6de8
commit ce0c257603
2 changed files with 6 additions and 16 deletions

View File

@ -197,7 +197,6 @@ public:
bool HasDecoderError() const { return NS_FAILED(mFailCode); }
bool ShouldReportError() const { return mShouldReportError; }
nsresult GetDecoderError() const { return mFailCode; }
void PostResizeError() { PostDataError(); }
/// Did we finish decoding enough that calling Decode() again would be useless?
bool GetDecodeDone() const
@ -206,10 +205,6 @@ public:
HasError() || mDataDone;
}
/// Did we finish decoding enough to set |RasterImage::mHasBeenDecoded|?
// XXX(seth): This will be removed in bug 1187401.
bool GetDecodeTotallyDone() const { return mDecodeDone && !IsMetadataDecode(); }
/// Are we in the middle of a frame right now? Used for assertions only.
bool InFrame() const { return mInFrame; }

View File

@ -1981,22 +1981,20 @@ RasterImage::FinalizeDecoder(Decoder* aDecoder)
MOZ_ASSERT(aDecoder->HasError() || !aDecoder->InFrame(),
"Finalizing a decoder in the middle of a frame");
bool wasMetadata = aDecoder->IsMetadataDecode();
bool done = aDecoder->GetDecodeDone();
// If the decoder detected an error, log it to the error console.
if (aDecoder->ShouldReportError() && !aDecoder->WasAborted()) {
ReportDecoderError(aDecoder);
}
// Record all the metadata the decoder gathered about this image.
nsresult rv = SetMetadata(aDecoder->GetImageMetadata(),
aDecoder->IsMetadataDecode());
if (NS_FAILED(rv)) {
aDecoder->PostResizeError();
}
SetMetadata(aDecoder->GetImageMetadata(), wasMetadata);
MOZ_ASSERT(mError || mHasSize || !aDecoder->HasSize(),
"Should have handed off size by now");
"SetMetadata should've gotten a size");
if (aDecoder->GetDecodeTotallyDone() && !mError) {
if (!wasMetadata && aDecoder->GetDecodeDone() && !aDecoder->WasAborted()) {
// Flag that we've been decoded before.
mHasBeenDecoded = true;
if (mAnim) {
@ -2009,9 +2007,6 @@ RasterImage::FinalizeDecoder(Decoder* aDecoder)
aDecoder->TakeInvalidRect(),
aDecoder->GetSurfaceFlags());
bool wasMetadata = aDecoder->IsMetadataDecode();
bool done = aDecoder->GetDecodeDone();
if (!wasMetadata && aDecoder->ChunkCount()) {
Telemetry::Accumulate(Telemetry::IMAGE_DECODE_CHUNKS,
aDecoder->ChunkCount());