Add GrResourceAllocator class + unit test

Change-Id: I2700e8cb4213479b680519ba67f078cc3fb71376
Reviewed-on: https://skia-review.googlesource.com/23661
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h
index 7aa9447..f899f75 100644
--- a/include/private/GrSurfaceProxy.h
+++ b/include/private/GrSurfaceProxy.h
@@ -329,6 +329,7 @@
 
     bool isWrapped_ForTesting() const;
 
+    SkDEBUGCODE(bool isInstantiated() const { return SkToBool(fTarget); })
     SkDEBUGCODE(void validate(GrContext*) const;)
 
     // Provides access to functions that aren't part of the public API.
@@ -367,6 +368,13 @@
         return this->internalHasPendingWrite();
     }
 
+    virtual sk_sp<GrSurface> createSurface(GrResourceProvider*) const = 0;
+    void assign(sk_sp<GrSurface> surface);
+
+    sk_sp<GrSurface> createSurfaceImpl(GrResourceProvider*, int sampleCnt,
+                                       GrSurfaceFlags flags, bool isMipMapped,
+                                       SkDestinationSurfaceColorMode mipColorMode) const;
+
     bool instantiateImpl(GrResourceProvider* resourceProvider, int sampleCnt,
                          GrSurfaceFlags flags, bool isMipMapped,
                          SkDestinationSurfaceColorMode mipColorMode);