Plumb abandonment throughout GrContext hierarchy

When the GrImageContext & GrRecordingContext are actually GrDirectContexts it is useful for them to report the abandonment state of the GrDirectContext.

When the GrImageContext & GrRecordingContext are actually GrImageCreationContext or GrDDLContexts then they will just never be abandoned.

This CL also strips the GrProxyProvider and GrDrawingManager of their tracking on abandonment and centralizes it in the GrImageContext.

ImageContext
  can't abandon
  can only check abandonment privately

RecordingContext
  can't abandon
  can only check abandonment privately

DirectContext (aka GrContext)
  can abandon publicly
  can check abandonment publicly

Note that abandoning the DirectContext won't alter the abandonment status of any of
the other contexts in its group (e.g., DDL contexts that may be being used to record).

Change-Id: Ib790f74d90ab18da58a127fed2aad20e2477bd21
Reviewed-on: https://skia-review.googlesource.com/c/190669
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/include/private/GrImageContext.h b/include/private/GrImageContext.h
index 018479c..324feef 100644
--- a/include/private/GrImageContext.h
+++ b/include/private/GrImageContext.h
@@ -27,6 +27,9 @@
 
     GrImageContext(GrBackendApi, const GrContextOptions&, uint32_t contextID);
 
+    virtual void abandonContext();
+    bool abandoned() const;
+
     GrProxyProvider* proxyProvider() { return fProxyProvider.get(); }
     const GrProxyProvider* proxyProvider() const { return fProxyProvider.get(); }
 
@@ -37,11 +40,12 @@
 
 private:
     std::unique_ptr<GrProxyProvider> fProxyProvider;
+    bool                             fAbandoned = false;
 
     // In debug builds we guard against improper thread handling
     // This guard is passed to the GrDrawingManager and, from there to all the
     // GrRenderTargetContexts.  It is also passed to the GrResourceProvider and SkGpuDevice.
-    mutable GrSingleOwner           fSingleOwner;
+    mutable GrSingleOwner            fSingleOwner;
 
     typedef GrContext_Base INHERITED;
 };