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

Unified Diff: include/gpu/GrContext.h

Issue 608883003: GrResourceCache2 manages scratch texture. (Closed) Base URL: https://skia.googlesource.com/skia.git@surfimpl
Patch Set: wrap line and delete unneeded friends Created 6 years, 3 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: include/gpu/GrContext.h
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index e1af73ccb2497c9cbea64b248aa5b9b6bf5c1c2f..3256e886b09659b22eab5d31e4adc82990cfb1f2 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -295,12 +295,6 @@ public:
GrTexture* lockAndRefScratchTexture(const GrTextureDesc&, ScratchTexMatch match);
/**
- * When done with an entry, call unlockScratchTexture(entry) on it, which returns
- * it to the cache, where it may be purged. This does not unref the texture.
- */
- void unlockScratchTexture(GrTexture* texture);
-
- /**
* Creates a texture that is outside the cache. Does not count against
* cache's budget.
*/
@@ -1051,15 +1045,7 @@ private:
size_t rowBytes,
bool filter);
- // Needed so GrTexture's returnToCache helper function can call
- // addExistingTextureToCache
- friend class GrTexture;
- friend class GrStencilAndCoverPathRenderer;
- friend class GrStencilAndCoverTextContext;
-
- // Add an existing texture to the texture cache. This is intended solely
- // for use with textures released from an GrAutoScratchTexture.
- void addExistingTextureToCache(GrTexture* texture);
+ bool addNewScratchTexture(const GrTextureDesc& desc);
/**
* These functions create premul <-> unpremul effects if it is possible to generate a pair
@@ -1079,8 +1065,7 @@ private:
};
/**
- * Gets and locks a scratch texture from a descriptor using either exact or approximate criteria.
- * Unlocks texture in the destructor.
+ * This is deprecated. Don't use it.
*/
class GrAutoScratchTexture : public ::SkNoncopyable {
public:
@@ -1103,25 +1088,16 @@ public:
void reset() {
if (fContext && fTexture) {
- fContext->unlockScratchTexture(fTexture);
fTexture->unref();
fTexture = NULL;
}
}
- /*
- * When detaching a texture we do not unlock it in the texture cache but
- * we do set the returnToCache flag. In this way the texture remains
- * "locked" in the texture cache until it is freed and recycled in
- * GrTexture::internal_dispose. In reality, the texture has been removed
- * from the cache (because this is in AutoScratchTexture) and by not
- * calling unlockScratchTexture we simply don't re-add it. It will be
- * reattached in GrTexture::internal_dispose.
- *
- * Note that the caller is assumed to accept and manage the ref to the
- * returned texture.
- */
- GrTexture* detach();
+ GrTexture* detach() {
+ GrTexture* texture = fTexture;
+ fTexture = NULL;
+ return texture;
+ }
GrTexture* set(GrContext* context,
const GrTextureDesc& desc,

Powered by Google App Engine
This is Rietveld 408576698