aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/LazyProxyTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/LazyProxyTest.cpp')
-rw-r--r--tests/LazyProxyTest.cpp51
1 files changed, 32 insertions, 19 deletions
diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp
index 1994eeb5c9..5a0211d717 100644
--- a/tests/LazyProxyTest.cpp
+++ b/tests/LazyProxyTest.cpp
@@ -213,29 +213,42 @@ DEF_GPUTEST(LazyProxyReleaseTest, reporter, /* options */) {
desc.fHeight = kSize;
desc.fConfig = kRGBA_8888_GrPixelConfig;
+ using LazyInstantiationType = GrSurfaceProxy::LazyInstantiationType;
for (bool doInstantiate : {true, false}) {
- int testCount = 0;
- int* testCountPtr = &testCount;
- sk_sp<GrTextureProxy> proxy = proxyProvider->createLazyProxy(
- [testCountPtr](GrResourceProvider* resourceProvider, GrSurfaceOrigin* outOrigin) {
- if (!resourceProvider) {
- *testCountPtr = -1;
+ for (auto lazyType : {LazyInstantiationType::kSingleUse,
+ LazyInstantiationType::kMultipleUse}) {
+ int testCount = 0;
+ int* testCountPtr = &testCount;
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createLazyProxy(
+ [testCountPtr](GrResourceProvider* resourceProvider,
+ GrSurfaceOrigin* /*outOrigin*/) {
+ if (!resourceProvider) {
+ *testCountPtr = -1;
+ return sk_sp<GrTexture>();
+ }
+ *testCountPtr = 1;
return sk_sp<GrTexture>();
- }
- *testCountPtr = 1;
- return sk_sp<GrTexture>();
- }, desc, GrMipMapped::kNo, SkBackingFit::kExact, SkBudgeted::kNo);
+ }, desc, GrMipMapped::kNo, SkBackingFit::kExact, SkBudgeted::kNo);
- REPORTER_ASSERT(reporter, 0 == testCount);
+ proxy->priv().testingOnly_setLazyInstantiationType(lazyType);
- if (doInstantiate) {
- proxy->priv().doLazyInstantiation(ctx->contextPriv().resourceProvider());
- REPORTER_ASSERT(reporter, 1 == testCount);
- proxy.reset();
- REPORTER_ASSERT(reporter, -1 == testCount);
- } else {
- proxy.reset();
- REPORTER_ASSERT(reporter, -1 == testCount);
+ REPORTER_ASSERT(reporter, 0 == testCount);
+
+ if (doInstantiate) {
+ proxy->priv().doLazyInstantiation(ctx->contextPriv().resourceProvider());
+ if (LazyInstantiationType::kSingleUse == proxy->priv().lazyInstantiationType()) {
+ // In SingleUse we will call the cleanup and delete the callback in the
+ // doLazyInstantiationCall.
+ REPORTER_ASSERT(reporter, -1 == testCount);
+ } else {
+ REPORTER_ASSERT(reporter, 1 == testCount);
+ }
+ proxy.reset();
+ REPORTER_ASSERT(reporter, -1 == testCount);
+ } else {
+ proxy.reset();
+ REPORTER_ASSERT(reporter, -1 == testCount);
+ }
}
}
}