Index: base/logging.cc |
diff --git a/base/logging.cc b/base/logging.cc |
index 4904f18646f122872cbd02eaff96e58576d32710..f0e077c5784f0802eec8f0af8ba4120cae2f3399 100644 |
--- a/base/logging.cc |
+++ b/base/logging.cc |
@@ -57,6 +57,7 @@ typedef pthread_mutex_t* MutexHandle; |
#include "base/command_line.h" |
#include "base/debug/alias.h" |
#include "base/debug/debugger.h" |
+#include "base/debug/dump_without_crashing.h" |
#include "base/debug/stack_trace.h" |
#include "base/posix/eintr_wrapper.h" |
#include "base/strings/string_piece.h" |
@@ -124,6 +125,7 @@ bool show_error_dialogs = false; |
// An assert handler override specified by the client to be called instead of |
// the debug message dialog and process termination. |
LogAssertHandlerFunction log_assert_handler = nullptr; |
+ |
// A log message handler that gets notified of every log message we process. |
LogMessageHandlerFunction log_message_handler = nullptr; |
@@ -343,6 +345,20 @@ void CloseLogFileUnlocked() { |
} // namespace |
+#if defined(DCHECK_IS_DUMP_WITHOUT_CRASH) |
+// Used to implement dump-on-DCHECK. See crbug.com/596231. |
+void DCheckDumpWithoutCrashingOnce() { |
+ // To ensure we don't risk spamming Crash with dump-on-DCHECK reports we |
+ // log only the first[*] DCHECK to fail once DumpWithoutCrashing() is |
+ // working. |
+ // [*] This is racey, but in the pathological case still only results in |
+ // one dump per-racing-thread, rather than one per-process. |
+ static bool dump_on_dcheck = true; |
+ if (dump_on_dcheck) |
+ dump_on_dcheck = !base::debug::DumpWithoutCrashing(); |
+} |
+#endif // defined(DCHECK_IS_DUMP_WITHOUT_CRASH) |
+ |
// This is never instantiated, it's just used for EAT_STREAM_PARAMETERS to have |
// an object of the correct type on the LHS of the unused part of the ternary |
// operator. |