Revert "Remove GrContext"

This reverts commit 2edf18d818708509809f4be17a2f5abd6d93af2b.

Reason for revert: breaking wasm-debugger

Original change's description:
> Remove GrContext
>
> Woo!
>
> Change-Id: Ifa3ff7e79c7048c2f1d808cc9705593d72886f08
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326436
> Auto-Submit: Adlai Holler <adlai@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: Ie05bda5dad7fb5d369ebe579d2e009fdb99c0729
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326941
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/gm/crosscontextimage.cpp b/gm/crosscontextimage.cpp
index e6d9f35..c3affa9 100644
--- a/gm/crosscontextimage.cpp
+++ b/gm/crosscontextimage.cpp
@@ -21,6 +21,7 @@
 #include "include/gpu/GrRecordingContext.h"
 #include "tools/Resources.h"
 
+class GrContext;
 class GrRenderTargetContext;
 
 DEF_SIMPLE_GPU_GM_CAN_FAIL(cross_context_image, context, rtc, canvas, errorMsg,
diff --git a/gm/discard.cpp b/gm/discard.cpp
index 317947a..f39d289 100644
--- a/gm/discard.cpp
+++ b/gm/discard.cpp
@@ -21,6 +21,7 @@
 #include "include/utils/SkRandom.h"
 #include "tools/ToolUtils.h"
 
+class GrContext;
 class GrRenderTargetContext;
 
 namespace skiagm {
diff --git a/gm/readpixels.cpp b/gm/readpixels.cpp
index 3ad97f3..20562a9 100644
--- a/gm/readpixels.cpp
+++ b/gm/readpixels.cpp
@@ -30,6 +30,8 @@
 #include <memory>
 #include <utility>
 
+class GrContext;
+
 static const int kWidth = 64;
 static const int kHeight = 64;
 
diff --git a/gn/gpu.gni b/gn/gpu.gni
index 97bd69d..63acc5f 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -21,6 +21,7 @@
   "$_include/gpu/GrTypes.h",
 
   # Private includes
+  "$_include/private/GrContext.h",
   "$_include/private/GrContext_Base.h",
   "$_include/private/GrGLTypesPriv.h",
   "$_include/private/GrImageContext.h",
@@ -70,6 +71,7 @@
   "$_src/gpu/GrColorInfo.h",
   "$_src/gpu/GrColorSpaceXform.cpp",
   "$_src/gpu/GrColorSpaceXform.h",
+  "$_src/gpu/GrContext.cpp",
   "$_src/gpu/GrContextThreadSafeProxy.cpp",
   "$_src/gpu/GrContextThreadSafeProxyPriv.h",
   "$_src/gpu/GrContext_Base.cpp",
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 5eb2746..b3004ce 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -32,6 +32,7 @@
 #include <memory>
 #include <vector>
 
+class GrContext;
 class GrRecordingContext;
 class GrRenderTargetContext;
 class SkBaseDevice;
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index ddef550..990d37c 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -34,6 +34,7 @@
 class SkSurface;
 class SkYUVAPixmaps;
 class GrBackendTexture;
+class GrContext;
 class GrDirectContext;
 class GrRecordingContext;
 class GrContextThreadSafeProxy;
@@ -252,7 +253,7 @@
         will be decompressed and then wrapped in a GPU-backed image.
 
         Note: one can query the supported compression formats via
-        GrRecordingContext::compressedBackendFormat.
+        GrContext::compressedBackendFormat.
 
         @param context     GPU context
         @param data        compressed data to store in SkImage
@@ -426,7 +427,7 @@
         @param releaseContext     state passed to textureReleaseProc
         @return                   created SkImage, or nullptr
     */
-    static sk_sp<SkImage> MakeFromYUVATextures(GrRecordingContext* context,
+    static sk_sp<SkImage> MakeFromYUVATextures(GrContext* context,
                                                SkYUVColorSpace yuvColorSpace,
                                                const GrBackendTexture yuvaTextures[],
                                                const SkYUVAIndex yuvaIndices[4],
@@ -468,7 +469,7 @@
     /** To be deprecated.
     */
     static sk_sp<SkImage> MakeFromYUVTexturesCopyWithExternalBackend(
-            GrRecordingContext* context,
+            GrContext* context,
             SkYUVColorSpace yuvColorSpace,
             const GrBackendTexture yuvTextures[3],
             GrSurfaceOrigin textureOrigin,
@@ -493,7 +494,7 @@
         @return                   created SkImage, or nullptr
     */
     static sk_sp<SkImage> MakeFromNV12TexturesCopyWithExternalBackend(
-            GrRecordingContext* context,
+            GrContext* context,
             SkYUVColorSpace yuvColorSpace,
             const GrBackendTexture nv12Textures[2],
             GrSurfaceOrigin textureOrigin,
@@ -951,7 +952,7 @@
         guarantee a finite time before the callback is called.
 
         The data is valid for the lifetime of AsyncReadResult with the exception that if the SkImage
-        is GPU-backed the data is immediately invalidated if the context is abandoned or
+        is GPU-backed the data is immediately invalidated if the GrContext is abandoned or
         destroyed.
 
         @param info            info of the requested pixels
@@ -984,7 +985,7 @@
         called.
 
         The data is valid for the lifetime of AsyncReadResult with the exception that if the SkImage
-        is GPU-backed the data is immediately invalidated if the context is abandoned or
+        is GPU-backed the data is immediately invalidated if the GrContext is abandoned or
         destroyed.
 
         @param yuvColorSpace  The transformation from RGB to YUV. Applied to the resized image
@@ -1132,7 +1133,7 @@
         @param GrDirectContext the GrDirectContext in play, if it exists
         @param GrMipmapped     whether created SkImage texture must allocate mip map levels
         @param SkBudgeted      whether to count a newly created texture for the returned image
-                               counts against the context's budget.
+                               counts against the GrContext's budget.
         @return                created SkImage, or nullptr
     */
     sk_sp<SkImage> makeTextureImage(GrDirectContext*,
@@ -1221,7 +1222,7 @@
         @param backendTextureReleaseProc  storage for clean up function
         @return                           true if back-end texture was created
     */
-    static bool MakeBackendTextureFromSkImage(GrDirectContext* context,
+    static bool MakeBackendTextureFromSkImage(GrContext* context,
                                               sk_sp<SkImage> image,
                                               GrBackendTexture* backendTexture,
                                               BackendTextureReleaseProc* backendTextureReleaseProc);
diff --git a/include/core/SkPictureRecorder.h b/include/core/SkPictureRecorder.h
index 9bc5d1a..7bf55ef 100644
--- a/include/core/SkPictureRecorder.h
+++ b/include/core/SkPictureRecorder.h
@@ -18,6 +18,7 @@
 };
 #endif
 
+class GrContext;
 class SkCanvas;
 class SkDrawable;
 class SkMiniRecorder;
diff --git a/include/core/SkShader.h b/include/core/SkShader.h
index 4f1646d..5770b83 100644
--- a/include/core/SkShader.h
+++ b/include/core/SkShader.h
@@ -24,6 +24,7 @@
 class SkPath;
 class SkPicture;
 class SkRasterPipeline;
+class GrContext;
 class GrFragmentProcessor;
 
 /** \class SkShader
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h
index 4578796..5d53db5 100644
--- a/include/core/SkSurface.h
+++ b/include/core/SkSurface.h
@@ -31,7 +31,7 @@
 class GrBackendSemaphore;
 class GrBackendSurfaceMutableState;
 class GrBackendTexture;
-class GrDirectContext;
+class GrContext;
 class GrRecordingContext;
 class GrRenderTarget;
 
@@ -769,7 +769,7 @@
         occur to guarantee a finite time before the callback is called.
 
         The data is valid for the lifetime of AsyncReadResult with the exception that if the
-        SkSurface is GPU-backed the data is immediately invalidated if the context is abandoned
+        SkSurface is GPU-backed the data is immediately invalidated if the GrContext is abandoned
         or destroyed.
 
         @param info            info of the requested pixels
@@ -802,7 +802,7 @@
         called.
 
         The data is valid for the lifetime of AsyncReadResult with the exception that if the
-        SkSurface is GPU-backed the data is immediately invalidated if the context is abandoned
+        SkSurface is GPU-backed the data is immediately invalidated if the GrContext is abandoned
         or destroyed.
 
         @param yuvColorSpace  The transformation from RGB to YUV. Applied to the resized image
@@ -868,10 +868,9 @@
     /** Call to ensure all reads/writes of the surface have been issued to the underlying 3D API.
         Skia will correctly order its own draws and pixel operations. This must to be used to ensure
         correct ordering when the surface backing store is accessed outside Skia (e.g. direct use of
-        the 3D API or a windowing system). GrDirectContext has additional flush and submit methods
-        that apply to all surfaces and images created from a GrDirectContext. This is equivalent to
-        calling SkSurface::flush with a default GrFlushInfo followed by
-        GrDirectContext::submit(syncCpu).
+        the 3D API or a windowing system). GrContext has additional flush and submit methods that
+        apply to all surfaces and images created from a GrContext. This is equivalent to calling
+        SkSurface::flush with a default GrFlushInfo followed by GrContext::submit(syncCpu).
     */
     void flushAndSubmit(bool syncCpu = false);
 
@@ -881,8 +880,8 @@
     };
 
     /** Issues pending SkSurface commands to the GPU-backed API objects and resolves any SkSurface
-        MSAA. A call to GrDirectContext::submit is always required to ensure work is actually sent
-        to the gpu. Some specific API details:
+        MSAA. A call to GrContext::submit is always required to ensure work is actually sent to the
+        gpu. Some specific API details:
             GL: Commands are actually sent to the driver, but glFlush is never called. Thus some
                 sync objects from the flush will not be valid until a submission occurs.
 
@@ -927,8 +926,8 @@
     GrSemaphoresSubmitted flush(BackendSurfaceAccess access, const GrFlushInfo& info);
 
     /** Issues pending SkSurface commands to the GPU-backed API objects and resolves any SkSurface
-        MSAA. A call to GrDirectContext::submit is always required to ensure work is actually sent
-        to the gpu. Some specific API details:
+        MSAA. A call to GrContext::submit is always required to ensure work is actually sent to the
+        gpu. Some specific API details:
             GL: Commands are actually sent to the driver, but glFlush is never called. Thus some
                 sync objects from the flush will not be valid until a submission occurs.
 
diff --git a/include/gpu/GrDirectContext.h b/include/gpu/GrDirectContext.h
index e05fb78..34350c5 100644
--- a/include/gpu/GrDirectContext.h
+++ b/include/gpu/GrDirectContext.h
@@ -8,7 +8,7 @@
 #ifndef GrDirectContext_DEFINED
 #define GrDirectContext_DEFINED
 
-#include "include/gpu/GrRecordingContext.h"
+#include "include/private/GrContext.h"
 
 #include "include/gpu/GrBackendSurface.h"
 
@@ -43,7 +43,7 @@
 class SkTaskGroup;
 class SkTraceMemoryDump;
 
-class SK_API GrDirectContext : public GrRecordingContext {
+class SK_API GrDirectContext : public GrContext {
 public:
 #ifdef SK_GL
     /**
@@ -698,9 +698,9 @@
     //
     // Steps to use this API:
     //
-    // 1) Create a GrDirectContext as normal, but set fPersistentCache on GrContextOptions to
-    //    something that will save the cached shader blobs. Set fShaderCacheStrategy to kSkSL. This
-    //    will ensure that the blobs are SkSL, and are suitable for pre-compilation.
+    // 1) Create a GrContext as normal, but set fPersistentCache on GrContextOptions to something
+    //    that will save the cached shader blobs. Set fShaderCacheStrategy to kSkSL. This will
+    //    ensure that the blobs are SkSL, and are suitable for pre-compilation.
     // 2) Run your application, and save all of the key/data pairs that are fed to the cache.
     //
     // 3) Switch over to shipping your application. Include the key/data pairs from above.
@@ -756,7 +756,7 @@
 
     friend class GrDirectContextPriv;
 
-    using INHERITED = GrRecordingContext;
+    using INHERITED = GrContext;
 };
 
 
diff --git a/include/private/GrContext.h b/include/private/GrContext.h
new file mode 100644
index 0000000..220b00b
--- /dev/null
+++ b/include/private/GrContext.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrContext_DEFINED
+#define GrContext_DEFINED
+
+#include "include/core/SkTypes.h"
+#include "include/gpu/GrRecordingContext.h"
+
+/**
+ * This deprecated class is being merged into GrDirectContext and removed.
+ * Do not add new subclasses, new API, or attempt to instantiate one.
+ * If new API requires direct GPU access, add it to GrDirectContext.
+ * Otherwise, add it to GrRecordingContext.
+ */
+class SK_API GrContext : public GrRecordingContext {
+public:
+    ~GrContext() override;
+
+protected:
+    GrContext(sk_sp<GrContextThreadSafeProxy>);
+
+private:
+    using INHERITED = GrRecordingContext;
+};
+
+#endif
diff --git a/modules/canvaskit/canvaskit/types/index.d.ts b/modules/canvaskit/canvaskit/types/index.d.ts
index b58076b..53ac1e7 100644
--- a/modules/canvaskit/canvaskit/types/index.d.ts
+++ b/modules/canvaskit/canvaskit/types/index.d.ts
@@ -541,8 +541,7 @@
 }
 
 /**
- * See GrDirectContext.h for more on this class.
- * TODO: Rename this class.
+ * See GrContext.h for more on this class.
  */
 export interface GrContext extends EmbindObject<GrContext> {
     getResourceCacheLimitBytes(): number;
diff --git a/samplecode/Sample.cpp b/samplecode/Sample.cpp
index a69de8e..2a6e6a1 100644
--- a/samplecode/Sample.cpp
+++ b/samplecode/Sample.cpp
@@ -12,7 +12,7 @@
 #if SK_SUPPORT_GPU
 #   include "include/gpu/GrDirectContext.h"
 #else
-class GrDirectContext;
+class GrContext;
 #endif
 
 //////////////////////////////////////////////////////////////////////////////
@@ -49,7 +49,7 @@
         SkAutoCanvasRestore acr(canvas, true);
         this->onDrawContent(canvas);
 #if SK_SUPPORT_GPU
-        // Ensure the context doesn't combine GrDrawOps across draw loops.
+        // Ensure the GrContext doesn't combine GrDrawOps across draw loops.
         if (auto direct = GrAsDirectContext(canvas->recordingContext())) {
             direct->flushAndSubmit();
         }
diff --git a/src/core/SkDevice.h b/src/core/SkDevice.h
index 60a5622..ee3462a 100644
--- a/src/core/SkDevice.h
+++ b/src/core/SkDevice.h
@@ -344,6 +344,7 @@
 
     ///////////////////////////////////////////////////////////////////////////
 
+    virtual GrContext* context() const { return nullptr; }
     virtual GrRecordingContext* recordingContext() const { return nullptr; }
 
     virtual sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&);
diff --git a/src/core/SkGpuBlurUtils.h b/src/core/SkGpuBlurUtils.h
index 1f22c57..f90845d 100644
--- a/src/core/SkGpuBlurUtils.h
+++ b/src/core/SkGpuBlurUtils.h
@@ -11,7 +11,7 @@
 #if SK_SUPPORT_GPU
 #include "src/gpu/GrRenderTargetContext.h"
 
-class GrRecordingContext;
+class GrContext;
 class GrTexture;
 
 struct SkRect;
diff --git a/src/core/SkSpecialSurface.h b/src/core/SkSpecialSurface.h
index cfc26c3..5d628a4 100644
--- a/src/core/SkSpecialSurface.h
+++ b/src/core/SkSpecialSurface.h
@@ -17,6 +17,7 @@
 #endif
 
 class GrBackendFormat;
+class GrContext;
 class GrRecordingContext;
 class SkBitmap;
 class SkCanvas;
diff --git a/src/gpu/GrAHardwareBufferUtils.h b/src/gpu/GrAHardwareBufferUtils.h
index b93a8fe..c51d8f0 100644
--- a/src/gpu/GrAHardwareBufferUtils.h
+++ b/src/gpu/GrAHardwareBufferUtils.h
@@ -14,7 +14,7 @@
 #include "include/gpu/GrBackendSurface.h"
 #include "include/gpu/GrTypes.h"
 
-class GrDirectContext;
+class GrContext;
 
 extern "C" {
     typedef struct AHardwareBuffer AHardwareBuffer;
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
new file mode 100644
index 0000000..929f0e8
--- /dev/null
+++ b/src/gpu/GrContext.cpp
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "include/gpu/GrDirectContext.h"
+
+#include "include/gpu/GrContextThreadSafeProxy.h"
+#include "src/core/SkTaskGroup.h"
+#include "src/gpu/GrClientMappedBufferManager.h"
+#include "src/gpu/GrGpu.h"
+#include "src/gpu/GrResourceCache.h"
+#include "src/gpu/GrResourceProvider.h"
+#include "src/gpu/text/GrStrikeCache.h"
+
+GrContext::GrContext(sk_sp<GrContextThreadSafeProxy> proxy) : INHERITED(std::move(proxy)) { }
+
+GrContext::~GrContext() = default;
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index f590fad..10077f4 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -202,6 +202,7 @@
 
     SkDEBUGCODE(void validate() const);
 
+    friend class GrContext; // access to: flush & cleanup
     friend class GrDirectContext; // access to: flush & cleanup
     friend class GrDirectContextPriv; // access to: flush
     friend class GrOnFlushResourceProvider; // this is just a shallow wrapper around this class
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index 7d4a201..4ac87d2 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -555,7 +555,7 @@
     return nullptr;
 }
 
-bool SkImage::MakeBackendTextureFromSkImage(GrDirectContext*,
+bool SkImage::MakeBackendTextureFromSkImage(GrContext*,
                                             sk_sp<SkImage>,
                                             GrBackendTexture*,
                                             BackendTextureReleaseProc*) {
@@ -582,7 +582,7 @@
 }
 
 sk_sp<SkImage> SkImage::MakeFromNV12TexturesCopyWithExternalBackend(
-       GrRecordingContext*, SkYUVColorSpace, const GrBackendTexture[2], GrSurfaceOrigin,
+       GrContext*, SkYUVColorSpace, const GrBackendTexture[2], GrSurfaceOrigin,
        const GrBackendTexture&, sk_sp<SkColorSpace>, TextureReleaseProc, ReleaseContext) {
     return nullptr;
 }
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index cf56957..f1d6d14 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -414,9 +414,9 @@
 }
 
 sk_sp<SkImage> SkImage::MakeFromYUVTexturesCopyWithExternalBackend(
-        GrRecordingContext* ctx, SkYUVColorSpace yuvColorSpace,
-        const GrBackendTexture yuvTextures[3], GrSurfaceOrigin imageOrigin,
-        const GrBackendTexture& backendTexture, sk_sp<SkColorSpace> imageColorSpace) {
+        GrContext* ctx, SkYUVColorSpace yuvColorSpace, const GrBackendTexture yuvTextures[3],
+        GrSurfaceOrigin imageOrigin, const GrBackendTexture& backendTexture,
+        sk_sp<SkColorSpace> imageColorSpace) {
     SkYUVAIndex yuvaIndices[4] = {
             SkYUVAIndex{0, get_single_channel(yuvTextures[0])},
             SkYUVAIndex{1, get_single_channel(yuvTextures[1])},
@@ -428,7 +428,7 @@
 }
 
 sk_sp<SkImage> SkImage::MakeFromNV12TexturesCopyWithExternalBackend(
-        GrRecordingContext* ctx,
+        GrContext* ctx,
         SkYUVColorSpace yuvColorSpace,
         const GrBackendTexture nv12Textures[2],
         GrSurfaceOrigin imageOrigin,
@@ -447,8 +447,7 @@
             std::move(imageColorSpace), textureReleaseProc, releaseContext);
 }
 
-static sk_sp<SkImage> create_image_from_producer(GrRecordingContext* context,
-                                                 GrTextureProducer* producer,
+static sk_sp<SkImage> create_image_from_producer(GrContext* context, GrTextureProducer* producer,
                                                  uint32_t id, GrMipmapped mipMapped) {
     auto view = producer->view(mipMapped);
     if (!view) {
@@ -714,11 +713,13 @@
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-bool SkImage::MakeBackendTextureFromSkImage(GrDirectContext* direct,
+bool SkImage::MakeBackendTextureFromSkImage(GrContext* ctx,
                                             sk_sp<SkImage> image,
                                             GrBackendTexture* backendTexture,
                                             BackendTextureReleaseProc* releaseProc) {
-    if (!image || !backendTexture || !releaseProc) {
+    // TODO: Elevate direct context requirement to public API.
+    auto direct = GrAsDirectContext(ctx);
+    if (!image || !direct || !backendTexture || !releaseProc) {
         return false;
     }
 
diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h
index 52a7f6e..d6bb145 100644
--- a/src/image/SkImage_Gpu.h
+++ b/src/image/SkImage_Gpu.h
@@ -15,8 +15,7 @@
 #include "src/gpu/SkGr.h"
 #include "src/image/SkImage_GpuBase.h"
 
-class GrDirectContext;
-class GrRecordingContext;
+class GrContext;
 class GrTexture;
 
 class SkBitmap;
diff --git a/src/image/SkImage_GpuYUVA.cpp b/src/image/SkImage_GpuYUVA.cpp
index a45227f..0c38e98 100644
--- a/src/image/SkImage_GpuYUVA.cpp
+++ b/src/image/SkImage_GpuYUVA.cpp
@@ -234,7 +234,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////////////
 
-sk_sp<SkImage> SkImage::MakeFromYUVATextures(GrRecordingContext* ctx,
+sk_sp<SkImage> SkImage::MakeFromYUVATextures(GrContext* ctx,
                                              SkYUVColorSpace colorSpace,
                                              const GrBackendTexture yuvaTextures[],
                                              const SkYUVAIndex yuvaIndices[4],
diff --git a/src/image/SkImage_GpuYUVA.h b/src/image/SkImage_GpuYUVA.h
index 5b0d983..6658adb 100644
--- a/src/image/SkImage_GpuYUVA.h
+++ b/src/image/SkImage_GpuYUVA.h
@@ -12,8 +12,7 @@
 #include "src/core/SkCachedData.h"
 #include "src/image/SkImage_GpuBase.h"
 
-class GrDirectContext;
-class GrRecordingContext;
+class GrContext;
 class GrTexture;
 struct SkYUVASizeInfo;
 
diff --git a/src/shaders/SkShaderBase.h b/src/shaders/SkShaderBase.h
index 1e74f83..07b90ce 100644
--- a/src/shaders/SkShaderBase.h
+++ b/src/shaders/SkShaderBase.h
@@ -21,6 +21,7 @@
 #include "src/gpu/GrFPArgs.h"
 #endif
 
+class GrContext;
 class GrFragmentProcessor;
 class SkArenaAlloc;
 class SkColorSpace;
@@ -146,14 +147,14 @@
 
 #if SK_SUPPORT_GPU
     /**
-     *  Returns a GrFragmentProcessor that implements the shader for the GPU backend. nullptr is
+     *  Returns a GrFragmentProcessor that implements the shader for the GPU backend. NULL is
      *  returned if there is no GPU implementation.
      *
      *  The GPU device does not call SkShader::createContext(), instead we pass the view matrix,
      *  local matrix, and filter quality directly.
      *
-     *  The GrRecordingContext may be used by the to create textures that are required by the
-     *  returned processor.
+     *  The GrContext may be used by the to create textures that are required by the returned
+     *  processor.
      *
      *  The returned GrFragmentProcessor should expect an unpremultiplied input color and
      *  produce a premultiplied output.
diff --git a/tests/DeviceTest.cpp b/tests/DeviceTest.cpp
index 60b7ff3..b7e72bf 100644
--- a/tests/DeviceTest.cpp
+++ b/tests/DeviceTest.cpp
@@ -20,6 +20,7 @@
 #include "tools/gpu/GrContextFactory.h"
 
 class SkColorSpace;
+class GrContext;
 
 class DeviceTestingAccess {
 public:
diff --git a/tools/DDLPromiseImageHelper.h b/tools/DDLPromiseImageHelper.h
index 969164b..2fde554 100644
--- a/tools/DDLPromiseImageHelper.h
+++ b/tools/DDLPromiseImageHelper.h
@@ -19,7 +19,7 @@
 #include "src/core/SkCachedData.h"
 #include "src/core/SkTLazy.h"
 
-class GrDirectContext;
+class GrContext;
 class SkImage;
 class SkMipmap;
 class SkPicture;
diff --git a/tools/DDLTileHelper.cpp b/tools/DDLTileHelper.cpp
index 687c3e0..fbea4ce 100644
--- a/tools/DDLTileHelper.cpp
+++ b/tools/DDLTileHelper.cpp
@@ -121,7 +121,7 @@
     }
 }
 
-sk_sp<SkSurface> DDLTileHelper::TileData::makeWrappedTileDest(GrRecordingContext* context) {
+sk_sp<SkSurface> DDLTileHelper::TileData::makeWrappedTileDest(GrContext* context) {
     SkASSERT(fCallbackContext && fCallbackContext->promiseImageTexture());
 
     auto promiseImageTexture = fCallbackContext->promiseImageTexture();
@@ -141,7 +141,7 @@
                                              &fCharacterization.surfaceProps());
 }
 
-void DDLTileHelper::TileData::drawSKPDirectly(GrRecordingContext* context) {
+void DDLTileHelper::TileData::drawSKPDirectly(GrContext* context) {
     SkASSERT(!fDisplayList && !fTileSurface && fReconstitutedPicture);
 
     fTileSurface = this->makeWrappedTileDest(context);
@@ -335,7 +335,7 @@
 }
 
 // Only called from skpbench
-void DDLTileHelper::drawAllTilesDirectly(GrDirectContext* context) {
+void DDLTileHelper::drawAllTilesDirectly(GrContext* context) {
     for (int i = 0; i < this->numTiles(); ++i) {
         fTiles[i].drawSKPDirectly(context);
     }
diff --git a/tools/DDLTileHelper.h b/tools/DDLTileHelper.h
index 2540681..14ccde9 100644
--- a/tools/DDLTileHelper.h
+++ b/tools/DDLTileHelper.h
@@ -53,7 +53,7 @@
         // Just draw the re-inflated per-tile SKP directly into this tile w/o going through a DDL
         // first. This is used for determining the overhead of using DDLs (i.e., it replaces
         // a 'createDDL' and 'draw' pair.
-        void drawSKPDirectly(GrRecordingContext*);
+        void drawSKPDirectly(GrContext*);
 
         // Replay the recorded DDL into the tile surface - filling in 'fBackendTexture'.
         void draw(GrDirectContext*);
@@ -72,7 +72,7 @@
         static void DeleteBackendTexture(GrDirectContext*, TileData*);
 
     private:
-        sk_sp<SkSurface> makeWrappedTileDest(GrRecordingContext* context);
+        sk_sp<SkSurface> makeWrappedTileDest(GrContext* context);
 
         sk_sp<PromiseImageCallbackContext> refCallbackContext() { return fCallbackContext; }
 
@@ -124,7 +124,7 @@
 
     // This draws all the per-tile SKPs directly into all of the tiles w/o converting them to
     // DDLs first - all on a single thread.
-    void drawAllTilesDirectly(GrDirectContext*);
+    void drawAllTilesDirectly(GrContext*);
 
     void dropCallbackContexts();
     void resetAllTiles();