Centralize CreateLazyView helper in GrThreadSafeUniquelyKeyedProxyViewCache

We'll also be needing this helper for HW-generated blur mask caching

Bug: 1108408
Change-Id: I60d91ae8864239f0cf68830d0a5b4266d27545d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323109
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrThreadSafeUniquelyKeyedProxyViewCache.h b/src/gpu/GrThreadSafeUniquelyKeyedProxyViewCache.h
index f6f9d70..e0bac81 100644
--- a/src/gpu/GrThreadSafeUniquelyKeyedProxyViewCache.h
+++ b/src/gpu/GrThreadSafeUniquelyKeyedProxyViewCache.h
@@ -95,6 +95,18 @@
 
     void remove(const GrUniqueKey&)  SK_EXCLUDES(fSpinLock);
 
+    // To allow gpu-created resources to have priority, we pre-emptively place a lazy proxy
+    // in the thread-safe cache (with findOrAdd). The Trampoline object allows that lazy proxy to
+    // be instantiated with some later generated rendering result.
+    class Trampoline : public SkRefCnt {
+    public:
+        sk_sp<GrTextureProxy> fProxy;
+    };
+
+    static std::tuple<GrSurfaceProxyView, sk_sp<Trampoline>> CreateLazyView(GrDirectContext*,
+                                                                            SkISize dimensions,
+                                                                            GrColorType,
+                                                                            GrSurfaceOrigin);
 private:
     struct Entry {
         Entry(const GrUniqueKey& key, const GrSurfaceProxyView& view) : fKey(key), fView(view) {}