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

Unified Diff: src/gpu/GrResourceCache.cpp

Issue 1623653002: skia: Add support for CHROMIUM_image backed textures. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Comments from bsalomon, round four. Created 4 years, 11 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
Index: src/gpu/GrResourceCache.cpp
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index 4a0c9b2b369bbc12cb4254dedeaae16b929454d6..2abe7e93530af2ad858890f77c741e62751ba980 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -375,25 +375,27 @@ void GrResourceCache::notifyCntReachedZero(GrGpuResource* resource, uint32_t fla
this->removeFromNonpurgeableArray(resource);
fPurgeableQueue.insert(resource);
- if (!resource->resourcePriv().isBudgeted()) {
- // Check whether this resource could still be used as a scratch resource.
- if (!resource->cacheAccess().isExternal() &&
- resource->resourcePriv().getScratchKey().isValid()) {
- // We won't purge an existing resource to make room for this one.
- if (fBudgetedCount < fMaxCount &&
- fBudgetedBytes + resource->gpuMemorySize() <= fMaxBytes) {
- resource->resourcePriv().makeBudgeted();
+ if (resource->reuseable()) {
+ if (!resource->resourcePriv().isBudgeted()) {
+ // Check whether this resource could still be used as a scratch resource.
+ if (!resource->cacheAccess().isExternal() &&
+ resource->resourcePriv().getScratchKey().isValid()) {
+ // We won't purge an existing resource to make room for this one.
+ if (fBudgetedCount < fMaxCount &&
+ fBudgetedBytes + resource->gpuMemorySize() <= fMaxBytes) {
+ resource->resourcePriv().makeBudgeted();
+ return;
+ }
+ }
+ } else {
+ // Purge the resource immediately if we're over budget
+ // Also purge if the resource has neither a valid scratch key nor a unique key.
+ bool noKey = !resource->resourcePriv().getScratchKey().isValid() &&
+ !resource->getUniqueKey().isValid();
+ if (!this->overBudget() && !noKey) {
return;
}
}
- } else {
- // Purge the resource immediately if we're over budget
- // Also purge if the resource has neither a valid scratch key nor a unique key.
- bool noKey = !resource->resourcePriv().getScratchKey().isValid() &&
- !resource->getUniqueKey().isValid();
- if (!this->overBudget() && !noKey) {
- return;
- }
}
SkDEBUGCODE(int beforeCount = this->getResourceCount();)

Powered by Google App Engine
This is Rietveld 408576698