formalize host debugging

Pathops writes files, anticipating upcoming crashes,
and verifies the results against regions.

Formalize these debugging methods so that they
are more easily triggered by hosts outside of
skia unit tests.

TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2441763003

Review-Url: https://codereview.chromium.org/2441763003
diff --git a/src/pathops/SkPathOpsSimplify.cpp b/src/pathops/SkPathOpsSimplify.cpp
index f9f8f5c..d587c3b 100644
--- a/src/pathops/SkPathOpsSimplify.cpp
+++ b/src/pathops/SkPathOpsSimplify.cpp
@@ -158,6 +158,11 @@
     SkOpGlobalState globalState(contourList, &allocator
             SkDEBUGPARAMS(skipAssert) SkDEBUGPARAMS(testName));
     SkOpCoincidence coincidence(&globalState);
+#ifdef SK_DEBUG
+    if (SkPathOpsDebug::gDumpOp) {
+        SkPathOpsDebug::DumpSimplify(path, testName);
+    }
+#endif
     SkScalar scaleFactor = ScaleFactor(path);
     SkPath scaledPath;
     const SkPath* workingPath;
@@ -218,5 +223,15 @@
 }
 
 bool Simplify(const SkPath& path, SkPath* result) {
+#ifdef SK_DEBUG
+    if (SkPathOpsDebug::gVerifyOp) {
+        if (!SimplifyDebug(path, result  SkDEBUGPARAMS(false) SkDEBUGPARAMS(nullptr))) {
+            SkPathOpsDebug::ReportSimplifyFail(path);
+            return false;
+        }
+        SkPathOpsDebug::VerifySimplify(path, *result);
+        return true;
+    }
+#endif
     return SimplifyDebug(path, result  SkDEBUGPARAMS(true) SkDEBUGPARAMS(nullptr));
 }