mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1207355 (Part 1) - Stop requesting decodes in nsDocument. r=tn
This commit is contained in:
parent
282655272a
commit
dac63f0f91
@ -343,7 +343,6 @@ pref("image.mem.surfacecache.max_size_kb", 131072); // 128MB
|
||||
pref("image.mem.surfacecache.size_factor", 8); // 1/8 of main memory
|
||||
pref("image.mem.surfacecache.discard_factor", 2); // Discard 1/2 of the surface cache at a time.
|
||||
pref("image.mem.surfacecache.min_expiration_ms", 86400000); // 24h, we rely on the out of memory hook
|
||||
pref("image.onload.decode.limit", 24); /* don't decode more than 24 images eagerly */
|
||||
|
||||
// XXX this isn't a good check for "are touch events supported", but
|
||||
// we don't really have a better one at the moment.
|
||||
|
@ -2117,9 +2117,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
|
||||
tmp->mInUnlinkOrDeletion = false;
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
static bool sPrefsInitialized = false;
|
||||
static uint32_t sOnloadDecodeLimit = 0;
|
||||
|
||||
nsresult
|
||||
nsDocument::Init()
|
||||
{
|
||||
@ -2127,11 +2124,6 @@ nsDocument::Init()
|
||||
return NS_ERROR_ALREADY_INITIALIZED;
|
||||
}
|
||||
|
||||
if (!sPrefsInitialized) {
|
||||
sPrefsInitialized = true;
|
||||
Preferences::AddUintVarCache(&sOnloadDecodeLimit, "image.onload.decode.limit", 0);
|
||||
}
|
||||
|
||||
// Force initialization.
|
||||
nsINode::nsSlots* slots = Slots();
|
||||
|
||||
@ -10522,12 +10514,8 @@ nsDocument::AddImage(imgIRequest* aImage)
|
||||
|
||||
// If this is the first insertion and we're locking images, lock this image
|
||||
// too.
|
||||
if (oldCount == 0) {
|
||||
if (mLockingImages)
|
||||
rv = aImage->LockImage();
|
||||
if (NS_SUCCEEDED(rv) && (!sOnloadDecodeLimit ||
|
||||
mImageTracker.Count() < sOnloadDecodeLimit))
|
||||
rv = aImage->StartDecoding();
|
||||
if (oldCount == 0 && mLockingImages) {
|
||||
rv = aImage->LockImage();
|
||||
}
|
||||
|
||||
// If this is the first insertion and we're animating images, request
|
||||
@ -10658,7 +10646,6 @@ PLDHashOperator LockEnumerator(imgIRequest* aKey,
|
||||
void* userArg)
|
||||
{
|
||||
aKey->LockImage();
|
||||
aKey->RequestDecode();
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
|
@ -168,6 +168,7 @@
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "nsCanvasFrame.h"
|
||||
#include "nsIImageLoadingContent.h"
|
||||
#include "nsImageFrame.h"
|
||||
#include "nsIScreen.h"
|
||||
#include "nsIScreenManager.h"
|
||||
#include "nsPlaceholderFrame.h"
|
||||
@ -10701,7 +10702,23 @@ nsresult
|
||||
PresShell::UpdateImageLockingState()
|
||||
{
|
||||
// We're locked if we're both thawed and active.
|
||||
return mDocument->SetImageLockingState(!mFrozen && mIsActive);
|
||||
bool locked = !mFrozen && mIsActive;
|
||||
|
||||
nsresult rv = mDocument->SetImageLockingState(locked);
|
||||
|
||||
if (locked) {
|
||||
// Request decodes for visible images; we want to start decoding as
|
||||
// quickly as possible when we get foregrounded to minimize flashing.
|
||||
for (auto iter = mVisibleImages.Iter(); !iter.Done(); iter.Next()) {
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(iter.Get()->GetKey());
|
||||
nsImageFrame* imageFrame = do_QueryFrame(content->GetPrimaryFrame());
|
||||
if (imageFrame) {
|
||||
imageFrame->MaybeDecodeForPredictedSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
PresShell*
|
||||
|
@ -230,6 +230,7 @@ protected:
|
||||
protected:
|
||||
friend class nsImageListener;
|
||||
friend class nsImageLoadingContent;
|
||||
friend class PresShell;
|
||||
|
||||
nsresult OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage);
|
||||
nsresult OnFrameUpdate(imgIRequest* aRequest, const nsIntRect* aRect);
|
||||
|
@ -4152,9 +4152,6 @@ pref("image.multithreaded_decoding.limit", -1);
|
||||
// cache.
|
||||
pref("canvas.image.cache.limit", 0);
|
||||
|
||||
// How many images to eagerly decode on a given page. 0 means "no limit".
|
||||
pref("image.onload.decode.limit", 0);
|
||||
|
||||
// WebGL prefs
|
||||
#ifdef ANDROID
|
||||
// Disable MSAA on mobile.
|
||||
|
Loading…
Reference in New Issue
Block a user