Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Unified Diff: src/gpu/GrResourceCache.h

Issue 18466005: Allow the resource cache to (indirectly) flush the InOrderDrawBuffer (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Addressed code review issues Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrResourceCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrResourceCache.h
===================================================================
--- src/gpu/GrResourceCache.h (revision 9928)
+++ src/gpu/GrResourceCache.h (working copy)
@@ -238,6 +238,25 @@
void setLimits(int maxResource, size_t maxResourceBytes);
/**
+ * 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. The callback returns true if some resources
+ * have been freed.
+ */
+ typedef bool (*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. The cache will attempt to purge any resources newly freed
+ * by the callback.
+ */
+ 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 +379,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
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrResourceCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698