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

Unified Diff: chrome/browser/chrome_browser_application_mac.mm

Issue 7084017: [Mac] Use object_destructInstance() if available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Per-runtime initialization, unit test, misc. Created 9 years, 6 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/browser/ui/cocoa/objc_zombie.h » ('j') | chrome/browser/ui/cocoa/objc_zombie.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_browser_application_mac.mm
diff --git a/chrome/browser/chrome_browser_application_mac.mm b/chrome/browser/chrome_browser_application_mac.mm
index 3ee3dae68ed706525a6da87b4227d937c0644d6b..ee88fa83719ed97d0e2f21f11ac359225d526238 100644
--- a/chrome/browser/chrome_browser_application_mac.mm
+++ b/chrome/browser/chrome_browser_application_mac.mm
@@ -196,6 +196,19 @@ BOOL SwizzleNSExceptionInit() {
return YES;
}
+// Failures for purposes of monitoring success setting up zombies.
+enum ZombieFailure {
+ FAILED_10_5,
+ FAILED_10_6,
+
+ // Add new versions before here.
+ FAILED_MAX,
+};
+
+void RecordZombieFailure(ZombieFailure failure) {
+ UMA_HISTOGRAM_ENUMERATION("OSX.ZombieEnableFailure", failure, FAILED_MAX);
Mark Mentovai 2011/06/07 21:42:57 I don’t remember if you need to edit some file to
Scott Hess - ex-Googler 2011/06/07 23:48:21 They're reported as hashes, so you need to tell an
+}
+
} // namespace
@implementation BrowserCrApplication
@@ -205,10 +218,32 @@ BOOL SwizzleNSExceptionInit() {
int32 major_version = 0, minor_version = 0, bugfix_version = 0;
base::SysInfo::OperatingSystemVersionNumbers(
&major_version, &minor_version, &bugfix_version);
- if (major_version == 10 && (minor_version == 5 || minor_version == 6)) {
- // Turn all deallocated Objective-C objects into zombies, keeping
- // the most recent 10,000 of them on the treadmill.
- ObjcEvilDoers::ZombieEnable(YES, 10000);
+
+ // Turn all deallocated Objective-C objects into zombies, keeping
+ // the most recent 10,000 of them on the treadmill.
+ static const size_t kTreadmillSize = 10000;
+ if (major_version == 10) {
+ if (minor_version == 5) {
+ if (!ObjcEvilDoers::ZombieEnable(ObjcEvilDoers::RUNTIME_10_5, YES,
+ kTreadmillSize)) {
+ RecordZombieFailure(FAILED_10_5);
+ }
+ } else if (minor_version == 6) {
+ if (!ObjcEvilDoers::ZombieEnable(ObjcEvilDoers::RUNTIME_10_6, YES,
+ kTreadmillSize)) {
+ RecordZombieFailure(FAILED_10_6);
+ }
+ } else if (minor_version > 6) {
+ // Assume the future looks like the present.
+ if (!ObjcEvilDoers::ZombieEnable(ObjcEvilDoers::RUNTIME_10_6, YES,
+ kTreadmillSize)) {
+ // Put all future failures into the MAX bin. New OS releases
+ // come out infrequently enough that this should always
+ // correspond to "Next release", and once the next release
+ // happens that bin will get an official name.
+ RecordZombieFailure(FAILED_MAX);
+ }
+ }
Scott Hess - ex-Googler 2011/06/07 21:24:51 I am not really happy with this code. But it wasn
Mark Mentovai 2011/06/07 21:42:57 shess wrote:
}
}
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/objc_zombie.h » ('j') | chrome/browser/ui/cocoa/objc_zombie.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698