Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1248)

Unified Diff: components/crash/content/app/breakpad_mac.mm

Issue 2034393004: Allow multiple logging::LogMessage{Handler,Listener}s Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments, deque for listeners, reentrant test Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 6c6934bfa7ea832e707bcdbaef9ceab1cdf0ebff..163e0283e31c43828ddf6338066af8f2f7880c8f 100644
--- a/components/crash/content/app/breakpad_mac.mm
+++ b/components/crash/content/app/breakpad_mac.mm
@@ -73,8 +73,19 @@ void ClearCrashKeyValueImpl(const base::StringPiece& key) {
}
}
-bool FatalMessageHandler(int severity, const char* file, int line,
- size_t message_start, const std::string& str) {
+class FatalMessageHandler : logging::LogMessageHandler {
+ bool OnMessage(int severity,
+ const char* file,
+ int line,
+ size_t message_start,
+ const std::string& str) override;
+};
+
+bool FatalMessageHandler::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;
@@ -264,7 +275,10 @@ void InitCrashReporter(const std::string& process_type) {
SetCrashKeyValue(@"prod", [info_dictionary objectForKey:@BREAKPAD_PRODUCT]);
SetCrashKeyValue(@"plat", @"OS X");
- logging::SetLogMessageHandler(&FatalMessageHandler);
+ // Intentionally leak the handler.
+ auto* log_handler = new FatalMessageHandler();
+ CHECK(log_handler);
+
base::debug::SetDumpWithoutCrashingFunction(&DumpHelper::DumpWithoutCrashing);
// abort() sends SIGABRT, which breakpad does not intercept.

Powered by Google App Engine
This is Rietveld 408576698