Bug 868871 - Don't do any invalidation from under RasterImage::GetImageContainer(), which is called while painting. r=seth

This commit is contained in:
Joe Drew 2013-05-09 09:36:57 -04:00
parent 41a6f98b20
commit 8ddd13e205
2 changed files with 8 additions and 6 deletions

View File

@ -1064,7 +1064,7 @@ RasterImage::GetCurrentImage()
if (!mDecoded) {
// We can't call StartDecoding because that can synchronously notify
// which can cause DOM modification
RequestDecode();
RequestDecodeCore(ASYNCHRONOUS);
return nullptr;
}
@ -2727,14 +2727,14 @@ RasterImage::WantDecodedFrames()
NS_IMETHODIMP
RasterImage::RequestDecode()
{
return RequestDecodeCore(ASYNCHRONOUS);
return RequestDecodeCore(SYNCHRONOUS_NOTIFY);
}
/* void startDecode() */
NS_IMETHODIMP
RasterImage::StartDecoding()
{
return RequestDecodeCore(SOMEWHAT_SYNCHRONOUS);
return RequestDecodeCore(SYNCHRONOUS_NOTIFY_AND_SOME_DECODE);
}
@ -2791,7 +2791,8 @@ RasterImage::RequestDecodeCore(RequestDecodeType aDecodeType)
// If the image is waiting for decode work to be notified, go ahead and do that.
if (mDecodeRequest &&
mDecodeRequest->mRequestStatus == DecodeRequest::REQUEST_WORK_DONE) {
mDecodeRequest->mRequestStatus == DecodeRequest::REQUEST_WORK_DONE &&
aDecodeType != ASYNCHRONOUS) {
nsresult rv = FinishedSomeDecoding();
CONTAINER_ENSURE_SUCCESS(rv);
}
@ -2835,7 +2836,7 @@ RasterImage::RequestDecodeCore(RequestDecodeType aDecodeType)
// If we can do decoding now, do so. Small images will decode completely,
// large images will decode a bit and post themselves to the event loop
// to finish decoding.
if (!mDecoded && !mInDecoder && mHasSourceData && aDecodeType == SOMEWHAT_SYNCHRONOUS) {
if (!mDecoded && !mInDecoder && mHasSourceData && aDecodeType == SYNCHRONOUS_NOTIFY_AND_SOME_DECODE) {
PROFILER_LABEL_PRINTF("RasterImage", "DecodeABitOf", "%s", GetURIString().get());
mDecoder->SetSynchronous(true);

View File

@ -712,7 +712,8 @@ private:
bool IsInUpdateImageContainer() { return mInUpdateImageContainer; }
enum RequestDecodeType {
ASYNCHRONOUS,
SOMEWHAT_SYNCHRONOUS
SYNCHRONOUS_NOTIFY,
SYNCHRONOUS_NOTIFY_AND_SOME_DECODE
};
NS_IMETHOD RequestDecodeCore(RequestDecodeType aDecodeType);