Bug 1438207 - Finalize the current frame of an ICO decoder correctly. r=tnikkel

Originally we attempted to finalize the current frame from the contained
decoder in nsICODecoder::FinishResource. This is wrong because we
haven't acquired the frame from the contained decoder yet. This happens
in nsICODecoder::GetFinalStateFromContainedDecoder, and so
imgFrame::Finalize call should be moved there. This was causing us to
use fallback image sharing with WebRender after a GPU process crash,
instead of shared surfaces, because it can't get a new file handle for
the surface data until we have finished writing all of the image data.
This commit is contained in:
Andrew Osmond 2018-02-16 06:27:36 -05:00
Родитель 09da568225
Коммит f6a1a2419b
1 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -100,6 +100,13 @@ nsICODecoder::GetFinalStateFromContainedDecoder()
mInvalidRect.UnionRect(mInvalidRect, mContainedDecoder->TakeInvalidRect());
mCurrentFrame = mContainedDecoder->GetCurrentFrameRef();
// Finalize the frame which we deferred to ensure we could modify the final
// result (e.g. to apply the BMP mask).
MOZ_ASSERT(!mContainedDecoder->GetFinalizeFrames());
if (mCurrentFrame) {
mCurrentFrame->FinalizeSurface();
}
// Propagate errors.
nsresult rv = HasError() || mContainedDecoder->HasError()
? NS_ERROR_FAILURE
@ -664,13 +671,6 @@ nsICODecoder::FinishResource()
MOZ_ASSERT_IF(mContainedDecoder->HasSize(),
mContainedDecoder->Size() == mDirEntry->mSize);
// Finalize the frame which we deferred to ensure we could modify the final
// result (e.g. to apply the BMP mask).
MOZ_ASSERT(!mContainedDecoder->GetFinalizeFrames());
if (mCurrentFrame) {
mCurrentFrame->FinalizeSurface();
}
return Transition::TerminateSuccess();
}