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

Unified Diff: src/gpu/GrGpuResourceCacheAccess.h

Issue 721353002: Allow GPU resources to not be counted against the cache budget. (Closed) Base URL: https://skia.googlesource.com/skia.git@wrap
Patch Set: fix constructor order 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/GrGpuResource.cpp ('k') | src/gpu/GrResourceCache2.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrGpuResourceCacheAccess.h
diff --git a/src/gpu/GrGpuResourceCacheAccess.h b/src/gpu/GrGpuResourceCacheAccess.h
index 7d20fff4732eb687fe87bc423c8aa5c2d0427496..c55bb0777494baa3a9508107baf55d79ee86c23d 100644
--- a/src/gpu/GrGpuResourceCacheAccess.h
+++ b/src/gpu/GrGpuResourceCacheAccess.h
@@ -29,6 +29,11 @@ public:
}
/**
+ * Changes whether the resource counts against the resource cache budget.
+ */
+ void setBudgeted(bool countsAgainstBudget) { fResource->setBudgeted(countsAgainstBudget); }
+
+ /**
* Is the resource currently cached as scratch? This means it has a valid scratch key and does
* not have a content key.
*/
@@ -48,15 +53,27 @@ public:
* If the resource is currently cached by a content key, the key is returned, otherwise NULL.
*/
const GrResourceKey* getContentKey() const {
- if (fResource->fContentKeySet) {
+ if (fResource->fFlags & GrGpuResource::kContentKeySet_Flag) {
return &fResource->fContentKey;
}
return NULL;
}
+ /**
+ * Is the resource object wrapping an externally allocated GPU resource?
+ */
bool isWrapped() const { return fResource->isWrapped(); }
/**
+ * Does the resource count against the resource budget?
+ */
+ bool isBudgeted() const {
+ bool ret = SkToBool(GrGpuResource::kBudgeted_Flag & fResource->fFlags);
+ SkASSERT(!(ret && fResource->isWrapped()));
+ return ret;
+ }
+
+ /**
* Called by the cache to delete the resource under normal circumstances.
*/
void release() {
« no previous file with comments | « src/gpu/GrGpuResource.cpp ('k') | src/gpu/GrResourceCache2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698