@@ -100,7 +100,7 @@ void CatalystInstanceImpl::registerNatives() {
100
100
makeNativeMethod (" initializeBridge" , CatalystInstanceImpl::initializeBridge),
101
101
makeNativeMethod (" jniExtendNativeModules" , CatalystInstanceImpl::extendNativeModules),
102
102
makeNativeMethod (" jniSetSourceURL" , CatalystInstanceImpl::jniSetSourceURL),
103
- makeNativeMethod (" jniSetJsSegmentsDirectory " , CatalystInstanceImpl::jniSetJsSegmentsDirectory ),
103
+ makeNativeMethod (" jniRegisterSegment " , CatalystInstanceImpl::jniRegisterSegment ),
104
104
makeNativeMethod (" jniLoadScriptFromAssets" , CatalystInstanceImpl::jniLoadScriptFromAssets),
105
105
makeNativeMethod (" jniLoadScriptFromFile" , CatalystInstanceImpl::jniLoadScriptFromFile),
106
106
makeNativeMethod (" jniCallJSFunction" , CatalystInstanceImpl::jniCallJSFunction),
@@ -177,8 +177,8 @@ void CatalystInstanceImpl::jniSetSourceURL(const std::string& sourceURL) {
177
177
instance_->setSourceURL (sourceURL);
178
178
}
179
179
180
- void CatalystInstanceImpl::jniSetJsSegmentsDirectory ( const std::string& directoryPath ) {
181
- jsSegmentsDirectory_ = directoryPath ;
180
+ void CatalystInstanceImpl::jniRegisterSegment ( int segmentId, const std::string& path ) {
181
+ instance_-> registerBundle (( uint32_t )segmentId, path) ;
182
182
}
183
183
184
184
void CatalystInstanceImpl::jniLoadScriptFromAssets (
@@ -208,16 +208,7 @@ void CatalystInstanceImpl::jniLoadScriptFromFile(const std::string& fileName,
208
208
const std::string& sourceURL,
209
209
bool loadSynchronously) {
210
210
if (Instance::isIndexedRAMBundle (fileName.c_str ())) {
211
- auto bundle = folly::make_unique<JSIndexedRAMBundle>(fileName.c_str ());
212
- auto script = bundle->getStartupCode ();
213
- auto registry = jsSegmentsDirectory_.empty ()
214
- ? RAMBundleRegistry::singleBundleRegistry (std::move (bundle))
215
- : RAMBundleRegistry::multipleBundlesRegistry (std::move (bundle), JSIndexedRAMBundle::buildFactory ());
216
- instance_->loadRAMBundle (
217
- std::move (registry),
218
- std::move (script),
219
- sourceURL,
220
- loadSynchronously);
211
+ instance_->loadRAMBundleFromFile (fileName, sourceURL, loadSynchronously);
221
212
} else {
222
213
std::unique_ptr<const JSBigFileString> script;
223
214
RecoverableError::runRethrowingAsRecoverable<std::system_error>(
0 commit comments