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

Side by Side 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: fix installation_validator_unittest Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ios/chrome/browser/crash_report/breakpad_helper.h" 5 #include "ios/chrome/browser/crash_report/breakpad_helper.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 const base::StringPiece& value) { 71 const base::StringPiece& value) {
72 AddReportParameter(base::SysUTF8ToNSString(key.as_string()), 72 AddReportParameter(base::SysUTF8ToNSString(key.as_string()),
73 base::SysUTF8ToNSString(value.as_string()), true); 73 base::SysUTF8ToNSString(value.as_string()), true);
74 } 74 }
75 75
76 // Callback for base::debug::SetCrashKeyReportingFunctions 76 // Callback for base::debug::SetCrashKeyReportingFunctions
77 void ClearCrashKeyValueImpl(const base::StringPiece& key) { 77 void ClearCrashKeyValueImpl(const base::StringPiece& key) {
78 RemoveReportParameter(base::SysUTF8ToNSString(key.as_string())); 78 RemoveReportParameter(base::SysUTF8ToNSString(key.as_string()));
79 } 79 }
80 80
81 // Callback for logging::SetLogMessageHandler 81 // Callback for logging::PushLogMessageHandler
82 bool FatalMessageHandler(int severity, 82 bool FatalMessageHandler(int severity,
83 const char* file, 83 const char* file,
84 int line, 84 int line,
85 size_t message_start, 85 size_t message_start,
86 const std::string& str) { 86 const std::string& str) {
87 // Do not handle non-FATAL. 87 // Do not handle non-FATAL.
88 if (severity != logging::LOG_FATAL) 88 if (severity != logging::LOG_FATAL)
89 return false; 89 return false;
90 90
91 // In case of OOM condition, this code could be reentered when 91 // In case of OOM condition, this code could be reentered when
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 forKey:kCrashReportsUploadingEnabledKey]; 123 forKey:kCrashReportsUploadingEnabledKey];
124 } 124 }
125 125
126 } // namespace 126 } // namespace
127 127
128 void Start(const std::string& channel_name) { 128 void Start(const std::string& channel_name) {
129 DCHECK(!g_crash_reporter_enabled); 129 DCHECK(!g_crash_reporter_enabled);
130 [[BreakpadController sharedInstance] start:YES]; 130 [[BreakpadController sharedInstance] start:YES];
131 base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValueImpl, 131 base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValueImpl,
132 &ClearCrashKeyValueImpl); 132 &ClearCrashKeyValueImpl);
133 logging::SetLogMessageHandler(&FatalMessageHandler); 133 logging::PushLogMessageHandler(&FatalMessageHandler);
134 g_crash_reporter_enabled = true; 134 g_crash_reporter_enabled = true;
135 // Register channel information. 135 // Register channel information.
136 if (channel_name.length()) { 136 if (channel_name.length()) {
137 AddReportParameter(@"channel", base::SysUTF8ToNSString(channel_name), true); 137 AddReportParameter(@"channel", base::SysUTF8ToNSString(channel_name), true);
138 } 138 }
139 // Notifying the PathService on the location of the crashes so that crashes 139 // Notifying the PathService on the location of the crashes so that crashes
140 // can be displayed to the user on the about:crashes page. 140 // can be displayed to the user on the about:crashes page.
141 NSArray* cachesDirectories = NSSearchPathForDirectoriesInDomains( 141 NSArray* cachesDirectories = NSSearchPathForDirectoriesInDomains(
142 NSCachesDirectory, NSUserDomainMask, YES); 142 NSCachesDirectory, NSUserDomainMask, YES);
143 NSString* cachePath = [cachesDirectories objectAtIndex:0]; 143 NSString* cachePath = [cachesDirectories objectAtIndex:0];
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 void RestoreDefaultConfiguration() { 360 void RestoreDefaultConfiguration() {
361 if (!g_crash_reporter_enabled) 361 if (!g_crash_reporter_enabled)
362 return; 362 return;
363 [[BreakpadController sharedInstance] stop]; 363 [[BreakpadController sharedInstance] stop];
364 [[BreakpadController sharedInstance] resetConfiguration]; 364 [[BreakpadController sharedInstance] resetConfiguration];
365 [[BreakpadController sharedInstance] start:NO]; 365 [[BreakpadController sharedInstance] start:NO];
366 [[BreakpadController sharedInstance] setUploadingEnabled:NO]; 366 [[BreakpadController sharedInstance] setUploadingEnabled:NO];
367 } 367 }
368 368
369 } // namespace breakpad_helper 369 } // namespace breakpad_helper
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698