| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | 7 #import "base/logging.h" |
| 8 #import "base/mac/scoped_nsexception_enabler.h" | 8 #import "base/mac/scoped_nsexception_enabler.h" |
| 9 #import "base/metrics/histogram.h" | 9 #import "base/metrics/histogram.h" |
| 10 #import "base/memory/scoped_nsobject.h" | 10 #import "base/memory/scoped_nsobject.h" |
| 11 #include "base/sys_info.h" | |
| 12 #import "base/sys_string_conversions.h" | 11 #import "base/sys_string_conversions.h" |
| 13 #import "chrome/app/breakpad_mac.h" | 12 #import "chrome/app/breakpad_mac.h" |
| 14 #include "chrome/browser/accessibility/browser_accessibility_state.h" | 13 #include "chrome/browser/accessibility/browser_accessibility_state.h" |
| 15 #import "chrome/browser/app_controller_mac.h" | 14 #import "chrome/browser/app_controller_mac.h" |
| 16 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
| 17 #import "chrome/browser/ui/cocoa/objc_method_swizzle.h" | 16 #import "chrome/browser/ui/cocoa/objc_method_swizzle.h" |
| 18 #import "chrome/browser/ui/cocoa/objc_zombie.h" | 17 #import "chrome/browser/ui/cocoa/objc_zombie.h" |
| 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 20 #include "content/browser/renderer_host/render_view_host.h" | 19 #include "content/browser/renderer_host/render_view_host.h" |
| 21 | 20 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 @selector(initWithName:reason:userInfo:), | 193 @selector(initWithName:reason:userInfo:), |
| 195 @selector(chromeInitWithName:reason:userInfo:)); | 194 @selector(chromeInitWithName:reason:userInfo:)); |
| 196 return YES; | 195 return YES; |
| 197 } | 196 } |
| 198 | 197 |
| 199 } // namespace | 198 } // namespace |
| 200 | 199 |
| 201 @implementation BrowserCrApplication | 200 @implementation BrowserCrApplication |
| 202 | 201 |
| 203 + (void)initialize { | 202 + (void)initialize { |
| 204 // Whitelist releases that are compatible with objc zombies. | 203 // Turn all deallocated Objective-C objects into zombies, keeping |
| 205 int32 major_version = 0, minor_version = 0, bugfix_version = 0; | 204 // the most recent 10,000 of them on the treadmill. |
| 206 base::SysInfo::OperatingSystemVersionNumbers( | 205 ObjcEvilDoers::ZombieEnable(YES, 10000); |
| 207 &major_version, &minor_version, &bugfix_version); | |
| 208 if (major_version == 10 && (minor_version == 5 || minor_version == 6)) { | |
| 209 // Turn all deallocated Objective-C objects into zombies, keeping | |
| 210 // the most recent 10,000 of them on the treadmill. | |
| 211 ObjcEvilDoers::ZombieEnable(YES, 10000); | |
| 212 } | |
| 213 } | 206 } |
| 214 | 207 |
| 215 - init { | 208 - init { |
| 216 CHECK(SwizzleNSExceptionInit()); | 209 CHECK(SwizzleNSExceptionInit()); |
| 217 return [super init]; | 210 return [super init]; |
| 218 } | 211 } |
| 219 | 212 |
| 220 //////////////////////////////////////////////////////////////////////////////// | 213 //////////////////////////////////////////////////////////////////////////////// |
| 221 // HISTORICAL COMMENT (by viettrungluu, from | 214 // HISTORICAL COMMENT (by viettrungluu, from |
| 222 // http://codereview.chromium.org/1520006 with mild editing): | 215 // http://codereview.chromium.org/1520006 with mild editing): |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 if (RenderViewHost* rvh = contents->render_view_host()) { | 421 if (RenderViewHost* rvh = contents->render_view_host()) { |
| 429 rvh->EnableRendererAccessibility(); | 422 rvh->EnableRendererAccessibility(); |
| 430 } | 423 } |
| 431 } | 424 } |
| 432 } | 425 } |
| 433 } | 426 } |
| 434 return [super accessibilitySetValue:value forAttribute:attribute]; | 427 return [super accessibilitySetValue:value forAttribute:attribute]; |
| 435 } | 428 } |
| 436 | 429 |
| 437 @end | 430 @end |
| OLD | NEW |