Add GrThreadSafePipelineBuilder

GrThreadSafePipelineBuilder is the generic, base object the
GrContextThreadSafeProxy will hold. Each backend will create a
backend-specific version that is shared between the direct context
and the (possibly many) utility contexts.

Right now GrThreadSafePipelineBuilder just holds the pipeline
creation stats. Relatedly only GrGLGpu::ProgramCache and
GrVkResourceProvider::PipelineStateCache currently derive from
the new class (since they are the only backends that generate
pipeline stats).

Change-Id: I58f441c5c2b870bb5970c29cba19d1775864d52e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378320
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/include/gpu/GrContextThreadSafeProxy.h b/include/gpu/GrContextThreadSafeProxy.h
index ccfbefd..f645b87 100644
--- a/include/gpu/GrContextThreadSafeProxy.h
+++ b/include/gpu/GrContextThreadSafeProxy.h
@@ -23,6 +23,7 @@
 class GrContextThreadSafeProxyPriv;
 class GrTextBlobCache;
 class GrThreadSafeCache;
+class GrThreadSafePipelineBuilder;
 class SkSurfaceCharacterization;
 class SkSurfaceProps;
 
@@ -130,15 +131,16 @@
     // TODO: This should be part of the constructor but right now we have a chicken-and-egg problem
     // with GrContext where we get the caps by creating a GPU which requires a context (see the
     // `init` method on GrContext_Base).
-    void init(sk_sp<const GrCaps>);
+    void init(sk_sp<const GrCaps>, sk_sp<GrThreadSafePipelineBuilder>);
 
-    const GrBackendApi                 fBackend;
-    const GrContextOptions             fOptions;
-    const uint32_t                     fContextID;
-    sk_sp<const GrCaps>                fCaps;
-    std::unique_ptr<GrTextBlobCache>   fTextBlobCache;
-    std::unique_ptr<GrThreadSafeCache> fThreadSafeCache;
-    std::atomic<bool>                  fAbandoned{false};
+    const GrBackendApi                      fBackend;
+    const GrContextOptions                  fOptions;
+    const uint32_t                          fContextID;
+    sk_sp<const GrCaps>                     fCaps;
+    std::unique_ptr<GrTextBlobCache>        fTextBlobCache;
+    std::unique_ptr<GrThreadSafeCache>      fThreadSafeCache;
+    sk_sp<GrThreadSafePipelineBuilder>      fPipelineBuilder;
+    std::atomic<bool>                       fAbandoned{false};
 };
 
 #else // !SK_SUPPORT_GPU