Chromium Code Reviews| 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. | |
| 39 #if !defined(OS_IOS) || (defined(OS_IOS) && (__clang_major__ > 4 || (__clang_maj or__ == 4 && __clang_minor__ >= 2))) | |
|
stuartmorgan
2012/12/31 12:29:27
Can you line-break this with \ ?
| |
| 38 __attribute__((objc_root_class)) | 40 __attribute__((objc_root_class)) |
| 39 #endif | 41 #endif |
| 40 @interface CrZombie { | 42 @interface CrZombie { |
| 41 Class isa; | 43 Class isa; |
| 42 } | 44 } |
| 43 @end | 45 @end |
| 44 | 46 |
| 45 // Objects with enough space are made into "fat" zombies, which | 47 // Objects with enough space are made into "fat" zombies, which |
| 46 // directly remember which class they were until reallocated. | 48 // directly remember which class they were until reallocated. |
| 47 @interface CrFatZombie : CrZombie { | 49 @interface CrFatZombie : CrZombie { |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 if (oldZombies) { | 430 if (oldZombies) { |
| 429 for (size_t i = 0; i < oldCount; ++i) { | 431 for (size_t i = 0; i < oldCount; ++i) { |
| 430 if (oldZombies[i].object) | 432 if (oldZombies[i].object) |
| 431 object_dispose(oldZombies[i].object); | 433 object_dispose(oldZombies[i].object); |
| 432 } | 434 } |
| 433 free(oldZombies); | 435 free(oldZombies); |
| 434 } | 436 } |
| 435 } | 437 } |
| 436 | 438 |
| 437 } // namespace ObjcEvilDoers | 439 } // namespace ObjcEvilDoers |
| OLD | NEW |