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/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index e184e8e..1bba019 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -42,7 +42,7 @@
// Attach our texture to this context's resource cache. This ensures that deletion will happen
// in the correct thread/context. This adds the only ref to the texture that will persist from
// this point. That ref will be released when the generator's RefHelper is freed.
- context->priv().getResourceCache()->insertCrossContextGpuResource(texture.get());
+ context->priv().getResourceCache()->insertDelayedResourceUnref(texture.get());
GrBackendTexture backendTexture = texture->getBackendTexture();
GrBackendFormat backendFormat = backendTexture.getBackendFormat();