Remove GrSurfaceProxy::MakeWrapped (take 2)

TBR=bsalomon@google.com
Change-Id: I26fd911da502fb00addacb8b2c1a263efc5aa4ec
Reviewed-on: https://skia-review.googlesource.com/95881
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h
index 4c93886..f0b1bbd 100644
--- a/src/gpu/GrProxyProvider.h
+++ b/src/gpu/GrProxyProvider.h
@@ -32,7 +32,7 @@
      * Assigns a unique key to a proxy. The proxy will be findable via this key using
      * findProxyByUniqueKey(). It is an error if an existing proxy already has a key.
      */
-    void assignUniqueKeyToProxy(const GrUniqueKey&, GrTextureProxy*);
+    bool assignUniqueKeyToProxy(const GrUniqueKey&, GrTextureProxy*);
 
     /*
      * Sets the unique key of the provided proxy to the unique key of the surface. The surface must
@@ -102,10 +102,17 @@
     sk_sp<GrTextureProxy> createProxy(const GrSurfaceDesc&, SkBackingFit, SkBudgeted,
                                       uint32_t flags = 0);
 
+    // These match the definitions in SkImage & GrTexture.h, for whence they came
+    typedef void* ReleaseContext;
+    typedef void (*ReleaseProc)(ReleaseContext);
+
     /*
      * Create a texture proxy that wraps a (non-renderable) backend texture.
      */
-    sk_sp<GrTextureProxy> createWrappedTextureProxy(const GrBackendTexture&, GrSurfaceOrigin);
+    sk_sp<GrTextureProxy> createWrappedTextureProxy(const GrBackendTexture&, GrSurfaceOrigin,
+                                                    GrWrapOwnership = kBorrow_GrWrapOwnership,
+                                                    ReleaseProc = nullptr,
+                                                    ReleaseContext = nullptr);
 
     /*
      * Create a texture proxy that wraps a backend texture and is both texture-able and renderable
@@ -188,6 +195,10 @@
     void removeAllUniqueKeys();
 
 private:
+    friend class GrAHardwareBufferImageGenerator; // for createWrapped
+
+    sk_sp<GrTextureProxy> createWrapped(sk_sp<GrTexture> tex, GrSurfaceOrigin origin);
+
     struct UniquelyKeyedProxyHashTraits {
         static const GrUniqueKey& GetKey(const GrTextureProxy& p) { return p.getUniqueKey(); }