Chromium Code Reviews| Index: src/gpu/GrResourceCache.h | 
| =================================================================== | 
| --- src/gpu/GrResourceCache.h (revision 9928) | 
| +++ src/gpu/GrResourceCache.h (working copy) | 
| @@ -238,6 +238,17 @@ | 
| void setLimits(int maxResource, size_t maxResourceBytes); | 
| /** | 
| + * Set the callback the cache should use when it is still over budget | 
| + * after a purge. The 'data' provided here will be passed back to the | 
| + * callback. | 
| 
 
bsalomon
2013/07/09 17:43:25
Maybe mention that the cache will attempt to purge
 
robertphillips
2013/07/10 10:15:13
Done.
I expanded the comment and made the CB now
 
 | 
| + */ | 
| + typedef void (*PFOverbudgetCB)(void* data); | 
| + void setOverbudgetCallback(PFOverbudgetCB overbudgetCB, void* data) { | 
| + fOverbudgetCB = overbudgetCB; | 
| + fOverbudgetData = data; | 
| + } | 
| + | 
| + /** | 
| * Returns the number of bytes consumed by cached resources. | 
| */ | 
| size_t getCachedResourceBytes() const { return fEntryBytes; } | 
| @@ -360,8 +371,13 @@ | 
| size_t fClientDetachedBytes; | 
| // prevents recursive purging | 
| - bool fPurging; | 
| + bool fPurging; | 
| + PFOverbudgetCB fOverbudgetCB; | 
| + void* fOverbudgetData; | 
| + | 
| + void internalPurge(); | 
| + | 
| #if GR_DEBUG | 
| static size_t countBytes(const SkTInternalLList<GrResourceEntry>& list); | 
| #endif |