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

Unified Diff: chrome/browser/chrome_application_mac.mm

Issue 269039: [Mac] Add breakpad info for crashes in the target/action dispatcher. (Closed)
Patch Set: Fix build problem with all.xcodeproj chromium_builder_dbg Created 11 years, 2 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
« no previous file with comments | « no previous file | chrome/chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_application_mac.mm
diff --git a/chrome/browser/chrome_application_mac.mm b/chrome/browser/chrome_application_mac.mm
index a81326f73710d817c39bbc20e15021f4a63cdf96..2457dc27961c478173acc9348b4ddaf3eb207401 100644
--- a/chrome/browser/chrome_application_mac.mm
+++ b/chrome/browser/chrome_application_mac.mm
@@ -4,6 +4,30 @@
#import "chrome/browser/chrome_application_mac.h"
+#import "base/scoped_nsobject.h"
+#import "chrome/app/breakpad_mac.h"
+
+namespace {
+
+// Helper to make it easy to get crash keys right.
+// TODO(shess): Find a better home for this. app/breakpad_mac.h
+// doesn't work.
+class ScopedCrashKey {
+ public:
+ ScopedCrashKey(NSString* key, NSString* value)
+ : crash_key_([key retain]) {
+ SetCrashKeyValue(crash_key_.get(), value);
+ }
+ ~ScopedCrashKey() {
+ ClearCrashKeyValue(crash_key_.get());
+ }
+
+ private:
+ scoped_nsobject<NSString> crash_key_;
+};
+
+} // namespace
+
@implementation CrApplication
// -terminate: is the entry point for orderly "quit" operations in Cocoa.
@@ -80,6 +104,29 @@
}
}
+ // When a Cocoa control is wired to a freed object, we get crashers
+ // in the call to |super| with no useful information in the
+ // backtrace. Attempt to add some useful information.
+ static const NSString* kActionKey = @"sendaction";
+
+ // If the action is something generic like -commandDispatch:, then
+ // the tag is essential.
+ NSInteger tag = 0;
+ if ([sender isKindOfClass:[NSControl class]]) {
+ tag = [sender tag];
+ if (tag == 0 || tag == -1) {
+ tag = [sender selectedTag];
+ }
+ } else if ([sender isKindOfClass:[NSMenuItem class]]) {
+ tag = [sender tag];
+ }
+
+ NSString* actionString = NSStringFromSelector(anAction);
+ NSString* value =
+ [NSString stringWithFormat:@"%@ tag %d sending %@ to %p",
+ [sender className], tag, actionString, aTarget];
+
+ ScopedCrashKey key(kActionKey, value);
return [super sendAction:anAction to:aTarget from:sender];
}
« no previous file with comments | « no previous file | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698