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

Unified Diff: ios/chrome/browser/crash_report/breakpad_helper.mm

Issue 2034393004: Allow multiple logging::LogMessage{Handler,Listener}s Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clean up, MockLog uses listener Created 4 years, 5 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
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 252df3da7c5b61499a37109909f392706885147d..efd82573eca19241d3e40502ca6b373adb15b263 100644
--- a/ios/chrome/browser/crash_report/breakpad_helper.mm
+++ b/ios/chrome/browser/crash_report/breakpad_helper.mm
@@ -78,15 +78,15 @@ 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) {
+// Callback for logging::AddLogMessageListener
+void FatalMessageListener(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
@@ -94,7 +94,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);
@@ -112,7 +112,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
@@ -130,7 +129,7 @@ void Start(const std::string& channel_name) {
[[BreakpadController sharedInstance] start:YES];
base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValueImpl,
&ClearCrashKeyValueImpl);
- logging::SetLogMessageHandler(&FatalMessageHandler);
+ logging::AddLogMessageListener(FatalMessageListener);
g_crash_reporter_enabled = true;
// Register channel information.
if (channel_name.length()) {

Powered by Google App Engine
This is Rietveld 408576698