| Index: ios/chrome/browser/crash_report/breakpad_helper.mm
|
| diff --git a/ios/chrome/browser/crash_report/breakpad_helper.mm b/ios/chrome/browser/crash_report/breakpad_helper.mm
|
| index 4ae4326a950f17503efd274a8578d9e974dc80fd..aa9b0714c18602b1399c80458567a8b5bd159f64 100644
|
| --- a/ios/chrome/browser/crash_report/breakpad_helper.mm
|
| +++ b/ios/chrome/browser/crash_report/breakpad_helper.mm
|
| @@ -82,15 +82,22 @@ void ClearCrashKeyValueImpl(const base::StringPiece& key) {
|
| RemoveReportParameter(base::SysUTF8ToNSString(key.as_string()));
|
| }
|
|
|
| -// Callback for logging::SetLogMessageHandler
|
| -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
|
| @@ -98,7 +105,7 @@ bool FatalMessageHandler(int severity,
|
| // fatal crash at the same time, this should work.
|
| static bool guarded = false;
|
| if (guarded)
|
| - return false;
|
| + return;
|
|
|
| base::AutoReset<bool> guard(&guarded, true);
|
|
|
| @@ -116,7 +123,6 @@ bool FatalMessageHandler(int severity,
|
|
|
| // Rather than including the code to force the crash here, allow the
|
| // caller to do it.
|
| - return false;
|
| }
|
|
|
| // Caches the uploading flag in NSUserDefaults, so that we can access the value
|
| @@ -134,7 +140,10 @@ void Start(const std::string& channel_name) {
|
| [[BreakpadController sharedInstance] start:YES];
|
| base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValueImpl,
|
| &ClearCrashKeyValueImpl);
|
| - logging::SetLogMessageHandler(&FatalMessageHandler);
|
| + // Intentionally leak the listener.
|
| + auto* listener = new FatalMessageListener();
|
| + CHECK(listener);
|
| +
|
| g_crash_reporter_enabled = true;
|
| // Register channel information.
|
| if (channel_name.length()) {
|
|
|