chore: remove redundant @available checks (#34407)
* chore: require macOS 10.13 for Chromium * chore: fix lint
This commit is contained in:
parent
000c3d981c
commit
539a53786c
9 changed files with 121 additions and 217 deletions
|
@ -19,30 +19,6 @@
|
|||
|
||||
#import <UserNotifications/UserNotifications.h>
|
||||
|
||||
#if BUILDFLAG(USE_ALLOCATOR_SHIM)
|
||||
// On macOS 10.12, the IME system attempts to allocate a 2^64 size buffer,
|
||||
// which would typically cause an OOM crash. To avoid this, the problematic
|
||||
// method is swizzled out and the make-OOM-fatal bit is disabled for the
|
||||
// duration of the original call. https://crbug.com/654695
|
||||
static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
|
||||
@interface OOMDisabledIMKInputSession : NSObject
|
||||
@end
|
||||
@implementation OOMDisabledIMKInputSession
|
||||
- (void)_coreAttributesFromRange:(NSRange)range
|
||||
whichAttributes:(long long)attributes // NOLINT(runtime/int)
|
||||
completionHandler:(void (^)(void))block {
|
||||
// The allocator flag is per-process, so other threads may temporarily
|
||||
// not have fatal OOM occur while this method executes, but it is better
|
||||
// than crashing when using IME.
|
||||
base::allocator::SetCallNewHandlerOnMallocFailure(false);
|
||||
g_swizzle_imk_input_session->InvokeOriginal<
|
||||
void, NSRange, long long, void (^)(void)>( // NOLINT(runtime/int)
|
||||
self, _cmd, range, attributes, block);
|
||||
base::allocator::SetCallNewHandlerOnMallocFailure(true);
|
||||
}
|
||||
@end
|
||||
#endif // BUILDFLAG(USE_ALLOCATOR_SHIM)
|
||||
|
||||
static NSDictionary* UNNotificationResponseToNSDictionary(
|
||||
UNNotificationResponse* response) API_AVAILABLE(macosx(10.14)) {
|
||||
// [response isKindOfClass:[UNNotificationResponse class]]
|
||||
|
@ -109,16 +85,6 @@ static NSDictionary* UNNotificationResponseToNSDictionary(
|
|||
|
||||
electron::Browser::Get()->DidFinishLaunching(
|
||||
electron::NSDictionaryToDictionaryValue(notification_info));
|
||||
|
||||
#if BUILDFLAG(USE_ALLOCATOR_SHIM)
|
||||
// Disable fatal OOM to hack around an OS bug https://crbug.com/654695.
|
||||
if (base::mac::IsOS10_12()) {
|
||||
g_swizzle_imk_input_session = new base::mac::ScopedObjCClassSwizzler(
|
||||
NSClassFromString(@"IMKInputSession"),
|
||||
[OOMDisabledIMKInputSession class],
|
||||
@selector(_coreAttributesFromRange:whichAttributes:completionHandler:));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(NSNotification*)notification {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue