Add overbudget handling to GrResourceAllocator

Change-Id: I5536c908310e907c77b5d55441a0edac6a74bf0e
Reviewed-on: https://skia-review.googlesource.com/71182
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index 3e188b8..71ff637 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -42,8 +42,8 @@
     SkASSERT(!fLastOpList);
 }
 
-static bool attach_stencil_if_needed(GrResourceProvider* resourceProvider,
-                                     GrSurface* surface, bool needsStencil) {
+bool GrSurfaceProxyPriv::AttachStencilIfNeeded(GrResourceProvider* resourceProvider,
+                                               GrSurface* surface, bool needsStencil) {
     if (needsStencil) {
         GrRenderTarget* rt = surface->asRenderTarget();
         if (!rt) {
@@ -88,7 +88,7 @@
 
     surface->asTexture()->texturePriv().setMipColorMode(mipColorMode);
 
-    if (!attach_stencil_if_needed(resourceProvider, surface.get(), needsStencil)) {
+    if (!GrSurfaceProxyPriv::AttachStencilIfNeeded(resourceProvider, surface.get(), needsStencil)) {
         return nullptr;
     }
 
@@ -115,7 +115,7 @@
         if (uniqueKey) {
             SkASSERT(fTarget->getUniqueKey() == *uniqueKey);
         }
-        return attach_stencil_if_needed(resourceProvider, fTarget, needsStencil);
+        return GrSurfaceProxyPriv::AttachStencilIfNeeded(resourceProvider, fTarget, needsStencil);
     }
 
     sk_sp<GrSurface> surface = this->createSurfaceImpl(resourceProvider, sampleCnt, needsStencil,