Bug 1841599 - Remove unused canvas.image.cache.limit pref r=gregp,emilio

It is not used anywhere currently and was added >10 years ago.

Differential Revision: https://phabricator.services.mozilla.com/D182749
This commit is contained in:
CanadaHonk 2023-07-05 09:40:21 +00:00
parent c2e3ecef93
commit 23dda93894
2 changed files with 1 additions and 22 deletions

View File

@ -143,7 +143,6 @@ class ImageCache final : public nsExpirationTracker<ImageCacheEntryData, 4> {
~ImageCache();
virtual void NotifyExpired(ImageCacheEntryData* aObject) override {
mTotal -= aObject->SizeInBytes();
RemoveObject(aObject);
// Remove from the all canvas cache entry first since nsExpirationTracker
@ -158,7 +157,6 @@ class ImageCache final : public nsExpirationTracker<ImageCacheEntryData, 4> {
nsTHashtable<ImageCacheEntry> mCache;
nsTHashtable<AllCanvasImageCacheEntry> mAllCanvasCache;
size_t mTotal;
RefPtr<ImageCacheObserver> mImageCacheObserver;
};
@ -232,8 +230,7 @@ class CanvasImageCacheShutdownObserver final : public nsIObserver {
};
ImageCache::ImageCache()
: nsExpirationTracker<ImageCacheEntryData, 4>(GENERATION_MS, "ImageCache"),
mTotal(0) {
: nsExpirationTracker<ImageCacheEntryData, 4>(GENERATION_MS, "ImageCache") {
mImageCacheObserver = new ImageCacheObserver(this);
MOZ_RELEASE_ASSERT(mImageCacheObserver,
"GFX: Can't alloc ImageCacheObserver");
@ -295,7 +292,6 @@ void CanvasImageCache::NotifyDrawImage(Element* aImage,
if (entry) {
if (entry->mData->mSourceSurface) {
// We are overwriting an existing entry.
gImageCache->mTotal -= entry->mData->SizeInBytes();
gImageCache->RemoveObject(entry->mData.get());
gImageCache->mAllCanvasCache.RemoveEntry(allCanvasCacheKey);
}
@ -304,7 +300,6 @@ void CanvasImageCache::NotifyDrawImage(Element* aImage,
entry->mData->mSourceSurface = aSource;
entry->mData->mSize = aSize;
entry->mData->mIntrinsicSize = aIntrinsicSize;
gImageCache->mTotal += entry->mData->SizeInBytes();
AllCanvasImageCacheEntry* allEntry =
gImageCache->mAllCanvasCache.PutEntry(allCanvasCacheKey);
@ -312,16 +307,6 @@ void CanvasImageCache::NotifyDrawImage(Element* aImage,
allEntry->mSourceSurface = aSource;
}
}
if (!StaticPrefs::canvas_image_cache_limit()) {
return;
}
// Expire the image cache early if its larger than we want it to be.
while (gImageCache->mTotal >
size_t(StaticPrefs::canvas_image_cache_limit())) {
gImageCache->AgeOneGeneration();
}
}
SourceSurface* CanvasImageCache::LookupAllCanvas(Element* aImage,

View File

@ -1819,12 +1819,6 @@
# Prefs starting with "canvas."
#---------------------------------------------------------------------------
# Limit for the canvas image cache. 0 means unlimited.
- name: canvas.image.cache.limit
type: int32_t
value: 0
mirror: always
# Add support for canvas path objects
- name: canvas.path.enabled
type: RelaxedAtomicBool