summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chromium/base/mac/foundation_util.h3
-rw-r--r--chromium/components/crash/core/common/objc_zombie.mm23
2 files changed, 19 insertions, 7 deletions
diff --git a/chromium/base/mac/foundation_util.h b/chromium/base/mac/foundation_util.h
index b2d56d8301f..8626046ab06 100644
--- a/chromium/base/mac/foundation_util.h
+++ b/chromium/base/mac/foundation_util.h
@@ -5,6 +5,7 @@
#ifndef BASE_MAC_FOUNDATION_UTIL_H_
#define BASE_MAC_FOUNDATION_UTIL_H_
+#include <AvailabilityMacros.h>
#include <CoreFoundation/CoreFoundation.h>
#include <string>
@@ -52,7 +53,7 @@ typedef CR_FORWARD_ENUM(unsigned int, NSSearchPathDirectory);
typedef unsigned int NSSearchPathDomainMask;
#endif
-#if defined(OS_IOS)
+#if defined(OS_IOS) || defined(MAC_OS_X_VERSION_10_15)
typedef struct CF_BRIDGED_TYPE(id) __SecCertificate* SecCertificateRef;
typedef struct CF_BRIDGED_TYPE(id) __SecKey* SecKeyRef;
typedef struct CF_BRIDGED_TYPE(id) __SecPolicy* SecPolicyRef;
diff --git a/chromium/components/crash/core/common/objc_zombie.mm b/chromium/components/crash/core/common/objc_zombie.mm
index 9af0cee9485..eced952ef41 100644
--- a/chromium/components/crash/core/common/objc_zombie.mm
+++ b/chromium/components/crash/core/common/objc_zombie.mm
@@ -51,7 +51,17 @@ namespace {
const size_t kBacktraceDepth = 20;
// The original implementation for |-[NSObject dealloc]|.
-IMP g_originalDeallocIMP = NULL;
+#if OBJC_OLD_DISPATCH_PROTOTYPES
+using RealIMP = IMP;
+#else
+// With !OBJC_OLD_DISPATCH_PROTOTYPES the runtime hasn't changed and IMP is
+// still what it always was, but the SDK is hiding the details now outside the
+// objc runtime. It is safe to define |RealIMP| to match the older definition of
+// |IMP|.
+using RealIMP = id (*)(id, SEL, ...);
+#endif
+
+RealIMP g_originalDeallocIMP = NULL;
// Classes which freed objects become. |g_fatZombieSize| is the
// minimum object size which can be made into a fat zombie (which can
@@ -241,8 +251,8 @@ BOOL ZombieInit() {
return YES;
Class rootClass = [NSObject class];
- g_originalDeallocIMP =
- class_getMethodImplementation(rootClass, @selector(dealloc));
+ g_originalDeallocIMP = reinterpret_cast<RealIMP>(
+ class_getMethodImplementation(rootClass, @selector(dealloc)));
// objc_getClass() so CrZombie doesn't need +class.
g_zombieClass = objc_getClass("CrZombie");
g_fatZombieClass = objc_getClass("CrFatZombie");
@@ -335,9 +345,10 @@ bool ZombieEnable(bool zombieAllObjects,
if (!m)
return false;
- const IMP prevDeallocIMP = method_setImplementation(m, (IMP)ZombieDealloc);
+ const RealIMP prevDeallocIMP = reinterpret_cast<RealIMP>(
+ method_setImplementation(m, reinterpret_cast<IMP>(ZombieDealloc)));
DCHECK(prevDeallocIMP == g_originalDeallocIMP ||
- prevDeallocIMP == (IMP)ZombieDealloc);
+ prevDeallocIMP == reinterpret_cast<RealIMP>(ZombieDealloc));
// Grab the current set of zombies. This is thread-safe because
// only the main thread can change these.
@@ -409,7 +420,7 @@ void ZombieDisable() {
// Put back the original implementation of -[NSObject dealloc].
Method m = class_getInstanceMethod([NSObject class], @selector(dealloc));
DCHECK(m);
- method_setImplementation(m, g_originalDeallocIMP);
+ method_setImplementation(m, reinterpret_cast<IMP>(g_originalDeallocIMP));
// Can safely grab this because it only happens on the main thread.
const size_t oldCount = g_zombieCount;