| 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 "components/crash/core/common/objc_zombie.h" | 5 #import "components/crash/core/common/objc_zombie.h" |
| 6 | 6 |
| 7 #include <AvailabilityMacros.h> | 7 #include <AvailabilityMacros.h> |
| 8 #include <string.h> |
| 8 | 9 |
| 9 #include <execinfo.h> | 10 #include <execinfo.h> |
| 10 #import <objc/runtime.h> | 11 #import <objc/runtime.h> |
| 11 | 12 |
| 12 #include <algorithm> | 13 #include <algorithm> |
| 13 | 14 |
| 14 #include "base/debug/crash_logging.h" | 15 #include "base/debug/crash_logging.h" |
| 15 #include "base/debug/stack_trace.h" | 16 #include "base/debug/stack_trace.h" |
| 16 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
| 17 #include "base/logging.h" | 18 #include "base/logging.h" |
| 18 #include "base/posix/eintr_wrapper.h" | 19 #include "base/posix/eintr_wrapper.h" |
| 19 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 20 #include "base/synchronization/lock.h" | 21 #include "base/synchronization/lock.h" |
| 22 #include "build/build_config.h" |
| 21 #include "components/crash/core/common/crash_keys.h" | 23 #include "components/crash/core/common/crash_keys.h" |
| 22 | 24 |
| 23 #if !defined(OS_IOS) && (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_6) | 25 #if !defined(OS_IOS) && (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_6) |
| 24 // Apparently objc/runtime.h doesn't define this with the 10.6 SDK yet. | 26 // Apparently objc/runtime.h doesn't define this with the 10.6 SDK yet. |
| 25 // The docs say it exists since 10.6 however. | 27 // The docs say it exists since 10.6 however. |
| 26 OBJC_EXPORT void *objc_destructInstance(id obj); | 28 OBJC_EXPORT void *objc_destructInstance(id obj); |
| 27 #endif | 29 #endif |
| 28 | 30 |
| 29 // Deallocated objects are re-classed as |CrZombie|. No superclass | 31 // Deallocated objects are re-classed as |CrZombie|. No superclass |
| 30 // because then the class would have to override many/most of the | 32 // because then the class would have to override many/most of the |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 if (oldZombies) { | 426 if (oldZombies) { |
| 425 for (size_t i = 0; i < oldCount; ++i) { | 427 for (size_t i = 0; i < oldCount; ++i) { |
| 426 if (oldZombies[i].object) | 428 if (oldZombies[i].object) |
| 427 object_dispose(oldZombies[i].object); | 429 object_dispose(oldZombies[i].object); |
| 428 } | 430 } |
| 429 free(oldZombies); | 431 free(oldZombies); |
| 430 } | 432 } |
| 431 } | 433 } |
| 432 | 434 |
| 433 } // namespace ObjcEvilDoers | 435 } // namespace ObjcEvilDoers |
| OLD | NEW |