Simplify GrResourceAllocator API

There's really only one failure at this point, and it's a failed
instantiation. The original intention of the allocation failure
system was to only drop the ops that referred to the uninstantiated
proxies, but somewhere along the way that was lost and
we started dropping arbitrarily large chunks of ops. Lets just
bail and not crash instead.

Bug: skia:10877
Change-Id: I675358e8a1fbd2d75ea29b72ccfc50c7df90343e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371337
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrResourceAllocator.cpp b/src/gpu/GrResourceAllocator.cpp
index 29bf950..fd5dc7f 100644
--- a/src/gpu/GrResourceAllocator.cpp
+++ b/src/gpu/GrResourceAllocator.cpp
@@ -70,7 +70,7 @@
     // with the same texture.
     if (proxy->readOnly()) {
         if (proxy->isLazy() && !proxy->priv().doLazyInstantiation(fResourceProvider)) {
-            fLazyInstantiationError = true;
+            fFailedInstantiation = true;
         } else {
             // Since we aren't going to add an interval we won't revisit this proxy in assign(). So
             // must already be instantiated or it must be a lazy proxy that we instantiated above.
@@ -293,17 +293,13 @@
     }
 }
 
-void GrResourceAllocator::assign(AssignError* outError) {
-    SkASSERT(outError);
-    *outError = fLazyInstantiationError ? AssignError::kFailedProxyInstantiation
-                                        : AssignError::kNoError;
-
+bool GrResourceAllocator::assign() {
     fIntvlHash.reset(); // we don't need the interval hash anymore
 
     SkDEBUGCODE(fAssigned = true;)
 
     if (fIntvlList.empty()) {
-        return;          // no resources to assign
+        return !fFailedInstantiation;          // no resources to assign
     }
 
 #if GR_ALLOCATION_SPEW
@@ -314,7 +310,8 @@
     // TODO: Can this be done inline during the main iteration?
     this->determineRecyclability();
 
-    while (Interval* cur = fIntvlList.popHead()) {
+    Interval* cur = nullptr;
+    while ((cur = fIntvlList.popHead()) && !fFailedInstantiation) {
         this->expire(cur->start());
 
         if (cur->proxy()->isInstantiated()) {
@@ -325,7 +322,7 @@
 
         if (cur->proxy()->isLazy()) {
             if (!cur->proxy()->priv().doLazyInstantiation(fResourceProvider)) {
-                *outError = AssignError::kFailedProxyInstantiation;
+                fFailedInstantiation = true;
             }
         } else if (sk_sp<GrSurface> surface = this->findSurfaceFor(cur->proxy())) {
             // TODO: make getUniqueKey virtual on GrSurfaceProxy
@@ -348,7 +345,7 @@
             cur->assign(std::move(surface));
         } else {
             SkASSERT(!cur->proxy()->isInstantiated());
-            *outError = AssignError::kFailedProxyInstantiation;
+            fFailedInstantiation = true;
         }
 
         fActiveIntvls.insertByIncreasingEnd(cur);
@@ -356,6 +353,7 @@
 
     // expire all the remaining intervals to drain the active interval list
     this->expire(std::numeric_limits<unsigned int>::max());
+    return !fFailedInstantiation;
 }
 
 #if GR_ALLOCATION_SPEW