diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2019-10-04 11:25:07 +0200 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2019-10-09 13:20:52 +0000 |
commit | be2b74f4ab835573362a012047c76508973bd065 (patch) | |
tree | a43d4b48f1cc9c36d4dde1b74431605dea5bcc1d | |
parent | 7efe91029a65f44f2045a510829ddc176288ffb9 (diff) | |
download | qtwebengine-chromium-be2b74f4ab835573362a012047c76508973bd065.tar.gz |
[Backport][ios] Get things compiling on Xcode 11.
Updates various files with to conform to iOS13 SDK headers changes:
Nullability and availability changes
Updates security types
Updated default values (modalPresentationStyle)
Updates objc_zombie with IMP changes (as well as adding the accidentally-omitted tests)
Task-number: QTBUG-78997
Change-Id: I949717fbe3823a7d867b2b854f05d52f20478ea6
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Cogan <marq@chromium.org>
Reviewed-by: edchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666142}
Reviewed-by: Dmitriy Kuminov <coding@dmik.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | chromium/base/mac/foundation_util.h | 3 | ||||
-rw-r--r-- | chromium/components/crash/core/common/objc_zombie.mm | 23 |
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; |