From 64d1d84ed9a3201e9a20d48582a8d12710b74659 Mon Sep 17 00:00:00 2001 From: Lulu Wu Date: Mon, 26 Jun 2023 02:08:38 -0700 Subject: [PATCH] Get rid of internal macros (#38048) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/38048 As title Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D46847633 fbshipit-source-id: fd8fff10fee0531bdf2e40c4d2444fe3b7ce88a1 --- .../platform/ios/Core/ObjCTimerRegistry.h | 3 +-- .../react/bridgeless/platform/ios/Core/RCTHost.h | 14 ++++++-------- .../react/bridgeless/platform/ios/Core/RCTHost.mm | 5 ++--- .../bridgeless/platform/ios/Core/RCTInstance.h | 4 +--- .../bridgeless/platform/ios/Core/RCTInstance.mm | 7 +++---- .../platform/ios/Core/RCTJSThreadManager.h | 5 ++--- .../platform/ios/Core/RCTJSThreadManager.mm | 6 +++--- 7 files changed, 18 insertions(+), 26 deletions(-) diff --git a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/ObjCTimerRegistry.h b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/ObjCTimerRegistry.h index 60219eb7211c98..b62d473e95bf86 100644 --- a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/ObjCTimerRegistry.h +++ b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/ObjCTimerRegistry.h @@ -7,14 +7,13 @@ #import -#import #import #import #import @interface RCTJSTimerExecutor : NSObject -- (void)setTimerManager:(std::weak_ptr)timerManager FB_OBJC_DIRECT; +- (void)setTimerManager:(std::weak_ptr)timerManager; @end diff --git a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.h b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.h index 12e16a9e407216..f083cd50042040 100644 --- a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.h +++ b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.h @@ -7,7 +7,6 @@ #import -#import #import #import #import @@ -19,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN @class RCTFabricSurface; @class RCTHost; @class RCTModuleRegistry; -FB_RUNTIME_PROTOCOL + @protocol RCTTurboModuleManagerDelegate; // Runtime API @@ -49,7 +48,7 @@ typedef std::shared_ptr (^RCTHostJSEngineProv - (instancetype)initWithBundleURL:(NSURL *)bundleURL hostDelegate:(id)hostDelegate turboModuleManagerDelegate:(id)turboModuleManagerDelegate - jsEngineProvider:(RCTHostJSEngineProvider)jsEngineProvider NS_DESIGNATED_INITIALIZER FB_OBJC_DIRECT; + jsEngineProvider:(RCTHostJSEngineProvider)jsEngineProvider NS_DESIGNATED_INITIALIZER; @property (nonatomic, weak, nullable) id runtimeDelegate; @@ -61,16 +60,15 @@ typedef std::shared_ptr (^RCTHostJSEngineProv - (RCTFabricSurface *)createSurfaceWithModuleName:(NSString *)moduleName mode:(facebook::react::DisplayMode)displayMode - initialProperties:(NSDictionary *)properties FB_OBJC_DIRECT; + initialProperties:(NSDictionary *)properties; -- (RCTFabricSurface *)createSurfaceWithModuleName:(NSString *)moduleName - initialProperties:(NSDictionary *)properties FB_OBJC_DIRECT; +- (RCTFabricSurface *)createSurfaceWithModuleName:(NSString *)moduleName initialProperties:(NSDictionary *)properties; -- (RCTSurfacePresenter *)getSurfacePresenter FB_OBJC_DIRECT; +- (RCTSurfacePresenter *)getSurfacePresenter; // Native module API -- (RCTModuleRegistry *)getModuleRegistry FB_OBJC_DIRECT; +- (RCTModuleRegistry *)getModuleRegistry; @end diff --git a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.mm b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.mm index fc91d96e5420cb..f733d5514f6c8d 100644 --- a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.mm +++ b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.mm @@ -8,7 +8,6 @@ #import "RCTHost.h" #import "RCTHost+Internal.h" -#import #import #import #import @@ -274,12 +273,12 @@ - (void)setContextContainerHandler:(id)contextConta #pragma mark - Private -- (void)_attachSurface:(RCTFabricSurface *)surface FB_OBJC_DIRECT +- (void)_attachSurface:(RCTFabricSurface *)surface { _attachedSurfaces.push_back(surface); } -- (NSArray *)_getAttachedSurfaces FB_OBJC_DIRECT +- (NSArray *)_getAttachedSurfaces { NSMutableArray *surfaces = [NSMutableArray new]; for (RCTFabricSurface *surface : _attachedSurfaces) { diff --git a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.h b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.h index 5445ca8b7c247d..bd7798627b0a54 100644 --- a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.h +++ b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.h @@ -7,7 +7,6 @@ #import -#import #import #import #import @@ -33,7 +32,6 @@ RCT_EXTERN void RCTInstanceSetRuntimeDiagnosticFlags(NSString *_Nullable flags); @class RCTSource; @class RCTSurfacePresenter; -FB_RUNTIME_PROTOCOL @protocol RCTTurboModuleManagerDelegate; @protocol RCTInstanceDelegate @@ -62,7 +60,7 @@ typedef void (^_Null_unspecified RCTInstanceInitialBundleLoadCompletionBlock)(); bundleManager:(RCTBundleManager *)bundleManager turboModuleManagerDelegate:(id)turboModuleManagerDelegate onInitialBundleLoad:(RCTInstanceInitialBundleLoadCompletionBlock)onInitialBundleLoad - moduleRegistry:(RCTModuleRegistry *)moduleRegistry NS_DESIGNATED_INITIALIZER FB_OBJC_DIRECT; + moduleRegistry:(RCTModuleRegistry *)moduleRegistry; - (void)callFunctionOnJSModule:(NSString *)moduleName method:(NSString *)method args:(NSArray *)args; diff --git a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.mm b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.mm index 2258edae930bdb..a2af2f7afd4c2d 100644 --- a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.mm +++ b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.mm @@ -42,7 +42,6 @@ #import "RCTPerformanceLoggerUtils.h" #if RCT_DEV_MENU && __has_include() -#import #import #endif @@ -320,7 +319,7 @@ - (void)_start [_performanceLogger markStopForTag:RCTPLReactInstanceInit]; } -- (void)_attachBridgelessAPIsToModule:(id)module FB_OBJC_DIRECT +- (void)_attachBridgelessAPIsToModule:(id)module { __weak RCTInstance *weakSelf = self; if ([module respondsToSelector:@selector(setDispatchToJSThread:)]) { @@ -351,7 +350,7 @@ - (void)_attachBridgelessAPIsToModule:(id)module FB_OBJC_DIRECT [_bridgeModuleDecorator attachInteropAPIsToModule:(id)module]; } -- (void)_loadJSBundle:(NSURL *)sourceURL FB_OBJC_DIRECT +- (void)_loadJSBundle:(NSURL *)sourceURL { #if RCT_DEV_MENU && __has_include() { @@ -397,7 +396,7 @@ - (void)_loadJSBundle:(NSURL *)sourceURL FB_OBJC_DIRECT }]; } -- (void)_loadScriptFromSource:(RCTSource *)source FB_OBJC_DIRECT +- (void)_loadScriptFromSource:(RCTSource *)source { std::lock_guard lock(_invalidationMutex); if (!_valid) { diff --git a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTJSThreadManager.h b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTJSThreadManager.h index 3fd4edda7bc9f7..ce64c55fdf0401 100644 --- a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTJSThreadManager.h +++ b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTJSThreadManager.h @@ -7,15 +7,14 @@ #import -#import #import NS_ASSUME_NONNULL_BEGIN @interface RCTJSThreadManager : NSObject -- (void)dispatchToJSThread:(dispatch_block_t)block FB_OBJC_DIRECT; -- (std::shared_ptr)jsMessageThread FB_OBJC_DIRECT; +- (void)dispatchToJSThread:(dispatch_block_t)block; +- (std::shared_ptr)jsMessageThread; @end diff --git a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTJSThreadManager.mm b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTJSThreadManager.mm index 20fcfce9414381..9f16b9bd2d3ac3 100644 --- a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTJSThreadManager.mm +++ b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTJSThreadManager.mm @@ -7,7 +7,7 @@ #import "RCTJSThreadManager.h" -#import +// #import #import #import @@ -59,7 +59,7 @@ - (void)dealloc #pragma mark - JSThread Management -- (void)startJSThread FB_OBJC_DIRECT +- (void)startJSThread { _jsThread = [[NSThread alloc] initWithTarget:[self class] selector:@selector(runRunLoop) object:nil]; _jsThread.name = RCTJSThreadName; @@ -109,7 +109,7 @@ + (void)runRunLoop #pragma mark - Private -- (void)_handleError:(NSError *)error FB_OBJC_DIRECT +- (void)_handleError:(NSError *)error { RCTFatal(error); }