Index: components/crash/content/app/crashpad.cc |
diff --git a/components/crash/content/app/crashpad.cc b/components/crash/content/app/crashpad.cc |
index 85afe46af675145d2b1251ea5a3b9e5989123eb2..f7e49bbaba9398f83b5a910ebcd5ac16cf8aea1d 100644 |
--- a/components/crash/content/app/crashpad.cc |
+++ b/components/crash/content/app/crashpad.cc |
@@ -61,14 +61,22 @@ void ClearCrashKey(const base::StringPiece& key) { |
g_simple_string_dictionary->RemoveKey(key.data()); |
} |
-bool LogMessageHandler(int severity, |
- const char* file, |
- int line, |
- size_t message_start, |
- const std::string& string) { |
+class LogMessageListener : logging::LogMessageListener { |
+ void OnMessage(int severity, |
+ const char* file, |
+ int line, |
+ size_t message_start, |
+ const std::string& string) override; |
+}; |
+ |
+void LogMessageListener::OnMessage(int severity, |
+ const char* file, |
+ int line, |
+ size_t message_start, |
+ const std::string& string) { |
// Only handle FATAL. |
if (severity != logging::LOG_FATAL) { |
- return false; |
+ return; |
} |
// In case of an out-of-memory condition, this code could be reentered when |
@@ -77,7 +85,7 @@ bool LogMessageHandler(int severity, |
// should work. |
static bool guarded = false; |
if (guarded) { |
- return false; |
+ return; |
} |
base::AutoReset<bool> guard(&guarded, true); |
@@ -96,7 +104,6 @@ bool LogMessageHandler(int severity, |
// Rather than including the code to force the crash here, allow the caller to |
// do it. |
- return false; |
} |
void DumpWithoutCrashing() { |
@@ -241,7 +248,9 @@ void InitializeCrashpadImpl(bool initial_client, |
SetCrashKeyValue("pid", base::IntToString(::GetCurrentProcessId())); |
#endif |
- logging::SetLogMessageHandler(LogMessageHandler); |
+ // Intentionally leak the listener. |
+ auto* listener = new LogMessageListener(); |
+ CHECK(listener); |
brettw
2016/11/14 22:01:31
Ditto
wychen
2016/11/18 21:14:00
Done.
|
// If clients called CRASHPAD_SIMULATE_CRASH() instead of |
// base::debug::DumpWithoutCrashing(), these dumps would appear as crashes in |