[Impeller] Make validation logs non-fatal by default. (#40855)

[Impeller] Make validation logs non-fatal by default.
diff --git a/impeller/base/validation.cc b/impeller/base/validation.cc
index 94e35fc..d3f54a7 100644
--- a/impeller/base/validation.cc
+++ b/impeller/base/validation.cc
@@ -11,6 +11,11 @@
 namespace impeller {
 
 static std::atomic_int32_t sValidationLogsDisabledCount = 0;
+static bool sValidationLogsAreFatal = false;
+
+void ImpellerValidationErrorsSetFatal(bool fatal) {
+  sValidationLogsAreFatal = fatal;
+}
 
 ScopedValidationDisable::ScopedValidationDisable() {
   sValidationLogsDisabledCount++;
@@ -24,12 +29,7 @@
 
 ValidationLog::~ValidationLog() {
   if (sValidationLogsDisabledCount <= 0) {
-#if (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_RELEASE)
-    FML_LOG(ERROR) << stream_.str();
-    ImpellerValidationBreak();
-#else
-    FML_LOG(FATAL) << stream_.str();
-#endif
+    ImpellerValidationBreak(stream_.str().c_str());
   }
 }
 
@@ -37,10 +37,18 @@
   return stream_;
 }
 
-void ImpellerValidationBreak() {
-  // Nothing to do. Exists for the debugger.
-  FML_LOG(ERROR) << "Break on " << __FUNCTION__
-                 << " to inspect point of failure.";
+void ImpellerValidationBreak(const char* message) {
+// Nothing to do. Exists for the debugger.
+#if FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE
+  std::stringstream stream;
+  stream << "Break on '" << __FUNCTION__
+         << "' to inspect point of failure: " << message;
+  if (sValidationLogsAreFatal) {
+    FML_LOG(FATAL) << stream.str();
+  } else {
+    FML_LOG(INFO) << stream.str();
+  }
+#endif  // FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE
 }
 
 }  // namespace impeller
diff --git a/impeller/base/validation.h b/impeller/base/validation.h
index 18bb1b5..e3e93dd 100644
--- a/impeller/base/validation.h
+++ b/impeller/base/validation.h
@@ -24,7 +24,9 @@
   FML_DISALLOW_COPY_ASSIGN_AND_MOVE(ValidationLog);
 };
 
-void ImpellerValidationBreak();
+void ImpellerValidationBreak(const char* message);
+
+void ImpellerValidationErrorsSetFatal(bool fatal);
 
 struct ScopedValidationDisable {
   ScopedValidationDisable();
diff --git a/impeller/playground/playground_test.cc b/impeller/playground/playground_test.cc
index 95297cf..613add3 100644
--- a/impeller/playground/playground_test.cc
+++ b/impeller/playground/playground_test.cc
@@ -5,6 +5,7 @@
 #include "flutter/fml/time/time_point.h"
 
 #include "impeller/base/timing.h"
+#include "impeller/base/validation.h"
 #include "impeller/playground/playground_test.h"
 
 namespace impeller {
@@ -25,6 +26,8 @@
     return;
   }
 
+  ImpellerValidationErrorsSetFatal(true);
+
   SetupContext(GetParam());
   SetupWindow();
 }