| Index: src/gpu/GrResourceCache.h
|
| diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h
|
| index bf7b237006b0fd270a1056744c130b5ce006be94..6c64ddc9333a6ce8301698028abcb1f80206004a 100644
|
| --- a/src/gpu/GrResourceCache.h
|
| +++ b/src/gpu/GrResourceCache.h
|
| @@ -11,7 +11,6 @@
|
| #include "GrGpuResource.h"
|
| #include "GrGpuResourceCacheAccess.h"
|
| #include "GrGpuResourcePriv.h"
|
| -#include "GrResourceCache.h"
|
| #include "GrResourceKey.h"
|
| #include "SkMessageBus.h"
|
| #include "SkRefCnt.h"
|
| @@ -164,16 +163,23 @@
|
| /** Purges all resources that don't have external owners. */
|
| void purgeAllUnlocked();
|
|
|
| - /** Returns true if the cache would like a flush to occur in order to make more resources
|
| - purgeable. */
|
| - bool requestsFlush() const { return fRequestFlush; }
|
| -
|
| - enum FlushType {
|
| - kExternal,
|
| - kImmediateMode,
|
| - kCacheRequested,
|
| - };
|
| - void notifyFlushOccurred(FlushType);
|
| + /**
|
| + * The callback function used by the cache when it is still over budget after a purge. The
|
| + * passed in 'data' is the same 'data' handed to setOverbudgetCallback.
|
| + */
|
| + typedef void (*PFOverBudgetCB)(void* data);
|
| +
|
| + /**
|
| + * 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. Note that the cache will attempt to purge
|
| + * any resources newly freed by the callback.
|
| + */
|
| + void setOverBudgetCallback(PFOverBudgetCB overBudgetCB, void* data) {
|
| + fOverBudgetCB = overBudgetCB;
|
| + fOverBudgetData = data;
|
| + }
|
| +
|
| + void notifyFlushOccurred();
|
|
|
| #if GR_CACHE_STATS
|
| struct Stats {
|
| @@ -320,7 +326,8 @@
|
| int fBudgetedCount;
|
| size_t fBudgetedBytes;
|
|
|
| - bool fRequestFlush;
|
| + PFOverBudgetCB fOverBudgetCB;
|
| + void* fOverBudgetData;
|
|
|
| // We keep track of the "timestamps" of the last n flushes. If a resource hasn't been used in
|
| // that time then we well preemptively purge it to reduce memory usage.
|
|
|