gpu: Expose GrContextPriv::abandoned in the public API.

TBR=bsalomon@google.com

Bug: 854416
Change-Id: Iab71ca6e4724a925b0b9791267aac5ddc34f5b15
Reviewed-on: https://skia-review.googlesource.com/137692
Reviewed-by: Khusal Sagar <khushalsagar@chromium.org>
Commit-Queue: Khusal Sagar <khushalsagar@chromium.org>
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index ea1da11..e3ae782 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -144,8 +144,7 @@
 }
 
 sk_sp<GrTextureProxy> GrAHardwareBufferImageGenerator::makeProxy(GrContext* context) {
-    if (context->contextPriv().abandoned() ||
-        kOpenGL_GrBackend != context->contextPriv().getBackend()) {
+    if (context->abandoned() || kOpenGL_GrBackend != context->contextPriv().getBackend()) {
         // Check if GrContext is not abandoned and the backend is GL.
         return nullptr;
     }
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index cc59c02..c651c48 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -273,7 +273,7 @@
                                          const SkMatrix* prePathMatrix,
                                          const SkIRect& clipBounds,
                                          bool pathIsMutable) {
-    if (context->contextPriv().abandoned()) {
+    if (context->abandoned()) {
         return;
     }
 
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index b4387e2..a34ee88 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -255,6 +255,11 @@
     fTextBlobCache->freeAll();
 }
 
+bool GrContext::abandoned() const {
+    ASSERT_SINGLE_OWNER
+    return fDrawingManager->wasAbandoned();
+}
+
 void GrContext::releaseResourcesAndAbandonContext() {
     ASSERT_SINGLE_OWNER
 
@@ -1010,7 +1015,7 @@
                                                         const SkSurfaceProps* surfaceProps,
                                                         SkBudgeted budgeted) {
     SkASSERT(sampleCnt > 0);
-    if (this->abandoned()) {
+    if (fContext->abandoned()) {
         return nullptr;
     }
 
@@ -1044,11 +1049,6 @@
     return renderTargetContext;
 }
 
-bool GrContextPriv::abandoned() const {
-    ASSERT_SINGLE_OWNER_PRIV
-    return fContext->fDrawingManager->wasAbandoned();
-}
-
 std::unique_ptr<GrFragmentProcessor> GrContext::createPMToUPMEffect(
         std::unique_ptr<GrFragmentProcessor> fp, bool useConfigConversionEffect) {
     ASSERT_SINGLE_OWNER
diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h
index 8d4b1ed..4f392f8 100644
--- a/src/gpu/GrContextPriv.h
+++ b/src/gpu/GrContextPriv.h
@@ -246,8 +246,6 @@
                                                  const SkSurfaceProps* surfaceProps = nullptr,
                                                  SkBudgeted budgeted = SkBudgeted::kYes);
 
-    bool abandoned() const;
-
     /** Reset GPU stats */
     void resetGpuStats() const ;
 
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index ca3d559..819acd2 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1041,7 +1041,7 @@
     ASSERT_SINGLE_OWNER
     GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawSprite", fContext.get());
 
-    if (fContext->contextPriv().abandoned()) {
+    if (fContext->abandoned()) {
         return;
     }
 
diff --git a/src/gpu/text/GrTextContext.cpp b/src/gpu/text/GrTextContext.cpp
index 6da4c0d..a20ba44 100644
--- a/src/gpu/text/GrTextContext.cpp
+++ b/src/gpu/text/GrTextContext.cpp
@@ -103,7 +103,7 @@
                                  const SkTextBlob* blob, SkScalar x, SkScalar y,
                                  SkDrawFilter* drawFilter, const SkIRect& clipBounds) {
     // If we have been abandoned, then don't draw
-    if (context->contextPriv().abandoned()) {
+    if (context->abandoned()) {
         return;
     }
 
@@ -316,7 +316,7 @@
                                 int scalarsPerPosition, const SkPoint& offset,
                                 const SkIRect& regionClipBounds) {
     GrTextUtils::Paint paint(&skPaint, &target->colorSpaceInfo());
-    if (context->contextPriv().abandoned()) {
+    if (context->abandoned()) {
         return;
     }