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

Unified Diff: src/gpu/GrTexture.cpp

Issue 608883003: GrResourceCache2 manages scratch texture. (Closed) Base URL: https://skia.googlesource.com/skia.git@surfimpl
Patch Set: remove todo 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
« no previous file with comments | « src/gpu/GrResourceCache2.cpp ('k') | src/gpu/GrTextureAccess.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTexture.cpp
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index e1188f961b110f63cdb7f9652eac9ff4c38994e1..aac91c585844f52dcc94c28ff8702d27811113ce 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();
}
@@ -187,11 +151,6 @@ GrResourceKey::ResourceFlags get_texture_flags(const GrGpu* gpu,
return flags;
}
-GrResourceKey::ResourceType texture_resource_type() {
- static const GrResourceKey::ResourceType gType = GrResourceKey::GenerateResourceType();
- return gType;
-}
-
// FIXME: This should be refactored with the code in gl/GrGpuGL.cpp.
GrSurfaceOrigin resolve_origin(const GrTextureDesc& desc) {
// By default, GrRenderTargets are GL's normal orientation so that they
@@ -222,7 +181,7 @@ GrResourceKey GrTexturePriv::ComputeKey(const GrGpu* gpu,
const GrTextureDesc& desc,
const GrCacheID& cacheID) {
GrResourceKey::ResourceFlags flags = get_texture_flags(gpu, params, desc);
- return GrResourceKey(cacheID, texture_resource_type(), flags);
+ return GrResourceKey(cacheID, ResourceType(), flags);
}
GrResourceKey GrTexturePriv::ComputeScratchKey(const GrTextureDesc& desc) {
@@ -241,7 +200,7 @@ GrResourceKey GrTexturePriv::ComputeScratchKey(const GrTextureDesc& desc) {
memset(idKey.fData8 + 16, 0, kPadSize);
GrCacheID cacheID(GrResourceKey::ScratchDomain(), idKey);
- return GrResourceKey(cacheID, texture_resource_type(), 0);
+ return GrResourceKey(cacheID, ResourceType(), 0);
}
bool GrTexturePriv::NeedsResizing(const GrResourceKey& key) {
« no previous file with comments | « src/gpu/GrResourceCache2.cpp ('k') | src/gpu/GrTextureAccess.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698