Make GrContextThreadSafeProxy not a GrContext_Base

Once this API is retracted, we can rename it to something more sane.
The code base has some `fContextInfo` ivars of this type, suggesting it
was previously named ContextInfo. It could be a ContextGroup or something else.

Bug: skia:10318
Change-Id: I3471e2172f46163f98a94780f0d7eb3431894cda
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293556
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
diff --git a/src/gpu/GrLegacyDirectContext.cpp b/src/gpu/GrLegacyDirectContext.cpp
index 595807e..07be4fb 100644
--- a/src/gpu/GrLegacyDirectContext.cpp
+++ b/src/gpu/GrLegacyDirectContext.cpp
@@ -40,7 +40,7 @@
 class GrLegacyDirectContext : public GrContext {
 public:
     GrLegacyDirectContext(GrBackendApi backend, const GrContextOptions& options)
-            : INHERITED(backend, options)
+            : INHERITED(GrContextThreadSafeProxyPriv::Make(backend, options))
             , fAtlasManager(nullptr) {
     }
 
@@ -72,16 +72,14 @@
     }
 
 protected:
-    bool init(sk_sp<const GrCaps> caps) override {
-        SkASSERT(caps);
-        SkASSERT(!fThreadSafeProxy);
+    bool init() override {
+        const GrGpu* gpu = this->priv().getGpu();
+        if (!gpu) {
+            return false;
+        }
 
-        fThreadSafeProxy = GrContextThreadSafeProxyPriv::Make(this->backend(),
-                                                              this->options(),
-                                                              this->contextID(),
-                                                              caps);
-
-        if (!INHERITED::init(std::move(caps))) {
+        fThreadSafeProxy->priv().init(gpu->refCaps());
+        if (!INHERITED::init()) {
             return false;
         }
 
@@ -94,8 +92,6 @@
 
         this->setupDrawingManager(true, reduceOpsTaskSplitting);
 
-        SkASSERT(this->caps());
-
         GrDrawOpAtlas::AllowMultitexturing allowMultitexturing;
         if (GrContextOptions::Enable::kNo == this->options().fAllowMultipleGlyphCacheTextures ||
             // multitexturing supported only if range can represent the index + texcoords fully
@@ -144,11 +140,7 @@
     sk_sp<GrContext> context(new GrLegacyDirectContext(GrBackendApi::kOpenGL, options));
 
     context->fGpu = GrGLGpu::Make(std::move(glInterface), options, context.get());
-    if (!context->fGpu) {
-        return nullptr;
-    }
-
-    if (!context->init(context->fGpu->refCaps())) {
+    if (!context->init()) {
         return nullptr;
     }
     return context;
@@ -165,11 +157,7 @@
     sk_sp<GrContext> context(new GrLegacyDirectContext(GrBackendApi::kMock, options));
 
     context->fGpu = GrMockGpu::Make(mockOptions, options, context.get());
-    if (!context->fGpu) {
-        return nullptr;
-    }
-
-    if (!context->init(context->fGpu->refCaps())) {
+    if (!context->init()) {
         return nullptr;
     }
 
@@ -191,13 +179,10 @@
     sk_sp<GrContext> context(new GrLegacyDirectContext(GrBackendApi::kVulkan, options));
 
     context->fGpu = GrVkGpu::Make(backendContext, options, context.get());
-    if (!context->fGpu) {
+    if (!context->init()) {
         return nullptr;
     }
 
-    if (!context->init(context->fGpu->refCaps())) {
-        return nullptr;
-    }
     return context;
 #else
     return nullptr;
@@ -214,13 +199,10 @@
     sk_sp<GrContext> context(new GrLegacyDirectContext(GrBackendApi::kMetal, options));
 
     context->fGpu = GrMtlTrampoline::MakeGpu(context.get(), options, device, queue);
-    if (!context->fGpu) {
+    if (!context->init()) {
         return nullptr;
     }
 
-    if (!context->init(context->fGpu->refCaps())) {
-        return nullptr;
-    }
     return context;
 }
 #endif
@@ -236,13 +218,10 @@
     sk_sp<GrContext> context(new GrLegacyDirectContext(GrBackendApi::kDirect3D, options));
 
     context->fGpu = GrD3DGpu::Make(backendContext, options, context.get());
-    if (!context->fGpu) {
+    if (!context->init()) {
         return nullptr;
     }
 
-    if (!context->init(context->fGpu->refCaps())) {
-        return nullptr;
-    }
     return context;
 }
 #endif
@@ -257,13 +236,10 @@
     sk_sp<GrContext> context(new GrLegacyDirectContext(GrBackendApi::kDawn, options));
 
     context->fGpu = GrDawnGpu::Make(device, options, context.get());
-    if (!context->fGpu) {
+    if (!context->init()) {
         return nullptr;
     }
 
-    if (!context->init(context->fGpu->refCaps())) {
-        return nullptr;
-    }
     return context;
 }
 #endif