Skip to content

Commit

Permalink
Get rid of internal macros (facebook#38048)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#38048

As title

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D46847633

fbshipit-source-id: fd8fff10fee0531bdf2e40c4d2444fe3b7ce88a1
  • Loading branch information
Lulu Wu authored and facebook-github-bot committed Jun 26, 2023
1 parent ab48e6f commit 64d1d84
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@

#import <UIKit/UIKit.h>

#import <PikaOptimizationsMacros/PikaOptimizationsMacros.h>
#import <React/RCTTiming.h>
#import <react/bridgeless/PlatformTimerRegistry.h>
#import <react/bridgeless/TimerManager.h>

@interface RCTJSTimerExecutor : NSObject <RCTTimingDelegate>

- (void)setTimerManager:(std::weak_ptr<facebook::react::TimerManager>)timerManager FB_OBJC_DIRECT;
- (void)setTimerManager:(std::weak_ptr<facebook::react::TimerManager>)timerManager;

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#import <Foundation/Foundation.h>

#import <PikaOptimizationsMacros/PikaOptimizationsMacros.h>
#import <React/RCTDefines.h>
#import <react/bridgeless/JSEngineInstance.h>
#import <react/renderer/core/ReactPrimitives.h>
Expand All @@ -19,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
@class RCTFabricSurface;
@class RCTHost;
@class RCTModuleRegistry;
FB_RUNTIME_PROTOCOL

@protocol RCTTurboModuleManagerDelegate;

// Runtime API
Expand Down Expand Up @@ -49,7 +48,7 @@ typedef std::shared_ptr<facebook::react::JSEngineInstance> (^RCTHostJSEngineProv
- (instancetype)initWithBundleURL:(NSURL *)bundleURL
hostDelegate:(id<RCTHostDelegate>)hostDelegate
turboModuleManagerDelegate:(id<RCTTurboModuleManagerDelegate>)turboModuleManagerDelegate
jsEngineProvider:(RCTHostJSEngineProvider)jsEngineProvider NS_DESIGNATED_INITIALIZER FB_OBJC_DIRECT;
jsEngineProvider:(RCTHostJSEngineProvider)jsEngineProvider NS_DESIGNATED_INITIALIZER;

@property (nonatomic, weak, nullable) id<RCTHostRuntimeDelegate> runtimeDelegate;

Expand All @@ -61,16 +60,15 @@ typedef std::shared_ptr<facebook::react::JSEngineInstance> (^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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#import "RCTHost.h"
#import "RCTHost+Internal.h"

#import <PikaOptimizationsMacros/PikaOptimizationsMacros.h>
#import <React/RCTAssert.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTConvert.h>
Expand Down Expand Up @@ -274,12 +273,12 @@ - (void)setContextContainerHandler:(id<RCTContextContainerHandling>)contextConta

#pragma mark - Private

- (void)_attachSurface:(RCTFabricSurface *)surface FB_OBJC_DIRECT
- (void)_attachSurface:(RCTFabricSurface *)surface
{
_attachedSurfaces.push_back(surface);
}

- (NSArray<RCTFabricSurface *> *)_getAttachedSurfaces FB_OBJC_DIRECT
- (NSArray<RCTFabricSurface *> *)_getAttachedSurfaces
{
NSMutableArray<RCTFabricSurface *> *surfaces = [NSMutableArray new];
for (RCTFabricSurface *surface : _attachedSurfaces) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#import <UIKit/UIKit.h>

#import <PikaOptimizationsMacros/PikaOptimizationsMacros.h>
#import <React/RCTDefines.h>
#import <react/bridgeless/JSEngineInstance.h>
#import <react/bridgeless/ReactInstance.h>
Expand All @@ -33,7 +32,6 @@ RCT_EXTERN void RCTInstanceSetRuntimeDiagnosticFlags(NSString *_Nullable flags);
@class RCTSource;
@class RCTSurfacePresenter;

FB_RUNTIME_PROTOCOL
@protocol RCTTurboModuleManagerDelegate;

@protocol RCTInstanceDelegate <RCTContextContainerHandling>
Expand Down Expand Up @@ -62,7 +60,7 @@ typedef void (^_Null_unspecified RCTInstanceInitialBundleLoadCompletionBlock)();
bundleManager:(RCTBundleManager *)bundleManager
turboModuleManagerDelegate:(id<RCTTurboModuleManagerDelegate>)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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#import "RCTPerformanceLoggerUtils.h"

#if RCT_DEV_MENU && __has_include(<React/RCTDevLoadingViewProtocol.h>)
#import <PikaOptimizationsMacros/PikaOptimizationsMacros.h>
#import <React/RCTDevLoadingViewProtocol.h>
#endif

Expand Down Expand Up @@ -320,7 +319,7 @@ - (void)_start
[_performanceLogger markStopForTag:RCTPLReactInstanceInit];
}

- (void)_attachBridgelessAPIsToModule:(id<RCTTurboModule>)module FB_OBJC_DIRECT
- (void)_attachBridgelessAPIsToModule:(id<RCTTurboModule>)module
{
__weak RCTInstance *weakSelf = self;
if ([module respondsToSelector:@selector(setDispatchToJSThread:)]) {
Expand Down Expand Up @@ -351,7 +350,7 @@ - (void)_attachBridgelessAPIsToModule:(id<RCTTurboModule>)module FB_OBJC_DIRECT
[_bridgeModuleDecorator attachInteropAPIsToModule:(id<RCTBridgeModule>)module];
}

- (void)_loadJSBundle:(NSURL *)sourceURL FB_OBJC_DIRECT
- (void)_loadJSBundle:(NSURL *)sourceURL
{
#if RCT_DEV_MENU && __has_include(<React/RCTDevLoadingViewProtocol.h>)
{
Expand Down Expand Up @@ -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<std::mutex> lock(_invalidationMutex);
if (!_valid) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@

#import <Foundation/Foundation.h>

#import <PikaOptimizationsMacros/PikaOptimizationsMacros.h>
#import <React/RCTMessageThread.h>

NS_ASSUME_NONNULL_BEGIN

@interface RCTJSThreadManager : NSObject

- (void)dispatchToJSThread:(dispatch_block_t)block FB_OBJC_DIRECT;
- (std::shared_ptr<facebook::react::RCTMessageThread>)jsMessageThread FB_OBJC_DIRECT;
- (void)dispatchToJSThread:(dispatch_block_t)block;
- (std::shared_ptr<facebook::react::RCTMessageThread>)jsMessageThread;

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#import "RCTJSThreadManager.h"

#import <PikaOptimizationsMacros/PikaOptimizationsMacros.h>
// #import <PikaOptimizationsMacros/PikaOptimizationsMacros.h>
#import <React/RCTAssert.h>
#import <React/RCTCxxUtils.h>

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -109,7 +109,7 @@ + (void)runRunLoop

#pragma mark - Private

- (void)_handleError:(NSError *)error FB_OBJC_DIRECT
- (void)_handleError:(NSError *)error
{
RCTFatal(error);
}
Expand Down

0 comments on commit 64d1d84

Please sign in to comment.