mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 11:34:23 +00:00
Adopt new split segments registration approach on iOS
Differential Revision: D6284479 fbshipit-source-id: d0d7e8c6a6ce4ecab63739149be69f25df7fbe6f
This commit is contained in:
parent
cff0d8e0e5
commit
681278947e
@ -138,6 +138,13 @@ RCT_EXTERN NSString *RCTBridgeModuleNameForClass(Class bridgeModuleClass);
|
|||||||
arguments:(NSArray *)arguments
|
arguments:(NSArray *)arguments
|
||||||
error:(NSError **)error;
|
error:(NSError **)error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method registers the file path of an additional JS segment by its ID.
|
||||||
|
*
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
- (void)registerSegmentWithId:(NSUInteger)segmentId path:(NSString *)path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a bridge module instance by name or class. Note that modules are
|
* Retrieve a bridge module instance by name or class. Note that modules are
|
||||||
* lazily instantiated, so calling these methods for the first time with a given
|
* lazily instantiated, so calling these methods for the first time with a given
|
||||||
|
@ -398,6 +398,11 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
|||||||
return [self.batchedBridge callFunctionOnModule:module method:method arguments:arguments error:error];
|
return [self.batchedBridge callFunctionOnModule:module method:method arguments:arguments error:error];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)registerSegmentWithId:(NSUInteger)segmentId path:(NSString *)path
|
||||||
|
{
|
||||||
|
[self.batchedBridge registerSegmentWithId:segmentId path:path];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation RCTBridge (JavaScriptCore)
|
@implementation RCTBridge (JavaScriptCore)
|
||||||
|
@ -94,11 +94,4 @@
|
|||||||
- (void)loadSourceForBridge:(RCTBridge *)bridge
|
- (void)loadSourceForBridge:(RCTBridge *)bridge
|
||||||
withBlock:(RCTSourceLoadBlock)loadCallback;
|
withBlock:(RCTSourceLoadBlock)loadCallback;
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the path to folder where additional bundles are located
|
|
||||||
*
|
|
||||||
* @experimental
|
|
||||||
*/
|
|
||||||
- (NSURL *)jsSegmentsDirectory;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -1148,12 +1148,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
|||||||
[self->_performanceLogger markStopForTag:RCTPLRAMBundleLoad];
|
[self->_performanceLogger markStopForTag:RCTPLRAMBundleLoad];
|
||||||
[self->_performanceLogger setValue:scriptStr->size() forTag:RCTPLRAMStartupCodeSize];
|
[self->_performanceLogger setValue:scriptStr->size() forTag:RCTPLRAMStartupCodeSize];
|
||||||
if (self->_reactInstance) {
|
if (self->_reactInstance) {
|
||||||
NSString *jsSegmentsDirectory = [self.delegate respondsToSelector:@selector(jsSegmentsDirectory)]
|
auto registry = RAMBundleRegistry::multipleBundlesRegistry(std::move(ramBundle), JSIndexedRAMBundle::buildFactory());
|
||||||
? [[self.delegate jsSegmentsDirectory].path stringByAppendingString:@"/"]
|
|
||||||
: nil;
|
|
||||||
auto registry = jsSegmentsDirectory != nil
|
|
||||||
? RAMBundleRegistry::multipleBundlesRegistry(std::move(ramBundle), JSIndexedRAMBundle::buildFactory())
|
|
||||||
: RAMBundleRegistry::singleBundleRegistry(std::move(ramBundle));
|
|
||||||
self->_reactInstance->loadRAMBundle(std::move(registry), std::move(scriptStr),
|
self->_reactInstance->loadRAMBundle(std::move(registry), std::move(scriptStr),
|
||||||
sourceUrlStr.UTF8String, !async);
|
sourceUrlStr.UTF8String, !async);
|
||||||
}
|
}
|
||||||
@ -1214,6 +1209,13 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)registerSegmentWithId:(NSUInteger)segmentId path:(NSString *)path
|
||||||
|
{
|
||||||
|
if (_reactInstance) {
|
||||||
|
_reactInstance->registerBundle(static_cast<uint32_t>(segmentId), path.UTF8String);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Payload Processing
|
#pragma mark - Payload Processing
|
||||||
|
|
||||||
- (void)partialBatchDidFlush
|
- (void)partialBatchDidFlush
|
||||||
|
Loading…
x
Reference in New Issue
Block a user