Check budget for task reordering and report stats

In this CL we don't actually bail and use the record-time-ordered
DAG in this case, but we at least will see which perf bots with
reordering turned on are going over budget.

Bug: skia:10877
Change-Id: I38666166f15a7c168eadf262f7e975822c4308db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/394158
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index e1ce658..abf9c94 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -211,8 +211,15 @@
             task->gatherProxyIntervals(&alloc);
         }
 
-        // TODO: Call makeBudgetHeadroom before proceeding with reordered DAG.
-        flushed = alloc.planAssignment() && alloc.assign() && this->executeRenderTasks(&flushState);
+        if (alloc.planAssignment()) {
+            if (fReduceOpsTaskSplitting) {
+                if (!alloc.makeBudgetHeadroom()) {
+                    // TODO: Switch to the original DAG in this case.
+                    gpu->stats()->incNumReorderedDAGsOverBudget();
+                }
+            }
+            flushed = alloc.assign() && this->executeRenderTasks(&flushState);
+        }
     }
     this->removeRenderTasks();