Revert "Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext""

This reverts commit ff13ffbeacec5335cfdb84c8a9d20bb78e10da58.

Reason for revert: Blink in g3

Original change's description:
> Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
>
> This reverts commit 89bdc90ac877dc8cd49c86c35a20d9df0d3b9016.
>
> Reason for revert: Fix metal
>
> Original change's description:
> > Revert "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
> >
> > This reverts commit d2daa94edeca88281796524fae45f38f11a7bef2.
> >
> > Reason for revert: Metaru
> >
> > Original change's description:
> > > Take GrContext private, GrDDLContext inherit from GrRecordingContext
> > >
> > > Woo!
> > >
> > > Change-Id: I8d201b709343dc18cad31ea740575285dd035f35
> > > Docs-Preview: https://skia.org/?cl=317436
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317436
> > > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > Commit-Queue: Adlai Holler <adlai@google.com>
> >
> > TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
> >
> > Change-Id: I9b58dee285fbdc49ebc8e76df5da0fe224cf9787
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318758
> > Reviewed-by: Adlai Holler <adlai@google.com>
> > Commit-Queue: Adlai Holler <adlai@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
>
>
> Change-Id: Id4b10795193a904cd4ed8c36e60e74abe3b6702a
> Docs-Preview: https://skia.org/?cl=318759
> Cq-Include-Trybots: luci.skia.skia.primary:Build-Mac10.15.5-Clang-arm64-Debug-iOS_Metal,Build-Mac-Clang-x86_64-Debug-Metal
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318759
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Adlai Holler <adlai@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com

Change-Id: Ib20fe933120d56b72efaec73a0bedec60bc28def
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319184
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
diff --git a/src/gpu/GrDDLContext.cpp b/src/gpu/GrDDLContext.cpp
index 183bc8f..2eb4697 100644
--- a/src/gpu/GrDDLContext.cpp
+++ b/src/gpu/GrDDLContext.cpp
@@ -5,7 +5,7 @@
  * found in the LICENSE file.
  */
 
-#include "include/gpu/GrRecordingContext.h"
+#include "include/gpu/GrContext.h"
 #include "src/core/SkLRUCache.h"
 #include "src/gpu/GrCaps.h"
 #include "src/gpu/GrContextThreadSafeProxyPriv.h"
@@ -18,7 +18,7 @@
  * The DDL Context is the one in effect during DDL Recording. It isn't backed by a GrGPU and
  * cannot allocate any GPU resources.
  */
-class GrDDLContext final : public GrRecordingContext {
+class GrDDLContext final : public GrContext {
 public:
     GrDDLContext(sk_sp<GrContextThreadSafeProxy> proxy)
         : INHERITED(std::move(proxy)) {
@@ -31,7 +31,21 @@
         INHERITED::abandonContext();
     }
 
+    void releaseResourcesAndAbandonContext() override {
+        SkASSERT(0); // abandoning in a DDL Recorder doesn't make a whole lot of sense
+        INHERITED::releaseResourcesAndAbandonContext();
+    }
+
+    void freeGpuResources() override {
+        // freeing resources in a DDL Recorder doesn't make a whole lot of sense but some of
+        // our tests do it anyways
+    }
+
 private:
+    // TODO: Here we're pretending this isn't derived from GrContext. Switch this to be derived from
+    // GrRecordingContext!
+    GrDirectContext* asDirectContext() override { return nullptr; }
+
     bool init() override {
         if (!INHERITED::init()) {
             return false;
@@ -44,6 +58,16 @@
         return true;
     }
 
+    GrAtlasManager* onGetAtlasManager() override {
+        SkASSERT(0);   // the DDL Recorders should never invoke this
+        return nullptr;
+    }
+
+    GrSmallPathAtlasMgr* onGetSmallPathAtlasMgr() override {
+        SkASSERT(0);  // DDL recorders should never invoke this
+        return nullptr;
+    }
+
     // Add to the set of unique program infos required by this DDL
     void recordProgramInfo(const GrProgramInfo* programInfo) final {
         if (!programInfo) {
@@ -125,7 +149,7 @@
 
     ProgramInfoMap fProgramInfoMap;
 
-    using INHERITED = GrRecordingContext;
+    using INHERITED = GrContext;
 };
 
 sk_sp<GrRecordingContext> GrRecordingContextPriv::MakeDDL(sk_sp<GrContextThreadSafeProxy> proxy) {
diff --git a/src/gpu/GrDirectContext.cpp b/src/gpu/GrDirectContext.cpp
index 84b6c59..6f04a5f 100644
--- a/src/gpu/GrDirectContext.cpp
+++ b/src/gpu/GrDirectContext.cpp
@@ -138,6 +138,27 @@
 }
 
 #ifdef SK_GL
+/*************************************************************************************************/
+#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
+
+sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> glInterface) {
+    return GrDirectContext::MakeGL(std::move(glInterface));
+}
+
+sk_sp<GrContext> GrContext::MakeGL(const GrContextOptions& options) {
+    return GrDirectContext::MakeGL(options);
+}
+
+sk_sp<GrContext> GrContext::MakeGL() {
+    return GrDirectContext::MakeGL();
+}
+
+sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> glInterface,
+                                   const GrContextOptions& options) {
+    return GrDirectContext::MakeGL(std::move(glInterface), options);
+}
+
+#endif
 
 /*************************************************************************************************/
 sk_sp<GrDirectContext> GrDirectContext::MakeGL(sk_sp<const GrGLInterface> glInterface) {
@@ -207,6 +228,20 @@
 #endif
 
 /*************************************************************************************************/
+#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
+
+sk_sp<GrContext> GrContext::MakeMock(const GrMockOptions* mockOptions) {
+    return GrDirectContext::MakeMock(mockOptions);
+}
+
+sk_sp<GrContext> GrContext::MakeMock(const GrMockOptions* mockOptions,
+                                     const GrContextOptions& options) {
+    return GrDirectContext::MakeMock(mockOptions, options);
+}
+
+#endif
+
+/*************************************************************************************************/
 sk_sp<GrDirectContext> GrDirectContext::MakeMock(const GrMockOptions* mockOptions) {
     GrContextOptions defaultOptions;
     return MakeMock(mockOptions, defaultOptions);
@@ -226,6 +261,20 @@
 
 #ifdef SK_VULKAN
 /*************************************************************************************************/
+#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
+
+sk_sp<GrContext> GrContext::MakeVulkan(const GrVkBackendContext& backendContext) {
+    return GrDirectContext::MakeVulkan(backendContext);
+}
+
+sk_sp<GrContext> GrContext::MakeVulkan(const GrVkBackendContext& backendContext,
+                                       const GrContextOptions& options) {
+    return GrDirectContext::MakeVulkan(backendContext, options);
+}
+
+#endif
+
+/*************************************************************************************************/
 sk_sp<GrDirectContext> GrDirectContext::MakeVulkan(const GrVkBackendContext& backendContext) {
     GrContextOptions defaultOptions;
     return MakeVulkan(backendContext, defaultOptions);
@@ -246,6 +295,19 @@
 
 #ifdef SK_METAL
 /*************************************************************************************************/
+#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
+
+sk_sp<GrContext> GrContext::MakeMetal(void* device, void* queue) {
+    return GrDirectContext::MakeMetal(device, queue);
+}
+
+sk_sp<GrContext> GrContext::MakeMetal(void* device, void* queue, const GrContextOptions& options) {
+    return GrDirectContext::MakeMetal(device, queue, options);
+}
+
+#endif
+
+/*************************************************************************************************/
 sk_sp<GrDirectContext> GrDirectContext::MakeMetal(void* device, void* queue) {
     GrContextOptions defaultOptions;
     return MakeMetal(device, queue, defaultOptions);
@@ -266,6 +328,20 @@
 
 #ifdef SK_DIRECT3D
 /*************************************************************************************************/
+#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
+
+sk_sp<GrContext> GrContext::MakeDirect3D(const GrD3DBackendContext& backendContext) {
+    return GrDirectContext::MakeDirect3D(backendContext);
+}
+
+sk_sp<GrContext> GrContext::MakeDirect3D(const GrD3DBackendContext& backendContext,
+                                         const GrContextOptions& options) {
+    return GrDirectContext::MakeDirect3D(backendContext, options);
+}
+
+#endif
+
+/*************************************************************************************************/
 sk_sp<GrDirectContext> GrDirectContext::MakeDirect3D(const GrD3DBackendContext& backendContext) {
     GrContextOptions defaultOptions;
     return MakeDirect3D(backendContext, defaultOptions);
@@ -286,6 +362,19 @@
 
 #ifdef SK_DAWN
 /*************************************************************************************************/
+#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
+
+sk_sp<GrContext> GrContext::MakeDawn(const wgpu::Device& device) {
+    return GrDirectContext::MakeDawn(device);
+}
+
+sk_sp<GrContext> GrContext::MakeDawn(const wgpu::Device& device, const GrContextOptions& options) {
+    return GrDirectContext::MakeDawn(device, options);
+}
+
+#endif
+
+/*************************************************************************************************/
 sk_sp<GrDirectContext> GrDirectContext::MakeDawn(const wgpu::Device& device) {
     GrContextOptions defaultOptions;
     return MakeDawn(device, defaultOptions);