Reintroduce deinstantiate lazy proxy types and use for promise images.
This reverts a fraction of b2c5dae65df952999f0a12b9df80bc1433ffa19a to
restore the deinstantiate lazy proxy type, supporting implementation,
and tests.
Use them for promise images to avoid thread safety issues for promise
image resources. Makes promise image instantiation callbacks do a thread
safe unref of their fulfilled GrTexture in GrResourceCache. The
GrResourceCache mechanism for receiving unref messages is extended to
allow multiple pending unrefs. All this is new.
Bug: skia:8800
Change-Id: I7b1d4fea13c053b6fbbd39c0c6eaf567b8bf81f1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/199002
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 9bd5415..a1af2b3 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -1545,18 +1545,18 @@
GrGpu* gpu = context->priv().getGpu();
TestResource* wrapped1 = TestResource::CreateWrapped(gpu, GrWrapCacheable::kYes);
- cache->insertCrossContextGpuResource(wrapped1);
+ cache->insertDelayedResourceUnref(wrapped1);
REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive());
TestResource* wrapped2 = TestResource::CreateWrapped(gpu, GrWrapCacheable::kYes);
- cache->insertCrossContextGpuResource(wrapped2);
+ cache->insertDelayedResourceUnref(wrapped2);
// An uncacheable cross-context should not be purged as soon as we drop our ref. This
// is because inserting it as a cross-context resource actually holds a ref until the
// message is received.
TestResource* wrapped3 = TestResource::CreateWrapped(gpu, GrWrapCacheable::kNo);
- cache->insertCrossContextGpuResource(wrapped3);
+ cache->insertDelayedResourceUnref(wrapped3);
REPORTER_ASSERT(reporter, 3 == TestResource::NumAlive());