Add ref counted wrapped around GrTexture ReleaseProc
Bug: skia:
Change-Id: I0cd11a539fd6b16d4b3f9512694f84e0a429518c
Reviewed-on: https://skia-review.googlesource.com/101341
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h
index 28f0d4b..899b3ed 100644
--- a/include/gpu/GrTexture.h
+++ b/include/gpu/GrTexture.h
@@ -41,7 +41,7 @@
/**
* This function steals the backend texture from a uniquely owned GrTexture with no pending
* IO, passing it out to the caller. The GrTexture is deleted in the process.
- *
+ *
* Note that if the GrTexture is not uniquely owned (no other refs), or has pending IO, this
* function will fail.
*/
@@ -55,11 +55,16 @@
}
#endif
- // These match the definitions in SkImage, for whence they came
+ virtual void setRelease(sk_sp<GrReleaseProcHelper> releaseHelper) = 0;
+
+ // These match the definitions in SkImage, from whence they came.
+ // TODO: Either move Chrome over to new api or remove their need to call this on GrTexture
typedef void* ReleaseCtx;
typedef void (*ReleaseProc)(ReleaseCtx);
-
- virtual void setRelease(ReleaseProc proc, ReleaseCtx ctx) = 0;
+ void setRelease(ReleaseProc proc, ReleaseCtx ctx) {
+ sk_sp<GrReleaseProcHelper> helper(new GrReleaseProcHelper(proc, ctx));
+ this->setRelease(std::move(helper));
+ }
/** Access methods that are only to be used within Skia code. */
inline GrTexturePriv texturePriv();