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

Side by Side Diff: chrome/common/mac/objc_zombie.mm

Issue 11359117: [Mac] Temporarily stop clearing zombie objects. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/mac/objc_zombie.h" 5 #import "chrome/common/mac/objc_zombie.h"
6 6
7 #include <AvailabilityMacros.h> 7 #include <AvailabilityMacros.h>
8 8
9 #include <execinfo.h> 9 #include <execinfo.h>
10 #import <objc/runtime.h> 10 #import <objc/runtime.h>
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 Class wasa = object_getClass(self); 109 Class wasa = object_getClass(self);
110 const size_t size = class_getInstanceSize(wasa); 110 const size_t size = class_getInstanceSize(wasa);
111 111
112 // Destroy the instance by calling C++ destructors and clearing it 112 // Destroy the instance by calling C++ destructors and clearing it
113 // to something unlikely to work well if someone references it. 113 // to something unlikely to work well if someone references it.
114 // NOTE(shess): |object_dispose()| will call this again when the 114 // NOTE(shess): |object_dispose()| will call this again when the
115 // zombie falls off the treadmill! But by then |isa| will be a 115 // zombie falls off the treadmill! But by then |isa| will be a
116 // class without C++ destructors or associative references, so it 116 // class without C++ destructors or associative references, so it
117 // won't hurt anything. 117 // won't hurt anything.
118 objc_destructInstance(self); 118 objc_destructInstance(self);
119 // TODO(shess): Temporarily disable clearing the object to debug
120 // http://crbug.com/154483
121 #if 0
119 memset(self, '!', size); 122 memset(self, '!', size);
123 #endif
120 124
121 // If the instance is big enough, make it into a fat zombie and have 125 // If the instance is big enough, make it into a fat zombie and have
122 // it remember the old |isa|. Otherwise make it a regular zombie. 126 // it remember the old |isa|. Otherwise make it a regular zombie.
123 // Setting |isa| rather than using |object_setClass()| because that 127 // Setting |isa| rather than using |object_setClass()| because that
124 // function is implemented with a memory barrier. The runtime's 128 // function is implemented with a memory barrier. The runtime's
125 // |_internal_object_dispose()| (in objc-class.m) does this, so it 129 // |_internal_object_dispose()| (in objc-class.m) does this, so it
126 // should be safe (messaging free'd objects shouldn't be expected to 130 // should be safe (messaging free'd objects shouldn't be expected to
127 // be thread-safe in the first place). 131 // be thread-safe in the first place).
128 #pragma clang diagnostic push // clang warns about direct access to isa. 132 #pragma clang diagnostic push // clang warns about direct access to isa.
129 #pragma clang diagnostic ignored "-Wdeprecated-objc-isa-usage" 133 #pragma clang diagnostic ignored "-Wdeprecated-objc-isa-usage"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 if (oldZombies) { 432 if (oldZombies) {
429 for (size_t i = 0; i < oldCount; ++i) { 433 for (size_t i = 0; i < oldCount; ++i) {
430 if (oldZombies[i].object) 434 if (oldZombies[i].object)
431 object_dispose(oldZombies[i].object); 435 object_dispose(oldZombies[i].object);
432 } 436 }
433 free(oldZombies); 437 free(oldZombies);
434 } 438 }
435 } 439 }
436 440
437 } // namespace ObjcEvilDoers 441 } // namespace ObjcEvilDoers
OLDNEW
« 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