зеркало из https://github.com/mozilla/gecko-dev.git
Bug 887466 - Rearrange SyncDecode so that we never try to finish a size decode with the decode lock held. r=seth
This commit is contained in:
Родитель
af6e9daaaa
Коммит
1b946f8566
|
@ -2325,26 +2325,8 @@ RasterImage::RequestDecodeCore(RequestDecodeType aDecodeType)
|
|||
nsresult
|
||||
RasterImage::SyncDecode()
|
||||
{
|
||||
MutexAutoLock imgLock(mDecodingMutex);
|
||||
|
||||
if (mDecodeRequest) {
|
||||
// If the image is waiting for decode work to be notified, go ahead and do that.
|
||||
if (mDecodeRequest->mRequestStatus == DecodeRequest::REQUEST_WORK_DONE) {
|
||||
nsresult rv = FinishedSomeDecoding();
|
||||
CONTAINER_ENSURE_SUCCESS(rv);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
PROFILER_LABEL_PRINTF("RasterImage", "SyncDecode", "%s", GetURIString().get());;
|
||||
|
||||
// We really have no good way of forcing a synchronous decode if we're being
|
||||
// called in a re-entrant manner (ie, from an event listener fired by a
|
||||
// decoder), because the decoding machinery is already tied up. We thus explicitly
|
||||
// disallow this type of call in the API, and check for it in API methods.
|
||||
NS_ABORT_IF_FALSE(!mInDecoder, "Yikes, forcing sync in reentrant call!");
|
||||
|
||||
// If we have a size decoder open, make sure we get the size
|
||||
if (mDecoder && mDecoder->IsSizeDecode()) {
|
||||
nsresult rv = DecodePool::Singleton()->DecodeUntilSizeAvailable(this);
|
||||
|
@ -2358,6 +2340,24 @@ RasterImage::SyncDecode()
|
|||
}
|
||||
}
|
||||
|
||||
MutexAutoLock imgLock(mDecodingMutex);
|
||||
|
||||
// We really have no good way of forcing a synchronous decode if we're being
|
||||
// called in a re-entrant manner (ie, from an event listener fired by a
|
||||
// decoder), because the decoding machinery is already tied up. We thus explicitly
|
||||
// disallow this type of call in the API, and check for it in API methods.
|
||||
NS_ABORT_IF_FALSE(!mInDecoder, "Yikes, forcing sync in reentrant call!");
|
||||
|
||||
if (mDecodeRequest) {
|
||||
// If the image is waiting for decode work to be notified, go ahead and do that.
|
||||
if (mDecodeRequest->mRequestStatus == DecodeRequest::REQUEST_WORK_DONE) {
|
||||
nsresult rv = FinishedSomeDecoding();
|
||||
CONTAINER_ENSURE_SUCCESS(rv);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
// If we're decoded already, or decoding until the size was available
|
||||
// finished us as a side-effect, no worries
|
||||
if (mDecoded)
|
||||
|
|
|
@ -642,9 +642,9 @@ private: // data
|
|||
nsRefPtr<Decoder> mDecoder;
|
||||
nsRefPtr<DecodeRequest> mDecodeRequest;
|
||||
uint32_t mBytesDecoded;
|
||||
// END LOCKED MEMBER VARIABLES
|
||||
|
||||
bool mInDecoder;
|
||||
// END LOCKED MEMBER VARIABLES
|
||||
|
||||
// Boolean flags (clustered together to conserve space):
|
||||
bool mHasSize:1; // Has SetSize() been called?
|
||||
|
|
Загрузка…
Ссылка в новой задаче