Bug 1183836 - Remove support for decode-on-draw-only. r=tn

This commit is contained in:
Seth Fowler 2015-07-14 18:16:31 -07:00
Родитель 6ce89615f9
Коммит 9391045db4
8 изменённых файлов: 12 добавлений и 64 удалений

Просмотреть файл

@ -333,7 +333,6 @@ pref("media.video-queue.default-size", 3);
// optimize images' memory usage
pref("image.downscale-during-decode.enabled", true);
pref("image.decode-only-on-draw.enabled", false);
pref("image.mem.allow_locking_in_content_processes", true);
pref("image.decode.retry-on-alloc-failure", true);
// Limit the surface cache to 1/8 of main memory or 128MB, whichever is smaller.

Просмотреть файл

@ -259,7 +259,6 @@ private:
DECL_GFX_PREF(Once, "image.cache.size", ImageCacheSize, int32_t, 5*1024*1024);
DECL_GFX_PREF(Once, "image.cache.timeweight", ImageCacheTimeWeight, int32_t, 500);
DECL_GFX_PREF(Live, "image.decode-only-on-draw.enabled", ImageDecodeOnlyOnDrawEnabled, bool, false);
DECL_GFX_PREF(Live, "image.decode-immediately.enabled", ImageDecodeImmediatelyEnabled, bool, false);
DECL_GFX_PREF(Once, "image.decode.retry-on-alloc-failure", ImageDecodeRetryOnAllocFailure, bool, false);
DECL_GFX_PREF(Live, "image.downscale-during-decode.enabled", ImageDownscaleDuringDecodeEnabled, bool, true);

Просмотреть файл

@ -150,9 +150,6 @@ public:
*
* INIT_FLAG_DISCARDABLE: The container should be discardable
*
* INIT_FLAG_DECODE_ONLY_ON_DRAW: The container should decode on draw rather
* than possibly being speculatively decoded earlier.
*
* INIT_FLAG_DECODE_IMMEDIATELY: The container should decode as soon as
* possible, regardless of what our heuristics say.
*
@ -171,11 +168,10 @@ public:
*/
static const uint32_t INIT_FLAG_NONE = 0x0;
static const uint32_t INIT_FLAG_DISCARDABLE = 0x1;
static const uint32_t INIT_FLAG_DECODE_ONLY_ON_DRAW = 0x2;
static const uint32_t INIT_FLAG_DECODE_IMMEDIATELY = 0x4;
static const uint32_t INIT_FLAG_TRANSIENT = 0x8;
static const uint32_t INIT_FLAG_DOWNSCALE_DURING_DECODE = 0x10;
static const uint32_t INIT_FLAG_SYNC_LOAD = 0x20;
static const uint32_t INIT_FLAG_DECODE_IMMEDIATELY = 0x2;
static const uint32_t INIT_FLAG_TRANSIENT = 0x4;
static const uint32_t INIT_FLAG_DOWNSCALE_DURING_DECODE = 0x8;
static const uint32_t INIT_FLAG_SYNC_LOAD = 0x10;
virtual already_AddRefed<ProgressTracker> GetProgressTracker() = 0;
virtual void SetProgressTracker(ProgressTracker* aProgressTracker) {}

Просмотреть файл

@ -50,45 +50,30 @@ ComputeImageFlags(ImageURL* uri, const nsCString& aMimeType, bool isMultiPart)
bool doDecodeImmediately = gfxPrefs::ImageDecodeImmediatelyEnabled();
bool doDownscaleDuringDecode = gfxPrefs::ImageDownscaleDuringDecodeEnabled();
// We use the platform APZ value here since we don't have a widget to test.
// It's safe since this is an optimization, and
// ImageDecodeOnlyOnDraw is disabled everywhere and will be removed soon.
bool doDecodeOnlyOnDraw = gfxPrefs::ImageDecodeOnlyOnDrawEnabled() &&
gfxPlatform::AsyncPanZoomEnabled();
// We want UI to be as snappy as possible and not to flicker. Disable
// discarding and decode-only-on-draw for chrome URLS.
// discarding for chrome URLS.
bool isChrome = false;
rv = uri->SchemeIs("chrome", &isChrome);
if (NS_SUCCEEDED(rv) && isChrome) {
isDiscardable = doDecodeOnlyOnDraw = false;
isDiscardable = false;
}
// We don't want resources like the "loading" icon to be discardable or
// decode-only-on-draw either.
// We don't want resources like the "loading" icon to be discardable either.
bool isResource = false;
rv = uri->SchemeIs("resource", &isResource);
if (NS_SUCCEEDED(rv) && isResource) {
isDiscardable = doDecodeOnlyOnDraw = false;
isDiscardable = false;
}
// Downscale-during-decode and decode-only-on-draw are only enabled for
// certain content types.
if ((doDownscaleDuringDecode || doDecodeOnlyOnDraw) &&
!ShouldDownscaleDuringDecode(aMimeType)) {
// Downscale-during-decode is only enabled for certain content types.
if (doDownscaleDuringDecode && !ShouldDownscaleDuringDecode(aMimeType)) {
doDownscaleDuringDecode = false;
doDecodeOnlyOnDraw = false;
}
// If we're decoding immediately, disable decode-only-on-draw.
if (doDecodeImmediately) {
doDecodeOnlyOnDraw = false;
}
// For multipart/x-mixed-replace, we basically want a direct channel to the
// decoder. Disable everything for this case.
if (isMultiPart) {
isDiscardable = doDecodeOnlyOnDraw = doDownscaleDuringDecode = false;
isDiscardable = doDownscaleDuringDecode = false;
}
// We have all the information we need.
@ -96,9 +81,6 @@ ComputeImageFlags(ImageURL* uri, const nsCString& aMimeType, bool isMultiPart)
if (isDiscardable) {
imageFlags |= Image::INIT_FLAG_DISCARDABLE;
}
if (doDecodeOnlyOnDraw) {
imageFlags |= Image::INIT_FLAG_DECODE_ONLY_ON_DRAW;
}
if (doDecodeImmediately) {
imageFlags |= Image::INIT_FLAG_DECODE_IMMEDIATELY;
}

Просмотреть файл

@ -265,7 +265,6 @@ RasterImage::RasterImage(ImageURL* aURI /* = nullptr */) :
mFrameCount(0),
mRetryCount(0),
mHasSize(false),
mDecodeOnlyOnDraw(false),
mTransient(false),
mSyncLoad(false),
mDiscardable(false),
@ -308,18 +307,15 @@ RasterImage::Init(const char* aMimeType,
NS_ENSURE_ARG_POINTER(aMimeType);
// We must be non-discardable and non-decode-only-on-draw for
// transient images.
// We want to avoid redecodes for transient images.
MOZ_ASSERT(!(aFlags & INIT_FLAG_TRANSIENT) ||
(!(aFlags & INIT_FLAG_DISCARDABLE) &&
!(aFlags & INIT_FLAG_DECODE_ONLY_ON_DRAW) &&
!(aFlags & INIT_FLAG_DOWNSCALE_DURING_DECODE)),
"Illegal init flags for transient image");
// Store initialization data
mSourceDataMimeType.Assign(aMimeType);
mDiscardable = !!(aFlags & INIT_FLAG_DISCARDABLE);
mDecodeOnlyOnDraw = !!(aFlags & INIT_FLAG_DECODE_ONLY_ON_DRAW);
mWantFullDecode = !!(aFlags & INIT_FLAG_DECODE_IMMEDIATELY);
mTransient = !!(aFlags & INIT_FLAG_TRANSIENT);
mDownscaleDuringDecode = !!(aFlags & INIT_FLAG_DOWNSCALE_DURING_DECODE);
@ -1260,13 +1256,6 @@ RasterImage::NotifyForLoadEvent(Progress aProgress)
(mProgressTracker->GetProgress() & FLAG_SIZE_AVAILABLE),
"Should have notified that the size is available if we have it");
if (mDecodeOnlyOnDraw) {
// For decode-only-on-draw images, we want to send notifications as if we've
// already finished decoding. Otherwise some observers will never even try
// to draw.
aProgress |= FLAG_FRAME_COMPLETE | FLAG_DECODE_COMPLETE;
}
// If we encountered an error, make sure we notify for that as well.
if (mError) {
aProgress |= FLAG_HAS_ERROR;
@ -1538,11 +1527,6 @@ RasterImage::CreateDecoder(const Maybe<IntSize>& aSize, uint32_t aFlags)
NS_IMETHODIMP
RasterImage::RequestDecode()
{
// For decode-only-on-draw images, we only act on RequestDecodeForSize.
if (mDecodeOnlyOnDraw) {
return NS_OK;
}
return RequestDecodeForSize(mSize, DECODE_FLAGS_DEFAULT);
}
@ -1550,11 +1534,6 @@ RasterImage::RequestDecode()
NS_IMETHODIMP
RasterImage::StartDecoding()
{
// For decode-only-on-draw images, we only act on RequestDecodeForSize.
if (mDecodeOnlyOnDraw) {
return NS_OK;
}
return RequestDecodeForSize(mSize, FLAG_SYNC_DECODE_IF_FAST);
}

Просмотреть файл

@ -412,7 +412,6 @@ private: // data
// Boolean flags (clustered together to conserve space):
bool mHasSize:1; // Has SetSize() been called?
bool mDecodeOnlyOnDraw:1; // Decoding only on draw?
bool mTransient:1; // Is the image short-lived?
bool mSyncLoad:1; // Are we loading synchronously?
bool mDiscardable:1; // Is container discardable?

Просмотреть файл

@ -599,7 +599,6 @@ pref("media.mediasource.enabled", true);
// optimize images memory usage
pref("image.downscale-during-decode.enabled", true);
pref("image.decode-only-on-draw.enabled", false);
#ifdef NIGHTLY_BUILD
// Shumway component (SWF player) is disabled by default. Also see bug 904346.

Просмотреть файл

@ -4023,12 +4023,7 @@ pref("image.cache.size", 5242880);
// Size is given a weight of 1000 - timeweight.
pref("image.cache.timeweight", 500);
// Prevents images from automatically being decoded on load, instead allowing
// them to be decoded on demand when they are drawn.
pref("image.decode-only-on-draw.enabled", false);
// Decode all images automatically on load, ignoring our normal heuristics.
// Overrides image.decode-only-on-draw.enabled.
pref("image.decode-immediately.enabled", false);
// Whether we attempt to downscale images during decoding.