mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Move thread jump for js loading into NativeToJSBridge, out of platform code
Reviewed By: javache Differential Revision: D3906009 fbshipit-source-id: b9782a6c209e3c1626899dac7fd50233cdef87f3
This commit is contained in:
committed by
Facebook Github Bot 7
parent
72e203bf95
commit
971cda8794
@@ -118,12 +118,6 @@ NativeToJsBridge::~NativeToJsBridge() {
|
||||
"NativeToJsBridge::destroy() must be called before deallocating the NativeToJsBridge!";
|
||||
}
|
||||
|
||||
void NativeToJsBridge::loadApplicationScript(std::unique_ptr<const JSBigString> script,
|
||||
std::string sourceURL) {
|
||||
// TODO(t11144533): Add assert that we are on the correct thread
|
||||
m_mainExecutor->loadApplicationScript(std::move(script), std::move(sourceURL));
|
||||
}
|
||||
|
||||
void NativeToJsBridge::loadOptimizedApplicationScript(
|
||||
std::string bundlePath,
|
||||
std::string sourceURL,
|
||||
@@ -138,18 +132,21 @@ void NativeToJsBridge::loadOptimizedApplicationScript(
|
||||
});
|
||||
}
|
||||
|
||||
void NativeToJsBridge::loadApplicationUnbundle(
|
||||
void NativeToJsBridge::loadApplication(
|
||||
std::unique_ptr<JSModulesUnbundle> unbundle,
|
||||
std::unique_ptr<const JSBigString> startupScript,
|
||||
std::string startupScriptSourceURL) {
|
||||
runOnExecutorQueue(
|
||||
m_mainExecutorToken,
|
||||
[unbundle=folly::makeMoveWrapper(std::move(unbundle)),
|
||||
[unbundleWrap=folly::makeMoveWrapper(std::move(unbundle)),
|
||||
startupScript=folly::makeMoveWrapper(std::move(startupScript)),
|
||||
startupScriptSourceURL=std::move(startupScriptSourceURL)]
|
||||
(JSExecutor* executor) mutable {
|
||||
|
||||
executor->setJSModulesUnbundle(unbundle.move());
|
||||
auto unbundle = unbundleWrap.move();
|
||||
if (unbundle) {
|
||||
executor->setJSModulesUnbundle(std::move(unbundle));
|
||||
}
|
||||
executor->loadApplicationScript(std::move(*startupScript),
|
||||
std::move(startupScriptSourceURL));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user