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/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 16 matching lines...) Expand all Loading... | |
27 | 27 |
28 // Deallocated objects are re-classed as |CrZombie|. No superclass | 28 // Deallocated objects are re-classed as |CrZombie|. No superclass |
29 // because then the class would have to override many/most of the | 29 // because then the class would have to override many/most of the |
30 // inherited methods (|NSObject| is like a category magnet!). | 30 // inherited methods (|NSObject| is like a category magnet!). |
31 // Without the __attribute__, clang's -Wobjc-root-class warns on the missing | 31 // Without the __attribute__, clang's -Wobjc-root-class warns on the missing |
32 // superclass. | 32 // superclass. |
33 // | 33 // |
34 // The version of clang that ships with Xcode 4.5 does not include this | 34 // The version of clang that ships with Xcode 4.5 does not include this |
35 // warning, so it is disabled on iOS. This may change in future Xcode | 35 // warning, so it is disabled on iOS. This may change in future Xcode |
36 // releases. | 36 // releases. |
37 #if !defined(OS_IOS) | 37 // TODO(justincohen): This is fixed in clang 4.2 in XCode 4.6. Remove this once |
38 // everyone is moved to XCode 4.6 b/7882496. | |
wtc
2013/01/04 00:58:36
Nit: the indentation of this TODO comment should m
justincohen
2013/01/04 03:54:10
Done.
| |
39 #if !defined(OS_IOS) || \ | |
40 (defined(OS_IOS) && \ | |
wtc
2013/01/04 00:58:36
Nit: defined(OS_IOS) is not necessary. If you pref
justincohen
2013/01/04 03:54:10
Done.
| |
41 (__clang_major__ > 4 || (__clang_major__ == 4 && __clang_minor__ >= 2))) | |
38 __attribute__((objc_root_class)) | 42 __attribute__((objc_root_class)) |
39 #endif | 43 #endif |
40 @interface CrZombie { | 44 @interface CrZombie { |
41 Class isa; | 45 Class isa; |
42 } | 46 } |
43 @end | 47 @end |
44 | 48 |
45 // Objects with enough space are made into "fat" zombies, which | 49 // Objects with enough space are made into "fat" zombies, which |
46 // directly remember which class they were until reallocated. | 50 // directly remember which class they were until reallocated. |
47 @interface CrFatZombie : CrZombie { | 51 @interface CrFatZombie : CrZombie { |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 |
OLD | NEW |