зеркало из https://github.com/mozilla/gecko-dev.git
Back out b4decc9b812f (bug 721510) because of frequent Mac reftest failures on a CLOSED TREE
This commit is contained in:
Родитель
628673af7b
Коммит
efa9687ca2
|
@ -2969,9 +2969,9 @@ RasterImage::DecodeWorker::DecodeSomeOfImage(
|
|||
if (aImg->mError)
|
||||
return NS_OK;
|
||||
|
||||
// If mDecoded or we don't have a decoder, we must have finished already (for
|
||||
// example, a synchronous decode request came while the worker was pending).
|
||||
if (!aImg->mDecoder || aImg->mDecoded)
|
||||
// If we don't have a decoder, we must have finished already (for example,
|
||||
// a synchronous decode request came while the worker was pending).
|
||||
if (!aImg->mDecoder)
|
||||
return NS_OK;
|
||||
|
||||
nsRefPtr<Decoder> decoderKungFuDeathGrip = aImg->mDecoder;
|
||||
|
@ -2988,12 +2988,21 @@ RasterImage::DecodeWorker::DecodeSomeOfImage(
|
|||
maxBytes = gDecodeBytesAtATime;
|
||||
}
|
||||
|
||||
// Loop control
|
||||
PRInt32 chunkCount = 0;
|
||||
TimeStamp start = TimeStamp::Now();
|
||||
TimeStamp deadline = start + TimeDuration::FromMilliseconds(gMaxMSBeforeYield);
|
||||
|
||||
// Decode some chunks of data.
|
||||
do {
|
||||
// We keep decoding chunks until one of events occurs:
|
||||
// 1) We don't have any data left to decode
|
||||
// 2) The decode completes
|
||||
// 3) We're an UNTIL_SIZE decode and we get the size
|
||||
// 4) We hit the deadline and yield to keep the UI snappy
|
||||
while (aImg->mSourceData.Length() > aImg->mBytesDecoded &&
|
||||
!aImg->IsDecodeFinished() &&
|
||||
TimeStamp::Now() < deadline) {
|
||||
|
||||
// Decode a chunk of data.
|
||||
chunkCount++;
|
||||
nsresult rv = aImg->DecodeSomeData(maxBytes);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -3001,18 +3010,11 @@ RasterImage::DecodeWorker::DecodeSomeOfImage(
|
|||
return rv;
|
||||
}
|
||||
|
||||
// We keep decoding chunks until either:
|
||||
// * we're an UNTIL_SIZE decode and we get the size,
|
||||
// * we don't have any data left to decode,
|
||||
// * the decode completes, or
|
||||
// * we run out of time.
|
||||
|
||||
// If we're an UNTIL_SIZE decode and we got the image's size, we're done
|
||||
// here.
|
||||
if (aDecodeType == DECODE_TYPE_UNTIL_SIZE && aImg->mHasSize)
|
||||
break;
|
||||
}
|
||||
while (aImg->mSourceData.Length() > aImg->mBytesDecoded &&
|
||||
!aImg->IsDecodeFinished() &&
|
||||
TimeStamp::Now() < deadline);
|
||||
|
||||
aImg->mDecodeRequest.mDecodeTime += (TimeStamp::Now() - start);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче