summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2019-10-04 11:25:07 +0200
committerMichael BrĂ¼ning <michael.bruning@qt.io>2019-12-05 15:32:44 +0000
commitd4454467338d5728d4bff5d4ea9ce7c8f956c0c0 (patch)
treee26a842248f69b7053a1f946eb6ce691437d8ee4
parent52a5d6b81d190170a2411d931dc30f5162144f71 (diff)
downloadqtwebengine-chromium-d4454467338d5728d4bff5d4ea9ce7c8f956c0c0.tar.gz
Fix compiling on Xcode 11.
Backports the following Chromium fixes: - [ios] Get things compiling on Xcode 11: https://chromium-review.googlesource.com/c/chromium/src/+/1642508 - mac: fix sdk version comparison: https://chromium-review.googlesource.com/c/chromium/src/+/1864374 Also fixes the same issue in gn. Task-number: QTBUG-78997 Change-Id: Iaf3f5f2f69f7afd214e278ba24d04c238542cc40 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--chromium/base/mac/foundation_util.h14
-rw-r--r--chromium/components/crash/core/common/objc_zombie.mm23
2 files changed, 31 insertions, 6 deletions
diff --git a/chromium/base/mac/foundation_util.h b/chromium/base/mac/foundation_util.h
index ee23a17fb16..f12235fdeff 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,8 +53,21 @@ typedef CR_FORWARD_ENUM(unsigned int, NSSearchPathDirectory);
typedef unsigned int NSSearchPathDomainMask;
#endif
+#if !(defined(MAC_OS_X_VERSION_10_15) && \
+ MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_15)
typedef struct OpaqueSecTrustRef* SecACLRef;
typedef struct OpaqueSecTrustedApplicationRef* SecTrustedApplicationRef;
+#endif
+
+#if defined(OS_IOS) || \
+ (defined(MAC_OS_X_VERSION_10_15) && \
+ MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_15)
+typedef struct CF_BRIDGED_TYPE(id) __SecKey* SecKeyRef;
+typedef struct CF_BRIDGED_TYPE(id) __SecPolicy* SecPolicyRef;
+#else
+typedef struct OpaqueSecKeyRef* SecKeyRef;
+typedef struct OpaqueSecPolicyRef* SecPolicyRef;
+#endif
namespace base {
diff --git a/chromium/components/crash/core/common/objc_zombie.mm b/chromium/components/crash/core/common/objc_zombie.mm
index 7246b9b3655..e66f8ed179c 100644
--- a/chromium/components/crash/core/common/objc_zombie.mm
+++ b/chromium/components/crash/core/common/objc_zombie.mm
@@ -59,7 +59,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
@@ -242,8 +252,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");
@@ -336,9 +346,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.
@@ -410,7 +421,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;