Bug 1170877 - Track how many times the SurfaceCache has overflowed and report it in about:memory. r=dholbert

This commit is contained in:
Seth Fowler 2015-06-02 23:30:11 -07:00
parent 94baddf190
commit 8a75347288

View File

@ -393,6 +393,7 @@ public:
, mMaxCost(aSurfaceCacheSize)
, mAvailableCost(aSurfaceCacheSize)
, mLockedCost(0)
, mOverflowCount(0)
{
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (os) {
@ -430,6 +431,7 @@ public:
// If this is bigger than we can hold after discarding everything we can,
// refuse to cache it.
if (MOZ_UNLIKELY(!CanHoldAfterDiscarding(aCost))) {
mOverflowCount++;
return InsertOutcome::FAILURE;
}
@ -797,6 +799,14 @@ public:
"imagelib surface cache.");
NS_ENSURE_SUCCESS(rv, rv);
rv = MOZ_COLLECT_REPORT("imagelib-surface-cache-overflow-count",
KIND_OTHER, UNITS_COUNT,
mOverflowCount,
"Count of how many times the surface cache has hit "
"its capacity and been unable to insert a new "
"surface.");
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
@ -886,6 +896,7 @@ private:
const Cost mMaxCost;
Cost mAvailableCost;
Cost mLockedCost;
size_t mOverflowCount;
};
NS_IMPL_ISUPPORTS(SurfaceCacheImpl, nsIMemoryReporter)