aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLTexture.h
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-01-30 09:28:44 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-30 14:50:00 +0000
commit6a0176bf033c780bb92396220db8140f30948345 (patch)
treee1ddcf9e3ca552d5063542d18ce30028e1ca0ca7 /src/gpu/gl/GrGLTexture.h
parentaa71c899fdf55e0a6cce60a2aed1ad904d23646d (diff)
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>
Diffstat (limited to 'src/gpu/gl/GrGLTexture.h')
-rw-r--r--src/gpu/gl/GrGLTexture.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/gpu/gl/GrGLTexture.h b/src/gpu/gl/GrGLTexture.h
index b7c8716cc7..2b10be8689 100644
--- a/src/gpu/gl/GrGLTexture.h
+++ b/src/gpu/gl/GrGLTexture.h
@@ -36,7 +36,7 @@ public:
~GrGLTexture() override {
// check that invokeReleaseProc has been called (if needed)
- SkASSERT(!fReleaseProc);
+ SkASSERT(!fReleaseHelper);
}
GrBackendObject getTextureHandle() const override;
@@ -44,9 +44,8 @@ public:
void textureParamsModified() override { fTexParams.invalidate(); }
- void setRelease(ReleaseProc proc, ReleaseCtx ctx) override {
- fReleaseProc = proc;
- fReleaseCtx = ctx;
+ void setRelease(sk_sp<GrReleaseProcHelper> releaseHelper) override {
+ fReleaseHelper = std::move(releaseHelper);
}
// These functions are used to track the texture parameters associated with the texture.
@@ -90,9 +89,10 @@ protected:
private:
void invokeReleaseProc() {
- if (fReleaseProc) {
- fReleaseProc(fReleaseCtx);
- fReleaseProc = nullptr;
+ if (fReleaseHelper) {
+ // Depending on the ref count of fReleaseHelper this may or may not actually trigger the
+ // ReleaseProc to be called.
+ fReleaseHelper.reset();
}
}
@@ -104,8 +104,7 @@ private:
GrBackendObjectOwnership fTextureIDOwnership;
bool fBaseLevelHasBeenBoundToFBO = false;
- ReleaseProc fReleaseProc = nullptr;
- ReleaseCtx fReleaseCtx = nullptr;
+ sk_sp<GrReleaseProcHelper> fReleaseHelper;
typedef GrTexture INHERITED;
};