Permalink
Browse files

Remove experimental shouldBridgeLoadJavaScriptSynchronously:

Differential Revision: D6124037

fbshipit-source-id: a116def1032e1f4656fafbc7f2e36e812b13c9c0
  • Loading branch information...
danzimm authored and facebook-github-bot committed Oct 25, 2017
1 parent ca85a53 commit fe792f5878988c94c7babf8d9ebee4e3d49c612d
Showing with 18 additions and 46 deletions.
  1. +0 −9 React/Base/RCTBridgeDelegate.h
  2. +18 −37 React/CxxBridge/RCTCxxBridge.mm
@@ -54,15 +54,6 @@
*/
- (NSArray<Class> *)whitelistedModulesForBridge:(RCTBridge *)bridge;
/**
* When loading initial JavaScript, do so synchronously when the bridge is created iff
* this returns true. Otherwise, the JS will be fetched on a network thread, and
* executed on the JS thread. Currently used only by C++ bridge.
*
* @experimental
*/
- (BOOL)shouldBridgeLoadJavaScriptSynchronously:(RCTBridge *)bridge;
/**
* Configure whether the JSCExecutor created should use the system JSC API or
* alternative hooks provided. When returning YES from this method, you must have
@@ -359,49 +359,30 @@ - (void)start
dispatch_group_leave(prepareBridge);
}];
// Optional load and execute JS source synchronously
// TODO #10487027: should this be async on reload?
if (!self.executorClass &&
[self.delegate respondsToSelector:@selector(shouldBridgeLoadJavaScriptSynchronously:)] &&
[self.delegate shouldBridgeLoadJavaScriptSynchronously:_parentBridge]) {
NSError *error;
const int32_t bcVersion = systemJSCWrapper()->JSBytecodeFileFormatVersion;
NSData *sourceCode = [RCTJavaScriptLoader attemptSynchronousLoadOfBundleAtURL:self.bundleURL
runtimeBCVersion:bcVersion
sourceLength:NULL
error:&error];
// Load the source asynchronously, then store it for later execution.
dispatch_group_enter(prepareBridge);
__block NSData *sourceCode;
[self loadSource:^(NSError *error, RCTSource *source) {
if (error) {
[self handleError:error];
} else {
[self executeSourceCode:sourceCode sync:YES];
[weakSelf handleError:error];
}
} else {
// Load the source asynchronously, then store it for later execution.
dispatch_group_enter(prepareBridge);
__block NSData *sourceCode;
[self loadSource:^(NSError *error, RCTSource *source) {
if (error) {
[weakSelf handleError:error];
}
sourceCode = source.data;
dispatch_group_leave(prepareBridge);
} onProgress:^(RCTLoadingProgress *progressData) {
sourceCode = source.data;
dispatch_group_leave(prepareBridge);
} onProgress:^(RCTLoadingProgress *progressData) {
#if RCT_DEV && __has_include("RCTDevLoadingView.h")
RCTDevLoadingView *loadingView = [weakSelf moduleForClass:[RCTDevLoadingView class]];
[loadingView updateProgress:progressData];
RCTDevLoadingView *loadingView = [weakSelf moduleForClass:[RCTDevLoadingView class]];
[loadingView updateProgress:progressData];
#endif
}];
}];
// Wait for both the modules and source code to have finished loading
dispatch_group_notify(prepareBridge, dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
RCTCxxBridge *strongSelf = weakSelf;
if (sourceCode && strongSelf.loading) {
[strongSelf executeSourceCode:sourceCode sync:NO];
}
});
}
// Wait for both the modules and source code to have finished loading
dispatch_group_notify(prepareBridge, dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
RCTCxxBridge *strongSelf = weakSelf;
if (sourceCode && strongSelf.loading) {
[strongSelf executeSourceCode:sourceCode sync:NO];
}
});
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
}

0 comments on commit fe792f5

Please sign in to comment.