diff --git a/image/SurfaceCache.cpp b/image/SurfaceCache.cpp index 1555c79b09f7..92c68b38553e 100644 --- a/image/SurfaceCache.cpp +++ b/image/SurfaceCache.cpp @@ -655,22 +655,6 @@ public: return LookupResult(Move(ref), matchType); } - void RemoveEntry(const ImageKey aImageKey, - const SurfaceKey& aSurfaceKey) - { - RefPtr cache = GetImageCache(aImageKey); - if (!cache) { - return; // No cached surfaces for this image. - } - - RefPtr surface = cache->Lookup(aSurfaceKey); - if (!surface) { - return; // Lookup in the per-image cache missed. - } - - Remove(surface); - } - bool CanHold(const Cost aCost) const { return aCost <= mMaxCost; @@ -877,6 +861,22 @@ private: } } + void RemoveEntry(const ImageKey aImageKey, + const SurfaceKey& aSurfaceKey) + { + RefPtr cache = GetImageCache(aImageKey); + if (!cache) { + return; // No cached surfaces for this image. + } + + RefPtr surface = cache->Lookup(aSurfaceKey); + if (!surface) { + return; // Lookup in the per-image cache missed. + } + + Remove(surface); + } + struct SurfaceTracker : public nsExpirationTracker { explicit SurfaceTracker(uint32_t aSurfaceCacheExpirationTimeMS) @@ -1095,16 +1095,6 @@ SurfaceCache::UnlockEntries(const ImageKey aImageKey) } } -/* static */ void -SurfaceCache::RemoveEntry(const ImageKey aImageKey, - const SurfaceKey& aSurfaceKey) -{ - if (sInstance) { - MutexAutoLock lock(sInstance->GetMutex()); - sInstance->RemoveEntry(aImageKey, aSurfaceKey); - } -} - /* static */ void SurfaceCache::RemoveImage(Image* aImageKey) { diff --git a/image/SurfaceCache.h b/image/SurfaceCache.h index afd48f3ad5e3..7c4b2395a0e9 100644 --- a/image/SurfaceCache.h +++ b/image/SurfaceCache.h @@ -269,9 +269,8 @@ struct SurfaceCache * directly. (They couldn't, since placeholders don't have an associated * surface.) * - * Once inserted, placeholders can be removed using RemoveEntry() or - * RemoveImage(), just like a real cache entry. They're automatically removed - * when a real entry that matches the placeholder is inserted with Insert(). + * Placeholders are automatically removed when a real entry that matches the + * placeholder is inserted with Insert(), or when RemoveImage() is called. * * @param aImageKey Key data identifying which image the cache entry * belongs to. @@ -317,9 +316,8 @@ struct SurfaceCache * until the next UnlockImage() or UnlockSurfaces() call for that image. Any * other cache entries owned by the image may expire at any time. * - * Regardless of locking, any of an image's cache entries may be removed using - * RemoveEntry(), and all of an image's cache entries are removed by - * RemoveImage(), whether the image is locked or not. + * All of an image's cache entries are removed by RemoveImage(), whether the + * image is locked or not. * * It's safe to call LockImage() on an image that's already locked; this has * no effect. @@ -365,22 +363,6 @@ struct SurfaceCache */ static void UnlockEntries(const ImageKey aImageKey); - /** - * Removes a cache entry (either a real or placeholder) from the cache, if - * it's present. If it's not present, RemoveEntry() has no effect. - * - * Use this function to remove individual cache entries that have become - * invalid. Prefer RemoveImage() or DiscardAll() when they're applicable, as - * they have much better performance than calling this function repeatedly. - * - * @param aImageKey Key data identifying which image the cache entry - * belongs to. - * @param aSurfaceKey Key data which uniquely identifies the requested - * cache entry. - */ - static void RemoveEntry(const ImageKey aImageKey, - const SurfaceKey& aSurfaceKey); - /** * Removes all cache entries (both real and placeholder) associated with the * given image from the cache. If the image is locked, it is automatically @@ -398,8 +380,7 @@ struct SurfaceCache * Evicts all evictable entries from the cache. * * All entries are evictable except for entries associated with locked images. - * Non-evictable entries can only be removed by RemoveEntry() or - * RemoveImage(). + * Non-evictable entries can only be removed by RemoveImage(). */ static void DiscardAll();