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

Unified Diff: src/gpu/GrTexture.cpp

Issue 608883003: GrResourceCache2 manages scratch texture. (Closed) Base URL: https://skia.googlesource.com/skia.git@surfimpl
Patch Set: fix and document hack Created 6 years, 2 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/GrTexture.cpp
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index e1188f961b110f63cdb7f9652eac9ff4c38994e1..36ed8232d7fe2861a4177682a824d22584177baf 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -21,27 +21,6 @@ GrTexture::~GrTexture() {
}
}
-/**
- * This method allows us to interrupt the normal deletion process and place
- * textures back in the texture cache when their ref count goes to zero.
- */
-void GrTexture::internal_dispose() const {
- if (this->texturePriv().isSetFlag((GrTextureFlags) GrTexture::kReturnToCache_FlagBit) &&
- this->INHERITED::getContext()) {
- GrTexture* nonConstThis = const_cast<GrTexture *>(this);
- this->ref(); // restore ref count to initial setting
-
- nonConstThis->texturePriv().resetFlag((GrTextureFlags) kReturnToCache_FlagBit);
- nonConstThis->INHERITED::getContext()->addExistingTextureToCache(nonConstThis);
-
- // Note: "this" texture might be freed inside addExistingTextureToCache
- // if it is purged.
- return;
- }
-
- this->INHERITED::internal_dispose();
-}
-
void GrTexture::dirtyMipMaps(bool mipMapsDirty) {
if (mipMapsDirty) {
if (kValid_MipMapsStatus == fMipMapsStatus) {
@@ -102,27 +81,12 @@ void GrTexture::writePixels(int left, int top, int width, int height,
pixelOpsFlags);
}
-void GrTexture::abandonReleaseCommon() {
- // In debug builds the resource cache tracks removed/exclusive textures and has an unref'ed ptr.
- // After abandon() or release() the resource cache will be unreachable (getContext() == NULL).
- // So we readd the texture to the cache here so that it is removed from the exclusive list and
- // there is no longer an unref'ed ptr to the texture in the cache.
- if (this->texturePriv().isSetFlag((GrTextureFlags)kReturnToCache_FlagBit)) {
- SkASSERT(!this->wasDestroyed());
- this->ref(); // restores the ref the resource cache gave up when it marked this exclusive.
- this->texturePriv().resetFlag((GrTextureFlags) kReturnToCache_FlagBit);
- this->getContext()->addExistingTextureToCache(this);
- }
-}
-
void GrTexture::onRelease() {
- this->abandonReleaseCommon();
SkASSERT(!this->texturePriv().isSetFlag((GrTextureFlags) kReturnToCache_FlagBit));
INHERITED::onRelease();
}
void GrTexture::onAbandon() {
- this->abandonReleaseCommon();
if (fRenderTarget.get()) {
fRenderTarget->abandon();
}

Powered by Google App Engine
This is Rietveld 408576698