Index: components/crash/content/app/crashpad.cc |
diff --git a/components/crash/content/app/crashpad.cc b/components/crash/content/app/crashpad.cc |
index 76f67348ab0fcb6cd0e7ed3412a410d31be569da..5d9753b5ed4b48bab92ae680617ad43a15dc308e 100644 |
--- a/components/crash/content/app/crashpad.cc |
+++ b/components/crash/content/app/crashpad.cc |
@@ -53,9 +53,8 @@ void ClearCrashKey(const base::StringPiece& key) { |
} |
bool LogMessageHandler(int severity, |
- const char* file, |
+ const std::string& file, |
int line, |
- size_t message_start, |
const std::string& string) { |
// Only handle FATAL. |
if (severity != logging::LOG_FATAL) { |
@@ -73,16 +72,15 @@ bool LogMessageHandler(int severity, |
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; |
- } |
- } |
- |
- CHECK_LE(message_start, string.size()); |
- std::string message = base::StringPrintf("%s:%d: %s", file, line, |
- string.c_str() + message_start); |
+ size_t last_slash = file.rfind('/'); |
+ if (last_slash == file.npos) |
+ last_slash = 0; |
+ else |
+ last_slash++; |
+ |
+ std::string message = base::StringPrintf("%s:%d: %s", |
+ file.substr(last_slash).c_str(), |
+ line, string.c_str()); |
SetCrashKeyValue("LOG_FATAL", message); |
// Rather than including the code to force the crash here, allow the caller to |
@@ -164,7 +162,7 @@ void InitializeCrashpadImpl(bool initial_client, |
SetCrashKeyValue("pid", base::IntToString(::GetCurrentProcessId())); |
#endif |
- logging::SetLogMessageHandler(LogMessageHandler); |
+ logging::AddLogMessageHandler(LogMessageHandler); |
// If clients called CRASHPAD_SIMULATE_CRASH() instead of |
// base::debug::DumpWithoutCrashing(), these dumps would appear as crashes in |