From: Cheng Zhao Date: Wed, 13 Nov 2013 09:20:13 +0000 (+0800) Subject: mac: Tune parameters of breakpad. X-Git-Tag: v0.7.0~1^2~48 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=8f558fb252cf671e83a7f3d4202caec3970bcb24;p=electron.git mac: Tune parameters of breakpad. --- diff --git a/browser/crash_reporter_mac.mm b/browser/crash_reporter_mac.mm index b5eff717..46bdd7b8 100644 --- a/browser/crash_reporter_mac.mm +++ b/browser/crash_reporter_mac.mm @@ -4,7 +4,8 @@ #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 "common/atom_version.h" #import "vendor/breakpad/src/client/apple/Framework/BreakpadDefines.h" @@ -16,14 +17,31 @@ namespace { class ScopedCrashReporter { public: - ScopedCrashReporter() { + ScopedCrashReporter() : is_browser_(!base::mac::IsBackgroundOnlyProcess()) { NSMutableDictionary* parameters = [NSMutableDictionary dictionaryWithCapacity:4]; [parameters setValue:@"Atom-Shell" forKey:@BREAKPAD_PRODUCT]; [parameters setValue:@"GitHub, Inc" forKey:@BREAKPAD_VENDOR]; + + // 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]; + } + + // Report all crashes (important for testing the crash reporter). [parameters setValue:@"0" forKey:@BREAKPAD_REPORT_INTERVAL]; - [parameters setValue:@ATOM_VERSION_STRING forKey:@BREAKPAD_VERSION]; - // Use my server as /dev/null for now. + + // 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]; breakpad_ = BreakpadCreate(parameters); @@ -45,6 +63,7 @@ class ScopedCrashReporter { private: BreakpadRef breakpad_; + bool is_browser_; static ScopedCrashReporter* g_scoped_crash_reporter_;