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

Unified Diff: chrome/browser/cocoa/objc_zombie.mm

Issue 2605004: [Mac] Tighten up objc zombie dealloc implementation. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Created 10 years, 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/objc_zombie.mm
diff --git a/chrome/browser/cocoa/objc_zombie.mm b/chrome/browser/cocoa/objc_zombie.mm
index a9d906395a1666fd33624abaa8de42fd457687d9..9a7c9630cc3b23b62f1e27d66f084a683d49f188 100644
--- a/chrome/browser/cocoa/objc_zombie.mm
+++ b/chrome/browser/cocoa/objc_zombie.mm
@@ -144,12 +144,17 @@ void ZombieDealloc(id self, SEL _cmd) {
memset(self, '!', size);
// If the instance is big enough, make it into a fat zombie and have
- // it remember the old isa. Otherwise make it a regular zombie.
+ // it remember the old |isa|. Otherwise make it a regular zombie.
+ // Setting |isa| rather than using |object_setClass()| because that
+ // function is implemented with a memory barrier. The runtime's
+ // |_internal_object_dispose()| (in objc-class.m) does this, so it
+ // should be safe (messaging free'd objects shouldn't be expected to
+ // be thread-safe in the first place).
if (size >= g_fatZombieSize) {
- object_setClass(self, g_fatZombieClass);
+ self->isa = g_fatZombieClass;
static_cast<CrFatZombie*>(self)->wasa = wasa;
} else {
- object_setClass(self, g_zombieClass);
+ self->isa = g_zombieClass;
Avi (use Gerrit) 2010/06/03 19:16:51 Huh. isa is still public in the objc2 runtime? If
Scott Hess - ex-Googler 2010/06/03 19:46:33 Not sure what you mean. struct objc_class has OBJ
}
// The new record to swap into |g_zombies|. If |g_zombieCount| is
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698