mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 590252 - part 5 - Make RequestDecode() SyncDecode() on images that are small enough.r=joe,a=blocker
This commit is contained in:
parent
02d8f53c2f
commit
75637d22a2
@ -79,6 +79,7 @@ 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)
|
||||
@ -90,7 +91,11 @@ RasterImage::SetMaxMSBeforeYield(PRUint32 aMaxMS)
|
||||
{
|
||||
gMaxMSBeforeYield = aMaxMS;
|
||||
}
|
||||
|
||||
void
|
||||
RasterImage::SetMaxBytesForSyncDecode(PRUint32 aMaxBytes)
|
||||
{
|
||||
gMaxBytesForSyncDecode = aMaxBytes;
|
||||
}
|
||||
|
||||
/* We define our own error checking macros here for 2 reasons:
|
||||
*
|
||||
@ -2339,6 +2344,10 @@ 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 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.
|
||||
|
@ -293,6 +293,7 @@ public:
|
||||
// Progressive decoding knobs
|
||||
static void SetDecodeBytesAtATime(PRUint32 aBytesAtATime);
|
||||
static void SetMaxMSBeforeYield(PRUint32 aMaxMS);
|
||||
static void SetMaxBytesForSyncDecode(PRUint32 aMaxBytes);
|
||||
|
||||
private:
|
||||
struct Anim
|
||||
|
@ -89,6 +89,7 @@
|
||||
#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::imagelib;
|
||||
@ -121,13 +122,16 @@ ReloadPrefs(nsIPrefBranch *aBranch)
|
||||
gDecodeOnDraw = decodeondraw;
|
||||
|
||||
// Progressive decoding knobs
|
||||
PRInt32 bytesAtATime, maxMS;
|
||||
PRInt32 bytesAtATime, maxMS, maxBytesForSync;
|
||||
rv = aBranch->GetIntPref(BYTESATATIME_PREF, &bytesAtATime);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
RasterImage::SetDecodeBytesAtATime(bytesAtATime);
|
||||
rv = aBranch->GetIntPref(MAXMS_PREF, &maxMS);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
RasterImage::SetMaxMSBeforeYield(maxMS);
|
||||
rv = aBranch->GetIntPref(MAXBYTESFORSYNC_PREF, &maxBytesForSync);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
RasterImage::SetMaxBytesForSyncDecode(maxBytesForSync);
|
||||
|
||||
// Discard timeout
|
||||
mozilla::imagelib::DiscardTracker::ReloadTimeout();
|
||||
|
@ -3160,6 +3160,9 @@ pref("image.mem.decode_bytes_at_a_time", 200000);
|
||||
// The longest time we can spend in an iteration of an async decode
|
||||
pref("image.mem.max_ms_before_yield", 400);
|
||||
|
||||
// The maximum source data size for which we auto sync decode
|
||||
pref("image.mem.max_bytes_for_sync_decode", 150000);
|
||||
|
||||
// WebGL prefs
|
||||
pref("webgl.enabled_for_all_sites", false);
|
||||
pref("webgl.shader_validator", true);
|
||||
|
Loading…
Reference in New Issue
Block a user