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

Unified Diff: src/gpu/GrResourceCache.h

Issue 2307053002: Restructure flushing relationship between GrContext, GrDrawingManager, and GrResourceCache. (Closed)
Patch Set: Fix uninit vars Created 4 years, 3 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/GrDrawingManager.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
diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h
index 6c64ddc9333a6ce8301698028abcb1f80206004a..bf7b237006b0fd270a1056744c130b5ce006be94 100644
--- a/src/gpu/GrResourceCache.h
+++ b/src/gpu/GrResourceCache.h
@@ -11,6 +11,7 @@
#include "GrGpuResource.h"
#include "GrGpuResourceCacheAccess.h"
#include "GrGpuResourcePriv.h"
+#include "GrResourceCache.h"
#include "GrResourceKey.h"
#include "SkMessageBus.h"
#include "SkRefCnt.h"
@@ -163,23 +164,16 @@ public:
/** Purges all resources that don't have external owners. */
void purgeAllUnlocked();
- /**
- * 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);
+ /** Returns true if the cache would like a flush to occur in order to make more resources
+ purgeable. */
+ bool requestsFlush() const { return fRequestFlush; }
- /**
- * 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();
+ enum FlushType {
+ kExternal,
+ kImmediateMode,
+ kCacheRequested,
+ };
+ void notifyFlushOccurred(FlushType);
#if GR_CACHE_STATS
struct Stats {
@@ -326,8 +320,7 @@ private:
int fBudgetedCount;
size_t fBudgetedBytes;
- PFOverBudgetCB fOverBudgetCB;
- void* fOverBudgetData;
+ bool fRequestFlush;
// 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.
« no previous file with comments | « src/gpu/GrDrawingManager.cpp ('k') | src/gpu/GrResourceCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698