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

Unified Diff: src/gpu/GrResourceCache.cpp

Issue 19482004: Alter resource cache and GrContext to (optionally) never reuse a scratch texture (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Disabled 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/GrResourceCache.h ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrResourceCache.cpp
===================================================================
--- src/gpu/GrResourceCache.cpp (revision 10175)
+++ src/gpu/GrResourceCache.cpp (working copy)
@@ -88,10 +88,10 @@
}
void GrResourceCache::getLimits(int* maxResources, size_t* maxResourceBytes) const{
- if (maxResources) {
+ if (NULL != maxResources) {
*maxResources = fMaxCount;
}
- if (maxResourceBytes) {
+ if (NULL != maxResourceBytes) {
*maxResourceBytes = fMaxBytes;
}
}
@@ -196,10 +196,6 @@
return entry->fResource;
}
-bool GrResourceCache::hasKey(const GrResourceKey& key) const {
- return NULL != fCache.find(key);
-}
-
void GrResourceCache::addResource(const GrResourceKey& key,
GrResource* resource,
uint32_t ownershipFlags) {
@@ -302,6 +298,17 @@
fPurging = false;
}
+void GrResourceCache::deleteResource(GrResourceEntry* entry) {
+ GrAssert(1 == entry->fResource->getRefCnt());
+
+ // remove from our cache
+ fCache.remove(entry->key(), entry);
+
+ // remove from our llist
+ this->internalDetach(entry);
+ delete entry;
+}
+
void GrResourceCache::internalPurge(int extraCount, size_t extraBytes) {
SkASSERT(fPurging);
@@ -333,13 +340,7 @@
GrResourceEntry* prev = iter.prev();
if (1 == entry->fResource->getRefCnt()) {
changed = true;
-
- // remove from our cache
- fCache.remove(entry->key(), entry);
-
- // remove from our llist
- this->internalDetach(entry);
- delete entry;
+ this->deleteResource(entry);
}
entry = prev;
}
« no previous file with comments | « src/gpu/GrResourceCache.h ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698