Index: components/crash/content/app/breakpad_mac.mm |
diff --git a/components/crash/content/app/breakpad_mac.mm b/components/crash/content/app/breakpad_mac.mm |
index d7ab1ae6389a1a36759d3b637a767d33f13a188d..1a13b200ebbd44c37097e8bb6e210032e64f9ef9 100644 |
--- a/components/crash/content/app/breakpad_mac.mm |
+++ b/components/crash/content/app/breakpad_mac.mm |
@@ -73,11 +73,22 @@ void ClearCrashKeyValueImpl(const base::StringPiece& key) { |
} |
} |
-bool FatalMessageHandler(int severity, const char* file, int line, |
- size_t message_start, const std::string& str) { |
+class FatalMessageListener : logging::LogMessageListener { |
+ void OnMessage(int severity, |
+ const char* file, |
+ int line, |
+ size_t message_start, |
+ const std::string& str) override; |
+}; |
+ |
+void FatalMessageListener::OnMessage(int severity, |
+ const char* file, |
+ int line, |
+ size_t message_start, |
+ const std::string& str) { |
// Do not handle non-FATAL. |
if (severity != logging::LOG_FATAL) |
- return false; |
+ return; |
// In case of OOM condition, this code could be reentered when |
// constructing and storing the key. Using a static is not |
@@ -85,7 +96,7 @@ bool FatalMessageHandler(int severity, const char* file, int line, |
// fatal crash at the same time, this should work. |
static bool guarded = false; |
if (guarded) |
- return false; |
+ return; |
base::AutoReset<bool> guard(&guarded, true); |
@@ -104,7 +115,7 @@ bool FatalMessageHandler(int severity, const char* file, int line, |
// Rather than including the code to force the crash here, allow the |
// caller to do it. |
- return false; |
+ return; |
} |
// BreakpadGenerateAndSendReport() does not report the current |
@@ -264,7 +275,9 @@ void InitCrashReporter(const std::string& process_type) { |
SetCrashKeyValue(@"prod", [info_dictionary objectForKey:@BREAKPAD_PRODUCT]); |
SetCrashKeyValue(@"plat", @"OS X"); |
- logging::SetLogMessageHandler(&FatalMessageHandler); |
+ // Intentionally leak the listener. |
+ new FatalMessageListener(); |
+ |
base::debug::SetDumpWithoutCrashingFunction(&DumpHelper::DumpWithoutCrashing); |
// abort() sends SIGABRT, which breakpad does not intercept. |