Bug 1283967 - Remove unused function SurfaceCache::RemoveEntry(). r=dholbert

This commit is contained in:
Seth Fowler 2016-07-01 22:59:00 -06:00
parent 86430c09c8
commit d7bb652cf1
2 changed files with 21 additions and 50 deletions

View File

@ -655,22 +655,6 @@ public:
return LookupResult(Move(ref), matchType);
}
void RemoveEntry(const ImageKey aImageKey,
const SurfaceKey& aSurfaceKey)
{
RefPtr<ImageSurfaceCache> cache = GetImageCache(aImageKey);
if (!cache) {
return; // No cached surfaces for this image.
}
RefPtr<CachedSurface> 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<ImageSurfaceCache> cache = GetImageCache(aImageKey);
if (!cache) {
return; // No cached surfaces for this image.
}
RefPtr<CachedSurface> surface = cache->Lookup(aSurfaceKey);
if (!surface) {
return; // Lookup in the per-image cache missed.
}
Remove(surface);
}
struct SurfaceTracker : public nsExpirationTracker<CachedSurface, 2>
{
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)
{

View File

@ -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();