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

Unified Diff: src/gpu/GrResourceCache2.h

Issue 720033004: Correct accounting for wrapped resources (Closed) Base URL: https://skia.googlesource.com/skia.git@res2
Patch Set: rebase again Created 6 years, 1 month 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/GrGpuResourceCacheAccess.h ('k') | src/gpu/GrResourceCache2.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrResourceCache2.h
diff --git a/src/gpu/GrResourceCache2.h b/src/gpu/GrResourceCache2.h
index 805d359eb4e0061f9a7177ec2b759b5f426959e2..b0394e3c63352f2bc7263c14ac7dc4a2184e7edc 100644
--- a/src/gpu/GrResourceCache2.h
+++ b/src/gpu/GrResourceCache2.h
@@ -47,16 +47,26 @@ public:
void setLimits(int count, size_t bytes);
/**
- * Returns the number of cached resources.
+ * Returns the number of resources.
*/
int getResourceCount() const { return fCount; }
/**
- * Returns the number of bytes consumed by cached resources.
+ * Returns the number of resources that count against the budget.
+ */
+ int getBudgetedResourceCount() const { return fBudgetedCount; }
+
+ /**
+ * Returns the number of bytes consumed by resources.
*/
size_t getResourceBytes() const { return fBytes; }
/**
+ * Returns the number of bytes consumed by budgeted resources.
+ */
+ size_t getBudgetedResourceBytes() const { return fBudgetedBytes; }
+
+ /**
* Returns the cached resources count budget.
*/
int getMaxResourceCount() const { return fMaxCount; }
@@ -155,7 +165,7 @@ private:
/// @}
void purgeAsNeeded() {
- if (fPurging || (fCount <= fMaxCount && fBytes < fMaxBytes)) {
+ if (fPurging || (fBudgetedCount <= fMaxCount && fBudgetedBytes < fMaxBytes)) {
return;
}
this->internalPurgeAsNeeded();
@@ -207,12 +217,18 @@ private:
#if GR_CACHE_STATS
int fHighWaterCount;
size_t fHighWaterBytes;
+ int fBudgetedHighWaterCount;
+ size_t fBudgetedHighWaterBytes;
#endif
- // our current stats, related to our budget
+ // our current stats for all resources
int fCount;
size_t fBytes;
+ // our current stats for resources that count against the budget
+ int fBudgetedCount;
+ size_t fBudgetedBytes;
+
// prevents recursive purging
bool fPurging;
bool fNewlyPurgableResourceWhilePurging;
« no previous file with comments | « src/gpu/GrGpuResourceCacheAccess.h ('k') | src/gpu/GrResourceCache2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698