Improve flush-time op spew (esp. for DDL tasks)

This CL also centralizes how the SkSurfaceProxy is output.

Change-Id: Ibdba1535e65ef21ce206778a8d757ee341334ec0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/352081
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrDDLTask.cpp b/src/gpu/GrDDLTask.cpp
index a6be087..57f8dce 100644
--- a/src/gpu/GrDDLTask.cpp
+++ b/src/gpu/GrDDLTask.cpp
@@ -106,11 +106,34 @@
 }
 
 #if GR_TEST_UTILS
-void GrDDLTask::dump(bool printDependencies) const {
-    INHERITED::dump(printDependencies);
+void GrDDLTask::dump(const SkString& label,
+                     SkString indent,
+                     bool printDependencies,
+                     bool close) const {
+    INHERITED::dump(label, indent, printDependencies, false);
 
+    SkDebugf("%sDDL Target: ", indent.c_str());
+    if (fDDLTarget) {
+        SkString proxyStr = fDDLTarget->dump();
+        SkDebugf("%s", proxyStr.c_str());
+    }
+    SkDebugf("\n");
+
+    SkDebugf("%s%d sub-tasks\n", indent.c_str(), fDDL->priv().numRenderTasks());
+
+    SkString subIndent(indent);
+    subIndent.append("    ");
+
+    int index = 0;
     for (auto& task : fDDL->priv().renderTasks()) {
-        task->dump(printDependencies);
+        SkString subLabel;
+        subLabel.printf("sub-task %d/%d", index++, fDDL->priv().numRenderTasks());
+        task->dump(subLabel, subIndent, printDependencies, true);
+    }
+
+    if (close) {
+        SkDebugf("%s--------------------------------------------------------------\n\n",
+                 indent.c_str());
     }
 }
 #endif