diff options
author | 2018-02-01 12:21:39 -0500 | |
---|---|---|
committer | 2018-02-01 17:24:38 +0000 | |
commit | 0a375db9a4c1dc96f9d5856526e074ab2802fb0e (patch) | |
tree | 1c90864c9dfaa1eaa019fa06e688e620eff58284 /src/gpu/GrProxyProvider.cpp | |
parent | 82a4c055d14fe942ab05b7f5d4503fc7b92d4b45 (diff) |
Have lazy proxies keep their callbacks around and clean up their lambdas in the dtor
I believe after this CL we will be at a place where we just have to null out the
fTarget of a lazy proxy and it will reinstantiate itself.
Bug: skia:
Change-Id: I88fdc70e149eba4514a0823da99383583394005c
Reviewed-on: https://skia-review.googlesource.com/102021
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrProxyProvider.cpp')
-rw-r--r-- | src/gpu/GrProxyProvider.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp index 604dd1bb32..ec05243d18 100644 --- a/src/gpu/GrProxyProvider.cpp +++ b/src/gpu/GrProxyProvider.cpp @@ -217,6 +217,8 @@ sk_sp<GrTextureProxy> GrProxyProvider::createTextureProxy(sk_sp<SkImage> srcImag [desc, budgeted, srcImage] (GrResourceProvider* resourceProvider, GrSurfaceOrigin* /*outOrigin*/) { if (!resourceProvider) { + // Nothing to clean up here. Once the proxy (and thus lambda) is deleted the ref + // on srcImage will be released. return sk_sp<GrTexture>(); } SkPixmap pixMap; @@ -396,9 +398,9 @@ sk_sp<GrTextureProxy> GrProxyProvider::createWrappedTextureProxy( [backendTex, ownership, releaseHelper] (GrResourceProvider* resourceProvider, GrSurfaceOrigin* /*outOrigin*/) { if (!resourceProvider) { - // This lazy proxy was never initialized. If this had a releaseHelper it will - // get unrefed when we delete this lambda and will call the release proc so that - // the client knows they can free the underlying backend object. + // If this had a releaseHelper it will get unrefed when we delete this lambda + // and will call the release proc so that the client knows they can free the + // underlying backend object. return sk_sp<GrTexture>(); } @@ -408,9 +410,8 @@ sk_sp<GrTextureProxy> GrProxyProvider::createWrappedTextureProxy( return sk_sp<GrTexture>(); } if (releaseHelper) { - // DDL TODO: once we are reusing lazy proxies, remove this move and hold onto to - // the ref till the lambda goes away. - tex->setRelease(std::move(releaseHelper)); + // This gives the texture a ref on the releaseHelper + tex->setRelease(releaseHelper); } SkASSERT(!tex->asRenderTarget()); // Strictly a GrTexture // Make sure we match how we created the proxy with SkBudgeted::kNo @@ -491,7 +492,6 @@ sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&& mipMapped, fit, budgeted, flags) : new GrTextureProxy(std::move(callback), desc, mipMapped, fit, budgeted, flags)); - } sk_sp<GrTextureProxy> GrProxyProvider::createFullyLazyProxy(LazyInstantiateCallback&& callback, |