aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrSurfaceProxy.cpp
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-02-01 12:21:39 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-01 17:24:38 +0000
commit0a375db9a4c1dc96f9d5856526e074ab2802fb0e (patch)
tree1c90864c9dfaa1eaa019fa06e688e620eff58284 /src/gpu/GrSurfaceProxy.cpp
parent82a4c055d14fe942ab05b7f5d4503fc7b92d4b45 (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/GrSurfaceProxy.cpp')
-rw-r--r--src/gpu/GrSurfaceProxy.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index 2ad28f8ac4..64c47b56b1 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -84,8 +84,8 @@ GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface, GrSurfaceOrigin origin,
GrSurfaceProxy::~GrSurfaceProxy() {
if (fLazyInstantiateCallback) {
- // We have an uninstantiated lazy proxy. Call fLazyInstantiateCallback with a nullptr for
- // the GrResourceProvider to signal the callback should clean itself up.
+ // We call the callback with a null GrResourceProvider to signal that the lambda should
+ // clean itself up if it is holding onto any captured objects.
this->fLazyInstantiateCallback(nullptr, nullptr);
}
// For this to be deleted the opList that held a ref on it (if there was one) must have been
@@ -148,7 +148,6 @@ sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl(
}
void GrSurfaceProxy::assign(sk_sp<GrSurface> surface) {
- SkASSERT(LazyState::kNot == this->lazyInstantiationState());
SkASSERT(!fTarget && surface);
fTarget = surface.release();
this->INHERITED::transferRefs();
@@ -348,8 +347,7 @@ void GrSurfaceProxyPriv::exactify() {
}
bool GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider* resourceProvider) {
- SkASSERT(fProxy->fLazyInstantiateCallback);
- SkASSERT(!fProxy->fTarget);
+ SkASSERT(GrSurfaceProxy::LazyState::kNot != fProxy->lazyInstantiationState());
GrSurfaceOrigin* outOrigin;
if (GrSurfaceProxy::LazyState::kPartially == fProxy->lazyInstantiationState()) {
@@ -364,10 +362,6 @@ bool GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider* resourceProvide
sk_sp<GrTexture> texture = fProxy->fLazyInstantiateCallback(resourceProvider, outOrigin);
-
- // Indicate we are no longer pending lazy instantiation.
- fProxy->fLazyInstantiateCallback = nullptr;
-
if (!texture) {
fProxy->fWidth = 0;
fProxy->fHeight = 0;