Move batchedbridge start out of init

Reviewed By: javache

Differential Revision: D3913304

fbshipit-source-id: 7d9b5b352d95dd770757cc99dddcce510cdd4909
This commit is contained in:
Marc Horowitz 2016-09-26 16:01:40 -07:00 committed by Facebook Github Bot 7
parent 971cda8794
commit 51df83d7d5
3 changed files with 11 additions and 6 deletions

View File

@ -80,12 +80,6 @@ typedef NS_ENUM(NSUInteger, RCTBridgeFields) {
_displayLink = [RCTDisplayLink new];
[RCTBridge setCurrentBridge:self];
[[NSNotificationCenter defaultCenter]
postNotificationName:RCTJavaScriptWillStartLoadingNotification
object:_parentBridge userInfo:@{@"bridge": self}];
[self start];
}
return self;
}
@ -97,6 +91,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)dele
- (void)start
{
[[NSNotificationCenter defaultCenter]
postNotificationName:RCTJavaScriptWillStartLoadingNotification
object:_parentBridge userInfo:@{@"bridge": self}];
RCT_PROFILE_BEGIN_EVENT(0, @"-[RCTBatchedBridge setUp]", nil);
dispatch_queue_t bridgeQueue = dispatch_queue_create("com.facebook.react.RCTBridgeQueue", DISPATCH_QUEUE_CONCURRENT);

View File

@ -80,6 +80,11 @@ RCT_EXTERN void RCTVerifyAllModulesExported(NSArray *extraModules);
*/
@property (nonatomic, assign, readonly) BOOL moduleSetupComplete;
/**
* Called on the child bridge to run the executor and start loading.
*/
- (void)start;
/**
* Used by RCTModuleData to register the module for frame updates after it is
* lazily initialized.
@ -142,5 +147,6 @@ RCT_EXTERN void RCTVerifyAllModulesExported(NSArray *extraModules);
@property (nonatomic, assign, readonly) BOOL moduleSetupComplete;
- (instancetype)initWithParentBridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER;
- (void)start;
@end

View File

@ -296,6 +296,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
_bundleURL = [RCTConvert NSURL:_bundleURL.absoluteString];
[self createBatchedBridge];
[self.batchedBridge start];
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
}