diff options
author | Greg Daniel <egdaniel@google.com> | 2018-02-01 12:21:39 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-01 17:24:38 +0000 |
commit | 0a375db9a4c1dc96f9d5856526e074ab2802fb0e (patch) | |
tree | 1c90864c9dfaa1eaa019fa06e688e620eff58284 /tests/LazyProxyTest.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 'tests/LazyProxyTest.cpp')
-rw-r--r-- | tests/LazyProxyTest.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp index 029a5a5ed1..f1bffa527b 100644 --- a/tests/LazyProxyTest.cpp +++ b/tests/LazyProxyTest.cpp @@ -59,6 +59,9 @@ public: : GrDrawOp(ClassID()), fTest(test) { fProxy = proxyProvider->createFullyLazyProxy([this, nullTexture]( GrResourceProvider* rp, GrSurfaceOrigin* origin) { + if (!rp) { + return sk_sp<GrTexture>(); + } REPORTER_ASSERT(fTest->fReporter, !fTest->fHasOpTexture); fTest->fHasOpTexture = true; *origin = kTopLeft_GrSurfaceOrigin; @@ -111,6 +114,9 @@ public: , fAtlas(atlas) { fLazyProxy = proxyProvider->createFullyLazyProxy([this](GrResourceProvider* rp, GrSurfaceOrigin* origin) { + if (!rp) { + return sk_sp<GrTexture>(); + } REPORTER_ASSERT(fTest->fReporter, !fTest->fHasClipTexture); fTest->fHasClipTexture = true; *origin = kBottomLeft_GrSurfaceOrigin; @@ -225,7 +231,7 @@ DEF_GPUTEST(LazyProxyReleaseTest, reporter, /* options */) { proxy->priv().doLazyInstantiation(ctx->contextPriv().resourceProvider()); REPORTER_ASSERT(reporter, 1 == testCount); proxy.reset(); - REPORTER_ASSERT(reporter, 1 == testCount); + REPORTER_ASSERT(reporter, -1 == testCount); } else { proxy.reset(); REPORTER_ASSERT(reporter, -1 == testCount); @@ -249,8 +255,11 @@ public: fLazyProxy = proxyProvider->createLazyProxy( [testExecuteValue, shouldFailInstantiation, desc] ( GrResourceProvider* rp, GrSurfaceOrigin* /*origin*/) { - *testExecuteValue = 1; - if (shouldFailInstantiation || !rp) { + if (!rp) { + return sk_sp<GrTexture>(); + } + if (shouldFailInstantiation) { + *testExecuteValue = 1; return sk_sp<GrTexture>(); } return rp->createTexture(desc, SkBudgeted::kNo); |