| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/ui/cocoa/objc_zombie.h" | 5 #import "chrome/browser/ui/cocoa/objc_zombie.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <execinfo.h> | 8 #include <execinfo.h> |
| 9 #include <mach-o/dyld.h> | 9 #include <mach-o/dyld.h> |
| 10 #include <mach-o/nlist.h> | 10 #include <mach-o/nlist.h> |
| 11 | 11 |
| 12 #import <objc/objc-class.h> | 12 #import <objc/objc-class.h> |
| 13 | 13 |
| 14 #include <algorithm> | 14 #include <algorithm> |
| 15 #include <iostream> | 15 #include <iostream> |
| 16 | 16 |
| 17 #include "base/debug/stack_trace.h" | 17 #include "base/debug/stack_trace.h" |
| 18 #include "base/logging.h" | 18 #include "base/logging.h" |
| 19 #include "base/mac/mac_util.h" | 19 #include "base/mac/mac_util.h" |
| 20 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
| 21 #include "base/synchronization/lock.h" | 21 #include "base/synchronization/lock.h" |
| 22 #import "chrome/app/breakpad_mac.h" | 22 #import "chrome/app/breakpad_mac.h" |
| 23 #import "chrome/browser/ui/cocoa/objc_method_swizzle.h" | 23 #import "chrome/common/mac/objc_method_swizzle.h" |
| 24 | 24 |
| 25 // Deallocated objects are re-classed as |CrZombie|. No superclass | 25 // Deallocated objects are re-classed as |CrZombie|. No superclass |
| 26 // because then the class would have to override many/most of the | 26 // because then the class would have to override many/most of the |
| 27 // inherited methods (|NSObject| is like a category magnet!). | 27 // inherited methods (|NSObject| is like a category magnet!). |
| 28 @interface CrZombie { | 28 @interface CrZombie { |
| 29 Class isa; | 29 Class isa; |
| 30 } | 30 } |
| 31 @end | 31 @end |
| 32 | 32 |
| 33 // Objects with enough space are made into "fat" zombies, which | 33 // Objects with enough space are made into "fat" zombies, which |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 if (oldZombies) { | 552 if (oldZombies) { |
| 553 for (size_t i = 0; i < oldCount; ++i) { | 553 for (size_t i = 0; i < oldCount; ++i) { |
| 554 if (oldZombies[i].object) | 554 if (oldZombies[i].object) |
| 555 object_dispose(oldZombies[i].object); | 555 object_dispose(oldZombies[i].object); |
| 556 } | 556 } |
| 557 free(oldZombies); | 557 free(oldZombies); |
| 558 } | 558 } |
| 559 } | 559 } |
| 560 | 560 |
| 561 } // namespace ObjcEvilDoers | 561 } // namespace ObjcEvilDoers |
| OLD | NEW |