mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 685516: Instead of decoding small images synchronously and large images asynchronously, always decode synchronously for some time, and post the remainder to the event loop if necessary. r=joe
This commit is contained in:
parent
24e472b6ab
commit
6937f09f99
@ -85,7 +85,6 @@ static PRLogModuleInfo *gCompressedImageAccountingLog = PR_NewLogModule ("Compre
|
||||
// Tweakable progressive decoding parameters
|
||||
static PRUint32 gDecodeBytesAtATime = 200000;
|
||||
static PRUint32 gMaxMSBeforeYield = 400;
|
||||
static PRUint32 gMaxBytesForSyncDecode = 150000;
|
||||
|
||||
void
|
||||
RasterImage::SetDecodeBytesAtATime(PRUint32 aBytesAtATime)
|
||||
@ -97,11 +96,6 @@ RasterImage::SetMaxMSBeforeYield(PRUint32 aMaxMS)
|
||||
{
|
||||
gMaxMSBeforeYield = aMaxMS;
|
||||
}
|
||||
void
|
||||
RasterImage::SetMaxBytesForSyncDecode(PRUint32 aMaxBytes)
|
||||
{
|
||||
gMaxBytesForSyncDecode = aMaxBytes;
|
||||
}
|
||||
|
||||
/* We define our own error checking macros here for 2 reasons:
|
||||
*
|
||||
@ -2386,13 +2380,12 @@ RasterImage::RequestDecode()
|
||||
if (mBytesDecoded == mSourceData.Length())
|
||||
return NS_OK;
|
||||
|
||||
// If it's a smallish image, it's not worth it to do things async
|
||||
if (!mDecoded && !mInDecoder && mHasSourceData && (mSourceData.Length() < gMaxBytesForSyncDecode))
|
||||
return SyncDecode();
|
||||
// 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)
|
||||
return mWorker->Run();
|
||||
|
||||
// If we get this far, dispatch the worker. We do this instead of starting
|
||||
// any immediate decoding to guarantee that all our decode notifications are
|
||||
// dispatched asynchronously, and to ensure we stay responsive.
|
||||
return mWorker->Dispatch();
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,6 @@
|
||||
#define DECODEONDRAW_PREF "image.mem.decodeondraw"
|
||||
#define BYTESATATIME_PREF "image.mem.decode_bytes_at_a_time"
|
||||
#define MAXMS_PREF "image.mem.max_ms_before_yield"
|
||||
#define MAXBYTESFORSYNC_PREF "image.mem.max_bytes_for_sync_decode"
|
||||
#define SVG_MIMETYPE "image/svg+xml"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -132,11 +131,6 @@ ReloadPrefs()
|
||||
RasterImage::SetMaxMSBeforeYield(maxMS);
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(Preferences::GetInt(MAXBYTESFORSYNC_PREF,
|
||||
&maxBytesForSync))) {
|
||||
RasterImage::SetMaxBytesForSyncDecode(maxBytesForSync);
|
||||
}
|
||||
|
||||
// Discard timeout
|
||||
mozilla::imagelib::DiscardTracker::ReloadTimeout();
|
||||
}
|
||||
|
@ -3276,9 +3276,6 @@ pref("image.mem.decode_bytes_at_a_time", 4096);
|
||||
// The longest time we can spend in an iteration of an async decode
|
||||
pref("image.mem.max_ms_before_yield", 5);
|
||||
|
||||
// The maximum source data size for which we auto sync decode
|
||||
pref("image.mem.max_bytes_for_sync_decode", 150000);
|
||||
|
||||
// WebGL prefs
|
||||
pref("webgl.force-enabled", false);
|
||||
pref("webgl.disabled", false);
|
||||
|
Loading…
Reference in New Issue
Block a user