| Index: src/gpu/GrResourceCache.h | 
| diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h | 
| index 2412174121e55422a787eb468622679f2bd119f7..ed2affeae38ae8608fbe58018fa28a7a022ea3fe 100644 | 
| --- a/src/gpu/GrResourceCache.h | 
| +++ b/src/gpu/GrResourceCache.h | 
| @@ -182,7 +182,52 @@ public: | 
|  | 
| void notifyFlushOccurred(); | 
|  | 
| -#if GR_GPU_STATS | 
| +#if GR_CACHE_STATS | 
| +    struct Stats { | 
| +        int fTotal; | 
| +        int fNumPurgeable; | 
| +        int fNumNonPurgeable; | 
| + | 
| +        int fScratch; | 
| +        int fExternal; | 
| +        int fBorrowed; | 
| +        int fAdopted; | 
| +        size_t fUnbudgetedSize; | 
| + | 
| +        Stats() { this->reset(); } | 
| + | 
| +        void reset() { | 
| +            fTotal = 0; | 
| +            fNumPurgeable = 0; | 
| +            fNumNonPurgeable = 0; | 
| +            fScratch = 0; | 
| +            fExternal = 0; | 
| +            fBorrowed = 0; | 
| +            fAdopted = 0; | 
| +            fUnbudgetedSize = 0; | 
| +        } | 
| + | 
| +        void update(GrGpuResource* resource) { | 
| +            if (resource->cacheAccess().isScratch()) { | 
| +                ++fScratch; | 
| +            } | 
| +            if (resource->cacheAccess().isExternal()) { | 
| +                ++fExternal; | 
| +            } | 
| +            if (resource->cacheAccess().isBorrowed()) { | 
| +                ++fBorrowed; | 
| +            } | 
| +            if (resource->cacheAccess().isAdopted()) { | 
| +                ++fAdopted; | 
| +            } | 
| +            if (!resource->resourcePriv().isBudgeted()) { | 
| +                fUnbudgetedSize += resource->gpuMemorySize(); | 
| +            } | 
| +        } | 
| +    }; | 
| + | 
| +    void getStats(Stats*) const; | 
| + | 
| void dumpStats(SkString*) const; | 
| #endif | 
|  | 
|  |