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

Unified Diff: src/gpu/GrContext.cpp

Issue 392333008: Make GrCacheable implement its own ref counting. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: int32_t Created 6 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
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 85cc8cd78750ebfdb150e0f8013df07139588c08..3c887cb42bb18c9e4eb87d4a9cd269f230ca8f48 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -528,17 +528,11 @@ void GrContext::addExistingTextureToCache(GrTexture* texture) {
// still be in the exclusive pile. Recycle it.
fResourceCache->makeNonExclusive(texture->getCacheEntry());
this->purgeCache();
- } else if (texture->getDeferredRefCount() <= 0) {
bsalomon 2014/07/21 20:14:46 I think this is safe because incDeferredRefCount()
+ } else {
// When we aren't reusing textures we know this scratch texture
// will never be reused and would be just wasting time in the cache
fResourceCache->makeNonExclusive(texture->getCacheEntry());
fResourceCache->deleteResource(texture->getCacheEntry());
- } else {
- // In this case (fDeferredRefCount > 0) but the cache is the only
- // one holding a real ref. Mark the object so when the deferred
- // ref count goes to 0 the texture will be deleted (remember
- // in this code path scratch textures aren't getting reused).
- texture->setNeedsDeferredUnref();
}
}
@@ -554,12 +548,6 @@ void GrContext::unlockScratchTexture(GrTexture* texture) {
if (fGpu->caps()->reuseScratchTextures() || NULL != texture->asRenderTarget()) {
fResourceCache->makeNonExclusive(texture->getCacheEntry());
this->purgeCache();
- } else if (texture->unique() && texture->getDeferredRefCount() <= 0) {
bsalomon 2014/07/21 20:14:46 I'm not sure I did the right thing here. Maybe I s
robertphillips 2014/07/21 20:53:05 I think we want to remove the check of deferred re
- // Only the cache now knows about this texture. Since we're never
- // reusing scratch textures (in this code path) it would just be
- // wasting time sitting in the cache.
- fResourceCache->makeNonExclusive(texture->getCacheEntry());
- fResourceCache->deleteResource(texture->getCacheEntry());
} else {
// In this case (fRefCnt > 1 || defRefCnt > 0) but we don't really
// want to readd it to the cache (since it will never be reused).

Powered by Google App Engine
This is Rietveld 408576698