| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #import "chrome/browser/chrome_browser_application_mac.h" | 5 #import "chrome/browser/chrome_browser_application_mac.h" |
| 6 | 6 |
| 7 #import "base/auto_reset.h" | 7 #import "base/auto_reset.h" |
| 8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
| 9 #include "base/debug/stack_trace.h" |
| 9 #import "base/logging.h" | 10 #import "base/logging.h" |
| 10 #import "base/mac/scoped_nsexception_enabler.h" | 11 #import "base/mac/scoped_nsexception_enabler.h" |
| 11 #import "base/memory/scoped_nsobject.h" | 12 #import "base/memory/scoped_nsobject.h" |
| 12 #import "base/metrics/histogram.h" | 13 #import "base/metrics/histogram.h" |
| 13 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
| 14 #import "base/sys_string_conversions.h" | 15 #import "base/sys_string_conversions.h" |
| 15 #import "chrome/browser/app_controller_mac.h" | 16 #import "chrome/browser/app_controller_mac.h" |
| 16 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 17 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
| 17 #include "chrome/common/crash_keys.h" | 18 #include "chrome/common/crash_keys.h" |
| 18 #import "chrome/common/mac/objc_method_swizzle.h" | 19 #import "chrome/common/mac/objc_method_swizzle.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 if (aName == kAcceptableNSExceptionNames[i]) { | 60 if (aName == kAcceptableNSExceptionNames[i]) { |
| 60 found = YES; | 61 found = YES; |
| 61 } | 62 } |
| 62 } | 63 } |
| 63 | 64 |
| 64 if (!found) { | 65 if (!found) { |
| 65 // Update breakpad with the exception info. | 66 // Update breakpad with the exception info. |
| 66 std::string value = base::StringPrintf("%s reason %s", | 67 std::string value = base::StringPrintf("%s reason %s", |
| 67 [aName UTF8String], [aReason UTF8String]); | 68 [aName UTF8String], [aReason UTF8String]); |
| 68 base::debug::SetCrashKeyValue(crash_keys::mac::kNSException, value); | 69 base::debug::SetCrashKeyValue(crash_keys::mac::kNSException, value); |
| 70 base::debug::SetCrashKeyToStackTrace(crash_keys::mac::kNSExceptionTrace, |
| 71 base::debug::StackTrace()); |
| 69 | 72 |
| 70 // Force crash for selected exceptions to generate crash dumps. | 73 // Force crash for selected exceptions to generate crash dumps. |
| 71 BOOL fatal = NO; | 74 BOOL fatal = NO; |
| 72 if (aName == NSInternalInconsistencyException) { | 75 if (aName == NSInternalInconsistencyException) { |
| 73 NSString* const kNSMenuItemArrayBoundsCheck = | 76 NSString* const kNSMenuItemArrayBoundsCheck = |
| 74 @"Invalid parameter not satisfying: (index >= 0) && " | 77 @"Invalid parameter not satisfying: (index >= 0) && " |
| 75 @"(index < [_itemArray count])"; | 78 @"(index < [_itemArray count])"; |
| 76 if ([aReason isEqualToString:kNSMenuItemArrayBoundsCheck]) { | 79 if ([aReason isEqualToString:kNSMenuItemArrayBoundsCheck]) { |
| 77 fatal = YES; | 80 fatal = YES; |
| 78 } | 81 } |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 std::vector<NSWindow*>::iterator window_iterator = | 571 std::vector<NSWindow*>::iterator window_iterator = |
| 569 std::find(previousKeyWindows_.begin(), | 572 std::find(previousKeyWindows_.begin(), |
| 570 previousKeyWindows_.end(), | 573 previousKeyWindows_.end(), |
| 571 window); | 574 window); |
| 572 if (window_iterator != previousKeyWindows_.end()) { | 575 if (window_iterator != previousKeyWindows_.end()) { |
| 573 previousKeyWindows_.erase(window_iterator); | 576 previousKeyWindows_.erase(window_iterator); |
| 574 } | 577 } |
| 575 } | 578 } |
| 576 | 579 |
| 577 @end | 580 @end |
| OLD | NEW |