[ReactNative] Remove unused executor context id
Summary: Remove `RCTGetExecutorID` and `RCTSetExecutorID`, it wasn't used anymore since the bridge was refactored into `RCTBridge` and `RCTBatchedBridge`.
This commit is contained in:
parent
9799c215cb
commit
d30ada61f0
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
@property (nonatomic, strong, readonly) RCTBridge *batchedBridge;
|
@property (nonatomic, strong, readonly) RCTBridge *batchedBridge;
|
||||||
|
|
||||||
- (void)_handleBuffer:(id)buffer context:(NSNumber *)context;
|
- (void)_handleBuffer:(id)buffer;
|
||||||
- (void)setUp;
|
- (void)setUp;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -57,7 +57,6 @@ RCT_EXPORT_MODULE()
|
||||||
- (void)executeJSCall:(__unused NSString *)name
|
- (void)executeJSCall:(__unused NSString *)name
|
||||||
method:(__unused NSString *)method
|
method:(__unused NSString *)method
|
||||||
arguments:(__unused NSArray *)arguments
|
arguments:(__unused NSArray *)arguments
|
||||||
context:(__unused NSNumber *)executorID
|
|
||||||
callback:(RCTJavaScriptCallback)onComplete
|
callback:(RCTJavaScriptCallback)onComplete
|
||||||
{
|
{
|
||||||
onComplete(nil, nil);
|
onComplete(nil, nil);
|
||||||
|
@ -155,7 +154,7 @@ RCT_EXPORT_MODULE(TestModule)
|
||||||
NSArray *args = @[@1234, @5678, @"stringy", @{@"a": @1}, @42];
|
NSArray *args = @[@1234, @5678, @"stringy", @{@"a": @1}, @42];
|
||||||
NSArray *buffer = @[@[testModuleID], @[testMethodID], @[args], @[], @1234567];
|
NSArray *buffer = @[@[testModuleID], @[testMethodID], @[args], @[], @1234567];
|
||||||
|
|
||||||
[_bridge.batchedBridge _handleBuffer:buffer context:RCTGetExecutorID(executor)];
|
[_bridge.batchedBridge _handleBuffer:buffer];
|
||||||
|
|
||||||
dispatch_sync(_methodQueue, ^{
|
dispatch_sync(_methodQueue, ^{
|
||||||
// clear the queue
|
// clear the queue
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
{
|
{
|
||||||
[super setUp];
|
[super setUp];
|
||||||
_executor = [[RCTContextExecutor alloc] init];
|
_executor = [[RCTContextExecutor alloc] init];
|
||||||
RCTSetExecutorID(_executor);
|
|
||||||
[_executor setUp];
|
[_executor setUp];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +138,6 @@ static uint64_t _get_time_nanoseconds(void)
|
||||||
[_executor executeJSCall:@"module"
|
[_executor executeJSCall:@"module"
|
||||||
method:@"method"
|
method:@"method"
|
||||||
arguments:params
|
arguments:params
|
||||||
context:RCTGetExecutorID(_executor)
|
|
||||||
callback:^(id json, __unused NSError *unused) {
|
callback:^(id json, __unused NSError *unused) {
|
||||||
XCTAssert([json isEqual:@YES], @"Invalid return");
|
XCTAssert([json isEqual:@YES], @"Invalid return");
|
||||||
}];
|
}];
|
||||||
|
|
|
@ -97,7 +97,7 @@ RCT_EXPORT_MODULE()
|
||||||
{
|
{
|
||||||
__block NSError *initError;
|
__block NSError *initError;
|
||||||
dispatch_semaphore_t s = dispatch_semaphore_create(0);
|
dispatch_semaphore_t s = dispatch_semaphore_create(0);
|
||||||
[self sendMessage:@{@"method": @"prepareJSRuntime"} context:nil waitForReply:^(NSError *error, NSDictionary *reply) {
|
[self sendMessage:@{@"method": @"prepareJSRuntime"} waitForReply:^(NSError *error, NSDictionary *reply) {
|
||||||
initError = error;
|
initError = error;
|
||||||
dispatch_semaphore_signal(s);
|
dispatch_semaphore_signal(s);
|
||||||
}];
|
}];
|
||||||
|
@ -126,7 +126,7 @@ RCT_EXPORT_MODULE()
|
||||||
RCTLogError(@"WebSocket connection failed with error %@", error);
|
RCTLogError(@"WebSocket connection failed with error %@", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)sendMessage:(NSDictionary *)message context:(NSNumber *)executorID waitForReply:(RCTWSMessageCallback)callback
|
- (void)sendMessage:(NSDictionary *)message waitForReply:(RCTWSMessageCallback)callback
|
||||||
{
|
{
|
||||||
static NSUInteger lastID = 10000;
|
static NSUInteger lastID = 10000;
|
||||||
|
|
||||||
|
@ -137,8 +137,6 @@ RCT_EXPORT_MODULE()
|
||||||
}];
|
}];
|
||||||
callback(error, nil);
|
callback(error, nil);
|
||||||
return;
|
return;
|
||||||
} else if (executorID && ![RCTGetExecutorID(self) isEqualToNumber:executorID]) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NSNumber *expectedID = @(lastID++);
|
NSNumber *expectedID = @(lastID++);
|
||||||
|
@ -152,12 +150,12 @@ RCT_EXPORT_MODULE()
|
||||||
- (void)executeApplicationScript:(NSString *)script sourceURL:(NSURL *)URL onComplete:(RCTJavaScriptCompleteBlock)onComplete
|
- (void)executeApplicationScript:(NSString *)script sourceURL:(NSURL *)URL onComplete:(RCTJavaScriptCompleteBlock)onComplete
|
||||||
{
|
{
|
||||||
NSDictionary *message = @{@"method": @"executeApplicationScript", @"url": [URL absoluteString], @"inject": _injectedObjects};
|
NSDictionary *message = @{@"method": @"executeApplicationScript", @"url": [URL absoluteString], @"inject": _injectedObjects};
|
||||||
[self sendMessage:message context:nil waitForReply:^(NSError *error, NSDictionary *reply) {
|
[self sendMessage:message waitForReply:^(NSError *error, NSDictionary *reply) {
|
||||||
onComplete(error);
|
onComplete(error);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)executeJSCall:(NSString *)name method:(NSString *)method arguments:(NSArray *)arguments context:(NSNumber *)executorID callback:(RCTJavaScriptCallback)onComplete
|
- (void)executeJSCall:(NSString *)name method:(NSString *)method arguments:(NSArray *)arguments callback:(RCTJavaScriptCallback)onComplete
|
||||||
{
|
{
|
||||||
RCTAssert(onComplete != nil, @"callback was missing for exec JS call");
|
RCTAssert(onComplete != nil, @"callback was missing for exec JS call");
|
||||||
NSDictionary *message = @{
|
NSDictionary *message = @{
|
||||||
|
@ -166,7 +164,7 @@ RCT_EXPORT_MODULE()
|
||||||
@"moduleMethod": method,
|
@"moduleMethod": method,
|
||||||
@"arguments": arguments
|
@"arguments": arguments
|
||||||
};
|
};
|
||||||
[self sendMessage:message context:executorID waitForReply:^(NSError *socketError, NSDictionary *reply) {
|
[self sendMessage:message waitForReply:^(NSError *socketError, NSDictionary *reply) {
|
||||||
if (socketError) {
|
if (socketError) {
|
||||||
onComplete(nil, socketError);
|
onComplete(nil, socketError);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -200,7 +200,6 @@ RCT_NOT_IMPLEMENTED(-initWithBundleURL:(__unused NSURL *)bundleURL
|
||||||
*/
|
*/
|
||||||
_javaScriptExecutor = _modulesByName[RCTBridgeModuleNameForClass(self.executorClass)];
|
_javaScriptExecutor = _modulesByName[RCTBridgeModuleNameForClass(self.executorClass)];
|
||||||
RCTLatestExecutor = _javaScriptExecutor;
|
RCTLatestExecutor = _javaScriptExecutor;
|
||||||
RCTSetExecutorID(_javaScriptExecutor);
|
|
||||||
|
|
||||||
[_javaScriptExecutor setUp];
|
[_javaScriptExecutor setUp];
|
||||||
|
|
||||||
|
@ -410,8 +409,7 @@ RCT_NOT_IMPLEMENTED(-initWithBundleURL:(__unused NSURL *)bundleURL
|
||||||
|
|
||||||
[self _invokeAndProcessModule:@"BatchedBridge"
|
[self _invokeAndProcessModule:@"BatchedBridge"
|
||||||
method:@"callFunctionReturnFlushedQueue"
|
method:@"callFunctionReturnFlushedQueue"
|
||||||
arguments:@[ids[0], ids[1], args ?: @[]]
|
arguments:@[ids[0], ids[1], args ?: @[]]];
|
||||||
context:RCTGetExecutorID(_javaScriptExecutor)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -424,8 +422,7 @@ RCT_NOT_IMPLEMENTED(-initWithBundleURL:(__unused NSURL *)bundleURL
|
||||||
dispatch_block_t block = ^{
|
dispatch_block_t block = ^{
|
||||||
[self _actuallyInvokeAndProcessModule:@"BatchedBridge"
|
[self _actuallyInvokeAndProcessModule:@"BatchedBridge"
|
||||||
method:@"callFunctionReturnFlushedQueue"
|
method:@"callFunctionReturnFlushedQueue"
|
||||||
arguments:@[@"JSTimersExecution", @"callTimers", @[@[timer]]]
|
arguments:@[@"JSTimersExecution", @"callTimers", @[@[timer]]]];
|
||||||
context:RCTGetExecutorID(_javaScriptExecutor)];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if ([_javaScriptExecutor respondsToSelector:@selector(executeAsyncBlockOnJavaScriptQueue:)]) {
|
if ([_javaScriptExecutor respondsToSelector:@selector(executeAsyncBlockOnJavaScriptQueue:)]) {
|
||||||
|
@ -450,18 +447,16 @@ RCT_NOT_IMPLEMENTED(-initWithBundleURL:(__unused NSURL *)bundleURL
|
||||||
}
|
}
|
||||||
|
|
||||||
RCTProfileBeginEvent();
|
RCTProfileBeginEvent();
|
||||||
NSNumber *context = RCTGetExecutorID(_javaScriptExecutor);
|
|
||||||
[_javaScriptExecutor executeJSCall:@"BatchedBridge"
|
[_javaScriptExecutor executeJSCall:@"BatchedBridge"
|
||||||
method:@"flushedQueue"
|
method:@"flushedQueue"
|
||||||
arguments:@[]
|
arguments:@[]
|
||||||
context:context
|
|
||||||
callback:^(id json, NSError *error) {
|
callback:^(id json, NSError *error) {
|
||||||
RCTProfileEndEvent(@"FetchApplicationScriptCallbacks", @"js_call,init", @{
|
RCTProfileEndEvent(@"FetchApplicationScriptCallbacks", @"js_call,init", @{
|
||||||
@"json": RCTNullIfNil(json),
|
@"json": RCTNullIfNil(json),
|
||||||
@"error": RCTNullIfNil(error),
|
@"error": RCTNullIfNil(error),
|
||||||
});
|
});
|
||||||
|
|
||||||
[self _handleBuffer:json context:context];
|
[self _handleBuffer:json];
|
||||||
|
|
||||||
onComplete(error);
|
onComplete(error);
|
||||||
}];
|
}];
|
||||||
|
@ -470,22 +465,11 @@ RCT_NOT_IMPLEMENTED(-initWithBundleURL:(__unused NSURL *)bundleURL
|
||||||
|
|
||||||
#pragma mark - Payload Generation
|
#pragma mark - Payload Generation
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: Completely remove `context` - no longer needed
|
|
||||||
*/
|
|
||||||
- (void)_invokeAndProcessModule:(NSString *)module method:(NSString *)method arguments:(NSArray *)args
|
|
||||||
{
|
|
||||||
[self _invokeAndProcessModule:module
|
|
||||||
method:method
|
|
||||||
arguments:args
|
|
||||||
context:RCTGetExecutorID(_javaScriptExecutor)];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by enqueueJSCall from any thread, or from _immediatelyCallTimer,
|
* Called by enqueueJSCall from any thread, or from _immediatelyCallTimer,
|
||||||
* on the JS thread, but only in non-batched mode.
|
* on the JS thread, but only in non-batched mode.
|
||||||
*/
|
*/
|
||||||
- (void)_invokeAndProcessModule:(NSString *)module method:(NSString *)method arguments:(NSArray *)args context:(NSNumber *)context
|
- (void)_invokeAndProcessModule:(NSString *)module method:(NSString *)method arguments:(NSArray *)args
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* AnyThread
|
* AnyThread
|
||||||
|
@ -511,7 +495,6 @@ RCT_NOT_IMPLEMENTED(-initWithBundleURL:(__unused NSURL *)bundleURL
|
||||||
@"method": method,
|
@"method": method,
|
||||||
@"args": args,
|
@"args": args,
|
||||||
},
|
},
|
||||||
@"context": context ?: @0,
|
|
||||||
RCT_IF_DEV(@"call_id": callID,)
|
RCT_IF_DEV(@"call_id": callID,)
|
||||||
};
|
};
|
||||||
if ([method isEqualToString:@"invokeCallbackAndReturnFlushedQueue"]) {
|
if ([method isEqualToString:@"invokeCallbackAndReturnFlushedQueue"]) {
|
||||||
|
@ -524,7 +507,7 @@ RCT_NOT_IMPLEMENTED(-initWithBundleURL:(__unused NSURL *)bundleURL
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_actuallyInvokeAndProcessModule:(NSString *)module method:(NSString *)method arguments:(NSArray *)args context:(NSNumber *)context
|
- (void)_actuallyInvokeAndProcessModule:(NSString *)module method:(NSString *)method arguments:(NSArray *)args
|
||||||
{
|
{
|
||||||
RCTAssertJSThread();
|
RCTAssertJSThread();
|
||||||
|
|
||||||
|
@ -539,19 +522,18 @@ RCT_NOT_IMPLEMENTED(-initWithBundleURL:(__unused NSURL *)bundleURL
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:RCTDequeueNotification object:nil userInfo:nil];
|
[[NSNotificationCenter defaultCenter] postNotificationName:RCTDequeueNotification object:nil userInfo:nil];
|
||||||
[self _handleBuffer:json context:context];
|
[self _handleBuffer:json];
|
||||||
};
|
};
|
||||||
|
|
||||||
[_javaScriptExecutor executeJSCall:module
|
[_javaScriptExecutor executeJSCall:module
|
||||||
method:method
|
method:method
|
||||||
arguments:args
|
arguments:args
|
||||||
context:context
|
|
||||||
callback:processResponse];
|
callback:processResponse];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Payload Processing
|
#pragma mark - Payload Processing
|
||||||
|
|
||||||
- (void)_handleBuffer:(id)buffer context:(NSNumber *)context
|
- (void)_handleBuffer:(id)buffer
|
||||||
{
|
{
|
||||||
RCTAssertJSThread();
|
RCTAssertJSThread();
|
||||||
|
|
||||||
|
@ -614,8 +596,7 @@ RCT_NOT_IMPLEMENTED(-initWithBundleURL:(__unused NSURL *)bundleURL
|
||||||
[self _handleRequestNumber:index
|
[self _handleRequestNumber:index
|
||||||
moduleID:[moduleIDs[index] integerValue]
|
moduleID:[moduleIDs[index] integerValue]
|
||||||
methodID:[methodIDs[index] integerValue]
|
methodID:[methodIDs[index] integerValue]
|
||||||
params:paramsArrays[index]
|
params:paramsArrays[index]];
|
||||||
context:context];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RCTProfileEndEvent(RCTCurrentThreadName(), @"objc_call,dispatch_async", @{ @"calls": @(calls.count) });
|
RCTProfileEndEvent(RCTCurrentThreadName(), @"objc_call,dispatch_async", @{ @"calls": @(calls.count) });
|
||||||
|
@ -636,7 +617,6 @@ RCT_NOT_IMPLEMENTED(-initWithBundleURL:(__unused NSURL *)bundleURL
|
||||||
moduleID:(NSUInteger)moduleID
|
moduleID:(NSUInteger)moduleID
|
||||||
methodID:(NSUInteger)methodID
|
methodID:(NSUInteger)methodID
|
||||||
params:(NSArray *)params
|
params:(NSArray *)params
|
||||||
context:(NSNumber *)context
|
|
||||||
{
|
{
|
||||||
if (!self.isValid) {
|
if (!self.isValid) {
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -663,7 +643,7 @@ RCT_NOT_IMPLEMENTED(-initWithBundleURL:(__unused NSURL *)bundleURL
|
||||||
}
|
}
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
[method invokeWithBridge:self module:moduleData.instance arguments:params context:context];
|
[method invokeWithBridge:self module:moduleData.instance arguments:params];
|
||||||
}
|
}
|
||||||
@catch (NSException *exception) {
|
@catch (NSException *exception) {
|
||||||
RCTLogError(@"Exception thrown while invoking %@ on target %@ with params %@: %@", method.JSMethodName, moduleData.name, params, exception);
|
RCTLogError(@"Exception thrown while invoking %@ on target %@ with params %@: %@", method.JSMethodName, moduleData.name, params, exception);
|
||||||
|
@ -704,12 +684,6 @@ RCT_NOT_IMPLEMENTED(-initWithBundleURL:(__unused NSURL *)bundleURL
|
||||||
}
|
}
|
||||||
|
|
||||||
NSArray *calls = [_scheduledCallbacks.allObjects arrayByAddingObjectsFromArray:_scheduledCalls];
|
NSArray *calls = [_scheduledCallbacks.allObjects arrayByAddingObjectsFromArray:_scheduledCalls];
|
||||||
NSNumber *currentExecutorID = RCTGetExecutorID(_javaScriptExecutor);
|
|
||||||
calls = [calls filteredArrayUsingPredicate:
|
|
||||||
[NSPredicate predicateWithBlock:
|
|
||||||
^BOOL(NSDictionary *call, __unused NSDictionary *bindings) {
|
|
||||||
return [call[@"context"] isEqualToNumber:currentExecutorID];
|
|
||||||
}]];
|
|
||||||
|
|
||||||
RCT_IF_DEV(
|
RCT_IF_DEV(
|
||||||
RCTProfileImmediateEvent(@"JS Thread Tick", displayLink.timestamp, @"g");
|
RCTProfileImmediateEvent(@"JS Thread Tick", displayLink.timestamp, @"g");
|
||||||
|
@ -724,8 +698,7 @@ RCT_NOT_IMPLEMENTED(-initWithBundleURL:(__unused NSURL *)bundleURL
|
||||||
_scheduledCallbacks = [[RCTSparseArray alloc] init];
|
_scheduledCallbacks = [[RCTSparseArray alloc] init];
|
||||||
[self _actuallyInvokeAndProcessModule:@"BatchedBridge"
|
[self _actuallyInvokeAndProcessModule:@"BatchedBridge"
|
||||||
method:@"processBatch"
|
method:@"processBatch"
|
||||||
arguments:@[[calls valueForKey:@"js_args"]]
|
arguments:@[[calls valueForKey:@"js_args"]]];
|
||||||
context:RCTGetExecutorID(_javaScriptExecutor)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RCTProfileEndEvent(@"DispatchFrameUpdate", @"objc_call", nil);
|
RCTProfileEndEvent(@"DispatchFrameUpdate", @"objc_call", nil);
|
||||||
|
|
|
@ -230,7 +230,6 @@ RCT_NOT_IMPLEMENTED(-init)
|
||||||
[RCTGetLatestExecutor() executeJSCall:@"RCTLog"
|
[RCTGetLatestExecutor() executeJSCall:@"RCTLog"
|
||||||
method:@"logIfNoNativeHook"
|
method:@"logIfNoNativeHook"
|
||||||
arguments:@[level, message]
|
arguments:@[level, message]
|
||||||
context:RCTGetExecutorID(RCTGetLatestExecutor())
|
|
||||||
callback:^(__unused id json, __unused NSError *error) {}];
|
callback:^(__unused id json, __unused NSError *error) {}];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -254,7 +253,6 @@ RCT_NOT_IMPLEMENTED(-init)
|
||||||
|
|
||||||
RCT_INNER_BRIDGE_ONLY(_invokeAndProcessModule:(__unused NSString *)module
|
RCT_INNER_BRIDGE_ONLY(_invokeAndProcessModule:(__unused NSString *)module
|
||||||
method:(__unused NSString *)method
|
method:(__unused NSString *)method
|
||||||
arguments:(__unused NSArray *)args
|
arguments:(__unused NSArray *)args);
|
||||||
context:(__unused NSNumber *)context)
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -36,7 +36,6 @@ typedef void (^RCTJavaScriptCallback)(id json, NSError *error);
|
||||||
- (void)executeJSCall:(NSString *)name
|
- (void)executeJSCall:(NSString *)name
|
||||||
method:(NSString *)method
|
method:(NSString *)method
|
||||||
arguments:(NSArray *)arguments
|
arguments:(NSArray *)arguments
|
||||||
context:(NSNumber *)executorID
|
|
||||||
callback:(RCTJavaScriptCallback)onComplete;
|
callback:(RCTJavaScriptCallback)onComplete;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,6 +65,3 @@ typedef void (^RCTJavaScriptCallback)(id json, NSError *error);
|
||||||
- (void)executeAsyncBlockOnJavaScriptQueue:(dispatch_block_t)block;
|
- (void)executeAsyncBlockOnJavaScriptQueue:(dispatch_block_t)block;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
void RCTSetExecutorID(id<RCTJavaScriptExecutor> executor);
|
|
||||||
NSNumber *RCTGetExecutorID(id<RCTJavaScriptExecutor> executor);
|
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) 2015-present, Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD-style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "RCTJavaScriptExecutor.h"
|
|
||||||
|
|
||||||
|
|
||||||
static const char *RCTJavaScriptExecutorID = "RCTJavaScriptExecutorID";
|
|
||||||
|
|
||||||
void RCTSetExecutorID(id<RCTJavaScriptExecutor> executor)
|
|
||||||
{
|
|
||||||
static NSUInteger executorID = 0;
|
|
||||||
if (executor) {
|
|
||||||
objc_setAssociatedObject(executor, RCTJavaScriptExecutorID, @(++executorID), OBJC_ASSOCIATION_RETAIN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NSNumber *RCTGetExecutorID(id<RCTJavaScriptExecutor> executor)
|
|
||||||
{
|
|
||||||
return executor ? objc_getAssociatedObject(executor, RCTJavaScriptExecutorID) : @0;
|
|
||||||
}
|
|
|
@ -29,7 +29,6 @@ typedef NS_ENUM(NSUInteger, RCTJavaScriptFunctionKind) {
|
||||||
|
|
||||||
- (void)invokeWithBridge:(RCTBridge *)bridge
|
- (void)invokeWithBridge:(RCTBridge *)bridge
|
||||||
module:(id)module
|
module:(id)module
|
||||||
arguments:(NSArray *)arguments
|
arguments:(NSArray *)arguments;
|
||||||
context:(NSNumber *)context;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -88,7 +88,7 @@ RCT_NOT_IMPLEMENTED(-init)
|
||||||
NSMutableArray *argumentBlocks = [[NSMutableArray alloc] initWithCapacity:numberOfArguments - 2];
|
NSMutableArray *argumentBlocks = [[NSMutableArray alloc] initWithCapacity:numberOfArguments - 2];
|
||||||
|
|
||||||
#define RCT_ARG_BLOCK(_logic) \
|
#define RCT_ARG_BLOCK(_logic) \
|
||||||
[argumentBlocks addObject:^(__unused RCTBridge *bridge, __unused NSNumber *context, NSInvocation *invocation, NSUInteger index, id json) { \
|
[argumentBlocks addObject:^(__unused RCTBridge *bridge, NSInvocation *invocation, NSUInteger index, id json) { \
|
||||||
_logic \
|
_logic \
|
||||||
[invocation setArgument:&value atIndex:index]; \
|
[invocation setArgument:&value atIndex:index]; \
|
||||||
}]; \
|
}]; \
|
||||||
|
@ -154,7 +154,7 @@ case _value: { \
|
||||||
RCT_CONVERT_CASE('^', void *)
|
RCT_CONVERT_CASE('^', void *)
|
||||||
|
|
||||||
case '{': {
|
case '{': {
|
||||||
[argumentBlocks addObject:^(__unused RCTBridge *bridge, __unused NSNumber *context, NSInvocation *invocation, NSUInteger index, id json) {
|
[argumentBlocks addObject:^(__unused RCTBridge *bridge, NSInvocation *invocation, NSUInteger index, id json) {
|
||||||
NSMethodSignature *methodSignature = [RCTConvert methodSignatureForSelector:selector];
|
NSMethodSignature *methodSignature = [RCTConvert methodSignatureForSelector:selector];
|
||||||
void *returnValue = malloc(methodSignature.methodReturnLength);
|
void *returnValue = malloc(methodSignature.methodReturnLength);
|
||||||
NSInvocation *_invocation = [NSInvocation invocationWithMethodSignature:methodSignature];
|
NSInvocation *_invocation = [NSInvocation invocationWithMethodSignature:methodSignature];
|
||||||
|
@ -249,7 +249,6 @@ case _value: { \
|
||||||
- (void)invokeWithBridge:(RCTBridge *)bridge
|
- (void)invokeWithBridge:(RCTBridge *)bridge
|
||||||
module:(id)module
|
module:(id)module
|
||||||
arguments:(NSArray *)arguments
|
arguments:(NSArray *)arguments
|
||||||
context:(NSNumber *)context
|
|
||||||
{
|
{
|
||||||
if (RCT_DEBUG) {
|
if (RCT_DEBUG) {
|
||||||
|
|
||||||
|
@ -284,8 +283,8 @@ case _value: { \
|
||||||
NSUInteger index = 0;
|
NSUInteger index = 0;
|
||||||
for (id json in arguments) {
|
for (id json in arguments) {
|
||||||
id arg = RCTNilIfNull(json);
|
id arg = RCTNilIfNull(json);
|
||||||
void (^block)(RCTBridge *, NSNumber *, NSInvocation *, NSUInteger, id) = _argumentBlocks[index];
|
void (^block)(RCTBridge *, NSInvocation *, NSUInteger, id) = _argumentBlocks[index];
|
||||||
block(bridge, context, invocation, index + 2, arg);
|
block(bridge, invocation, index + 2, arg);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -330,14 +330,13 @@ static NSError *RCTNSErrorFromJSError(JSContextRef context, JSValueRef jsError)
|
||||||
- (void)executeJSCall:(NSString *)name
|
- (void)executeJSCall:(NSString *)name
|
||||||
method:(NSString *)method
|
method:(NSString *)method
|
||||||
arguments:(NSArray *)arguments
|
arguments:(NSArray *)arguments
|
||||||
context:(NSNumber *)executorID
|
|
||||||
callback:(RCTJavaScriptCallback)onComplete
|
callback:(RCTJavaScriptCallback)onComplete
|
||||||
{
|
{
|
||||||
RCTAssert(onComplete != nil, @"onComplete block should not be nil");
|
RCTAssert(onComplete != nil, @"onComplete block should not be nil");
|
||||||
__weak RCTContextExecutor *weakSelf = self;
|
__weak RCTContextExecutor *weakSelf = self;
|
||||||
[self executeBlockOnJavaScriptQueue:RCTProfileBlock((^{
|
[self executeBlockOnJavaScriptQueue:RCTProfileBlock((^{
|
||||||
RCTContextExecutor *strongSelf = weakSelf;
|
RCTContextExecutor *strongSelf = weakSelf;
|
||||||
if (!strongSelf || !strongSelf.isValid || ![RCTGetExecutorID(strongSelf) isEqualToNumber:executorID]) {
|
if (!strongSelf || !strongSelf.isValid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NSError *error;
|
NSError *error;
|
||||||
|
|
|
@ -92,12 +92,11 @@ RCT_EXPORT_MODULE()
|
||||||
- (void)executeJSCall:(NSString *)name
|
- (void)executeJSCall:(NSString *)name
|
||||||
method:(NSString *)method
|
method:(NSString *)method
|
||||||
arguments:(NSArray *)arguments
|
arguments:(NSArray *)arguments
|
||||||
context:(NSNumber *)executorID
|
|
||||||
callback:(RCTJavaScriptCallback)onComplete
|
callback:(RCTJavaScriptCallback)onComplete
|
||||||
{
|
{
|
||||||
RCTAssert(onComplete != nil, @"");
|
RCTAssert(onComplete != nil, @"");
|
||||||
[self executeBlockOnJavaScriptQueue:^{
|
[self executeBlockOnJavaScriptQueue:^{
|
||||||
if (!self.isValid || ![RCTGetExecutorID(self) isEqualToNumber:executorID]) {
|
if (!self.isValid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,6 @@
|
||||||
58114A501AAE93D500E7D092 /* RCTAsyncLocalStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 58114A4E1AAE93D500E7D092 /* RCTAsyncLocalStorage.m */; };
|
58114A501AAE93D500E7D092 /* RCTAsyncLocalStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 58114A4E1AAE93D500E7D092 /* RCTAsyncLocalStorage.m */; };
|
||||||
58C571C11AA56C1900CDF9C8 /* RCTDatePickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 58C571BF1AA56C1900CDF9C8 /* RCTDatePickerManager.m */; };
|
58C571C11AA56C1900CDF9C8 /* RCTDatePickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 58C571BF1AA56C1900CDF9C8 /* RCTDatePickerManager.m */; };
|
||||||
63F014C01B02080B003B75D2 /* RCTPointAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 63F014BF1B02080B003B75D2 /* RCTPointAnnotation.m */; };
|
63F014C01B02080B003B75D2 /* RCTPointAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 63F014BF1B02080B003B75D2 /* RCTPointAnnotation.m */; };
|
||||||
783ABB351B38A9D3003FFD95 /* RCTJavaScriptExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 783ABB341B38A9D3003FFD95 /* RCTJavaScriptExecutor.m */; };
|
|
||||||
830A229E1A66C68A008503DA /* RCTRootView.m in Sources */ = {isa = PBXBuildFile; fileRef = 830A229D1A66C68A008503DA /* RCTRootView.m */; };
|
830A229E1A66C68A008503DA /* RCTRootView.m in Sources */ = {isa = PBXBuildFile; fileRef = 830A229D1A66C68A008503DA /* RCTRootView.m */; };
|
||||||
832348161A77A5AA00B55238 /* Layout.c in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FC71A68125100A75B9A /* Layout.c */; };
|
832348161A77A5AA00B55238 /* Layout.c in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FC71A68125100A75B9A /* Layout.c */; };
|
||||||
83CBBA511A601E3B00E9B192 /* RCTAssert.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA4B1A601E3B00E9B192 /* RCTAssert.m */; };
|
83CBBA511A601E3B00E9B192 /* RCTAssert.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA4B1A601E3B00E9B192 /* RCTAssert.m */; };
|
||||||
|
@ -213,7 +212,6 @@
|
||||||
58C571C01AA56C1900CDF9C8 /* RCTDatePickerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDatePickerManager.h; sourceTree = "<group>"; };
|
58C571C01AA56C1900CDF9C8 /* RCTDatePickerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDatePickerManager.h; sourceTree = "<group>"; };
|
||||||
63F014BE1B02080B003B75D2 /* RCTPointAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPointAnnotation.h; sourceTree = "<group>"; };
|
63F014BE1B02080B003B75D2 /* RCTPointAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPointAnnotation.h; sourceTree = "<group>"; };
|
||||||
63F014BF1B02080B003B75D2 /* RCTPointAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPointAnnotation.m; sourceTree = "<group>"; };
|
63F014BF1B02080B003B75D2 /* RCTPointAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPointAnnotation.m; sourceTree = "<group>"; };
|
||||||
783ABB341B38A9D3003FFD95 /* RCTJavaScriptExecutor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJavaScriptExecutor.m; sourceTree = "<group>"; };
|
|
||||||
830213F31A654E0800B993E6 /* RCTBridgeModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTBridgeModule.h; sourceTree = "<group>"; };
|
830213F31A654E0800B993E6 /* RCTBridgeModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTBridgeModule.h; sourceTree = "<group>"; };
|
||||||
830A229C1A66C68A008503DA /* RCTRootView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRootView.h; sourceTree = "<group>"; };
|
830A229C1A66C68A008503DA /* RCTRootView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRootView.h; sourceTree = "<group>"; };
|
||||||
830A229D1A66C68A008503DA /* RCTRootView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRootView.m; sourceTree = "<group>"; };
|
830A229D1A66C68A008503DA /* RCTRootView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRootView.m; sourceTree = "<group>"; };
|
||||||
|
@ -431,7 +429,6 @@
|
||||||
14C2CA751B3AC64F00E6CBB2 /* RCTFrameUpdate.m */,
|
14C2CA751B3AC64F00E6CBB2 /* RCTFrameUpdate.m */,
|
||||||
83CBBA4C1A601E3B00E9B192 /* RCTInvalidating.h */,
|
83CBBA4C1A601E3B00E9B192 /* RCTInvalidating.h */,
|
||||||
83CBBA631A601ECA00E9B192 /* RCTJavaScriptExecutor.h */,
|
83CBBA631A601ECA00E9B192 /* RCTJavaScriptExecutor.h */,
|
||||||
783ABB341B38A9D3003FFD95 /* RCTJavaScriptExecutor.m */,
|
|
||||||
14200DA81AC179B3008EE6BA /* RCTJavaScriptLoader.h */,
|
14200DA81AC179B3008EE6BA /* RCTJavaScriptLoader.h */,
|
||||||
14200DA91AC179B3008EE6BA /* RCTJavaScriptLoader.m */,
|
14200DA91AC179B3008EE6BA /* RCTJavaScriptLoader.m */,
|
||||||
13A1F71C1A75392D00D3D453 /* RCTKeyCommands.h */,
|
13A1F71C1A75392D00D3D453 /* RCTKeyCommands.h */,
|
||||||
|
@ -572,7 +569,6 @@
|
||||||
134FCB3D1A6E7F0800051CC8 /* RCTContextExecutor.m in Sources */,
|
134FCB3D1A6E7F0800051CC8 /* RCTContextExecutor.m in Sources */,
|
||||||
14C2CA781B3ACB0400E6CBB2 /* RCTBatchedBridge.m in Sources */,
|
14C2CA781B3ACB0400E6CBB2 /* RCTBatchedBridge.m in Sources */,
|
||||||
13E067591A70F44B002CDEE1 /* UIView+React.m in Sources */,
|
13E067591A70F44B002CDEE1 /* UIView+React.m in Sources */,
|
||||||
783ABB351B38A9D3003FFD95 /* RCTJavaScriptExecutor.m in Sources */,
|
|
||||||
14F484561AABFCE100FDF6B9 /* RCTSliderManager.m in Sources */,
|
14F484561AABFCE100FDF6B9 /* RCTSliderManager.m in Sources */,
|
||||||
14C2CA741B3AC64300E6CBB2 /* RCTModuleData.m in Sources */,
|
14C2CA741B3AC64300E6CBB2 /* RCTModuleData.m in Sources */,
|
||||||
142014191B32094000CC17BA /* RCTPerformanceLogger.m in Sources */,
|
142014191B32094000CC17BA /* RCTPerformanceLogger.m in Sources */,
|
||||||
|
|
Loading…
Reference in New Issue