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

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

Issue 2497833002: support multiple log message handlers in base/logging.h (Closed)
Patch Set: Created 4 years, 1 month 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..36d25b204abd955cb19ecac5276c9bfbadd3b509 100644
--- a/components/crash/content/app/breakpad_mac.mm
+++ b/components/crash/content/app/breakpad_mac.mm
@@ -73,8 +73,8 @@ void ClearCrashKeyValueImpl(const base::StringPiece& key) {
}
}
-bool FatalMessageHandler(int severity, const char* file, int line,
- size_t message_start, const std::string& str) {
+bool FatalMessageHandler(int severity, const std::string&, int line,
+ const std::string& str) {
// Do not handle non-FATAL.
if (severity != logging::LOG_FATAL)
return false;
@@ -90,16 +90,17 @@ bool FatalMessageHandler(int severity, const char* file, int line,
base::AutoReset<bool> guard(&guarded, true);
// Only log last path component. This matches logging.cc.
- if (file) {
- const char* slash = strrchr(file, '/');
- if (slash)
- file = slash + 1;
- }
+ size_t last_slash = file.rfind('/');
+ if (last_slash == file.npos)
+ last_slash = 0;
+ else
+ last_slash++;
NSString* fatal_key = @"LOG_FATAL";
NSString* fatal_value =
[NSString stringWithFormat:@"%s:%d: %s",
- file, line, str.c_str() + message_start];
+ file.substr(last_slash).c_str(), line,
+ str.c_str()];
SetCrashKeyValue(fatal_key, fatal_value);
// Rather than including the code to force the crash here, allow the
@@ -264,7 +265,7 @@ void InitCrashReporter(const std::string& process_type) {
SetCrashKeyValue(@"prod", [info_dictionary objectForKey:@BREAKPAD_PRODUCT]);
SetCrashKeyValue(@"plat", @"OS X");
- logging::SetLogMessageHandler(&FatalMessageHandler);
+ logging::AddLogMessageHandler(&FatalMessageHandler);
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