mac: Tune parameters of breakpad.

This commit is contained in:
Cheng Zhao 2013-11-13 17:20:13 +08:00
parent 8f2dd91e34
commit 8f558fb252

View file

@ -4,7 +4,8 @@
#include "browser/crash_reporter.h" #include "browser/crash_reporter.h"
#include "base/logging.h" #include "browser/browser.h"
#include "base/mac/mac_util.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "common/atom_version.h" #include "common/atom_version.h"
#import "vendor/breakpad/src/client/apple/Framework/BreakpadDefines.h" #import "vendor/breakpad/src/client/apple/Framework/BreakpadDefines.h"
@ -16,14 +17,31 @@ namespace {
class ScopedCrashReporter { class ScopedCrashReporter {
public: public:
ScopedCrashReporter() { ScopedCrashReporter() : is_browser_(!base::mac::IsBackgroundOnlyProcess()) {
NSMutableDictionary* parameters = NSMutableDictionary* parameters =
[NSMutableDictionary dictionaryWithCapacity:4]; [NSMutableDictionary dictionaryWithCapacity:4];
[parameters setValue:@"Atom-Shell" forKey:@BREAKPAD_PRODUCT]; [parameters setValue:@"Atom-Shell" forKey:@BREAKPAD_PRODUCT];
[parameters setValue:@"GitHub, Inc" forKey:@BREAKPAD_VENDOR]; [parameters setValue:@"GitHub, Inc" forKey:@BREAKPAD_VENDOR];
[parameters setValue:@"0" forKey:@BREAKPAD_REPORT_INTERVAL];
// Use application's version for crashes in browser.
if (is_browser_) {
std::string version = atom::Browser::Get()->GetVersion();
[parameters setValue:base::SysUTF8ToNSString(version)
forKey:@BREAKPAD_VERSION];
} else {
[parameters setValue:@ATOM_VERSION_STRING forKey:@BREAKPAD_VERSION]; [parameters setValue:@ATOM_VERSION_STRING forKey:@BREAKPAD_VERSION];
// Use my server as /dev/null for now. }
// Report all crashes (important for testing the crash reporter).
[parameters setValue:@"0" forKey:@BREAKPAD_REPORT_INTERVAL];
// Let the crash reporter log everything in Console.app.
[parameters setValue:@"NO" forKey:@BREAKPAD_SEND_AND_EXIT];
// Send the report by default.
[parameters setValue:@"YES" forKey:@BREAKPAD_SKIP_CONFIRM];
// Use my server as /dev/null if not specified.
[parameters setValue:@"http://54.249.141.255" forKey:@BREAKPAD_URL]; [parameters setValue:@"http://54.249.141.255" forKey:@BREAKPAD_URL];
breakpad_ = BreakpadCreate(parameters); breakpad_ = BreakpadCreate(parameters);
@ -45,6 +63,7 @@ class ScopedCrashReporter {
private: private:
BreakpadRef breakpad_; BreakpadRef breakpad_;
bool is_browser_;
static ScopedCrashReporter* g_scoped_crash_reporter_; static ScopedCrashReporter* g_scoped_crash_reporter_;