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

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: rebase Created 3 years, 11 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
« no previous file with comments | « chrome/test/chromedriver/logging.cc ('k') | components/crash/content/app/crashpad.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « chrome/test/chromedriver/logging.cc ('k') | components/crash/content/app/crashpad.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698