diff options
author | lambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-30 02:46:13 +0000 |
---|---|---|
committer | lambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-30 02:46:13 +0000 |
commit | 831d8d69b132e8e0f1b065ddc574c58a0815b9de (patch) | |
tree | 41610ee42378975015c55042b74b5924082fa9da /remoting/base | |
parent | b2136f12808223e1fd3bc07606b131daed359ba0 (diff) | |
download | chromium_src-831d8d69b132e8e0f1b065ddc574c58a0815b9de.zip chromium_src-831d8d69b132e8e0f1b065ddc574c58a0815b9de.tar.gz chromium_src-831d8d69b132e8e0f1b065ddc574c58a0815b9de.tar.bz2 |
Mac Breakpad integration for Chromoting Host (disabled for now)
This adds Breakpad initialization, and the necessary Breakpad
components to the Me2Me host bundle.
Tested by tweaking the code to enable Breakpad, and to upload to
a test server instead of the production URL.
BUG=136579
Review URL: https://chromiumcodereview.appspot.com/11308267
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170369 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/base')
-rw-r--r-- | remoting/base/breakpad_mac.mm | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/remoting/base/breakpad_mac.mm b/remoting/base/breakpad_mac.mm index 84cba44..abc2159 100644 --- a/remoting/base/breakpad_mac.mm +++ b/remoting/base/breakpad_mac.mm @@ -4,11 +4,66 @@ #include "remoting/base/breakpad.h" +#include <Foundation/Foundation.h> + +#include "base/logging.h" +#import "base/mac/scoped_nsautorelease_pool.h" +#import "breakpad/src/client/mac/Framework/Breakpad.h" + namespace remoting { void InitializeCrashReporting() { - // TODO(alexeypa) Implement crash dump collection on Mac; see - // http://crbug.com/130678. + base::mac::ScopedNSAutoreleasePool autorelease_pool; + + NSBundle* main_bundle = [NSBundle mainBundle]; + + // Tell Breakpad where crash_inspector and crash_report_sender are. + NSString* resource_path = [main_bundle resourcePath]; + NSString* inspector_location = + [resource_path stringByAppendingPathComponent:@"crash_inspector"]; + NSString* reporter_bundle_location = + [resource_path stringByAppendingPathComponent:@"crash_report_sender.app"]; + NSString* reporter_location = + [[NSBundle bundleWithPath:reporter_bundle_location] executablePath]; + + NSDictionary* info_dictionary = [main_bundle infoDictionary]; + NSMutableDictionary* breakpad_config = + [[info_dictionary mutableCopy] autorelease]; + [breakpad_config setObject:inspector_location + forKey:@BREAKPAD_INSPECTOR_LOCATION]; + [breakpad_config setObject:reporter_location + forKey:@BREAKPAD_REPORTER_EXE_LOCATION]; + + // Configure Breakpad settings here, if they are not already customized in + // the Info.plist. These settings should be added to the plist, but the + // problem is that the Breakpad URL contains a double-slash, which is broken + // by the INFOPLIST_PREPROCESS step. + // TODO(lambroslambrou): Add these to the Info.plist, similarly to what is + // done for Chrome Framework - see 'Tweak Info.plist' in + // chrome/chrome_dll_bundle.gypi. + if (![breakpad_config objectForKey:@BREAKPAD_SKIP_CONFIRM]) { + // Skip the upload confirmation dialog, since this is a remote-access + // service that shouldn't rely on a console user to dismiss any prompt. + // Also, this may be running in the LoginWindow context, where prompting + // might not be possible. + [breakpad_config setObject:@"YES" + forKey:@BREAKPAD_SKIP_CONFIRM]; + } + if (![breakpad_config objectForKey:@BREAKPAD_REPORT_INTERVAL]) { + // Set a minimum 6-hour interval between crash-reports, to match the + // throttling used on Windows. + [breakpad_config setObject:@"21600" + forKey:@BREAKPAD_REPORT_INTERVAL]; + } + if (![breakpad_config objectForKey:@BREAKPAD_URL]) { + // TODO(lambroslambrou): Use the production URL once permission is granted. + [breakpad_config setObject:@"https://clients2.google.com/cr/staging_report" + forKey:@BREAKPAD_URL]; + } + + if (!BreakpadCreate(breakpad_config)) { + LOG(ERROR) << "Breakpad initialization failed"; + } } } // namespace remoting |