Remove bytecodeFileName and scriptVersion/bundleVersion parameters (#187)
bytecodeFileName is used excusively by ChakraExecutor in react-native-windows, and diverges us from upstream. Remove these parameters, using a new mechanism in react-native-windows.
This commit is contained in:
Родитель
3c4fb8565a
Коммит
9bba27f2b8
|
@ -1337,8 +1337,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
|||
sourceUrlStr.UTF8String, !async);
|
||||
}
|
||||
} else if (reactInstance) {
|
||||
reactInstance->loadScriptFromString(std::make_unique<NSDataBigString>(script), 0,
|
||||
sourceUrlStr.UTF8String, !async, ""); // TODO(OSS Candidate ISS#2710739)
|
||||
reactInstance->loadScriptFromString(std::make_unique<NSDataBigString>(script), sourceUrlStr.UTF8String, !async);
|
||||
} else {
|
||||
std::string methodName = async ? "loadApplicationScript" : "loadApplicationScriptSync";
|
||||
throw std::logic_error("Attempt to call " + methodName + ": on uninitialized bridge");
|
||||
|
|
|
@ -76,9 +76,7 @@ public:
|
|||
|
||||
void loadApplicationScript(
|
||||
std::unique_ptr<const JSBigString> script,
|
||||
uint64_t /*scriptVersion*/, // TODO(OSS Candidate ISS#2710739)
|
||||
std::string sourceURL,
|
||||
std::string&& /*bytecodeFileName*/) override { // TODO(OSS Candidate ISS#2710739)
|
||||
std::string sourceURL) override {
|
||||
RCTProfileBeginFlowEvent();
|
||||
[m_jse executeApplicationScript:[NSData dataWithBytes:script->c_str() length:script->size()]
|
||||
sourceURL:[[NSURL alloc]
|
||||
|
|
|
@ -78,7 +78,7 @@ std::shared_ptr<Instance> CreateReactInstance(
|
|||
// Load from Assets.
|
||||
script = loadScriptFromAssets(assetManager, platformBundle.BundleUrl);
|
||||
}
|
||||
instance->loadScriptFromString(std::move(script), platformBundle.Version, std::move(platformBundle.BundleUrl), true /*synchronously*/, "" /*bytecodeFileName*/);
|
||||
instance->loadScriptFromString(std::move(script), std::move(platformBundle.BundleUrl), true /*synchronously*/);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ std::shared_ptr<Instance> CreateReactInstance(
|
|||
// Load from Assets.
|
||||
script = loadScriptFromAssets(assetManager, jsBundleFile);
|
||||
}
|
||||
instance->loadScriptFromString(std::move(script), 0 /*bundleVersion*/, jsBundleFile, false, "" /*bytecodeFileName*/);
|
||||
instance->loadScriptFromString(std::move(script), jsBundleFile, false);
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ void CatalystInstanceImpl::jniLoadScriptFromAssets(
|
|||
} else if (Instance::isIndexedRAMBundle(&script)) {
|
||||
instance_->loadRAMBundleFromString(std::move(script), sourceURL);
|
||||
} else {
|
||||
instance_->loadScriptFromString(std::move(script), 0 /*bundleVersion*/, sourceURL, loadSynchronously, "" /*bytecodeFileName*/);
|
||||
instance_->loadScriptFromString(std::move(script), sourceURL, loadSynchronously);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ void CatalystInstanceImpl::jniLoadScriptFromFile(const std::string& fileName,
|
|||
[&fileName, &script]() {
|
||||
script = JSBigFileString::fromPath(fileName);
|
||||
});
|
||||
instance_->loadScriptFromString(std::move(script), 0 /*bundleVersion*/, sourceURL, loadSynchronously, "" /*bytecodeFileName*/);
|
||||
instance_->loadScriptFromString(std::move(script), sourceURL, loadSynchronously);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ std::shared_ptr<Instance> CreateReactInstance(
|
|||
// Load from Assets.
|
||||
script = loadScriptFromAssets(assetManager, platformBundle.BundleUrl);
|
||||
}
|
||||
instance->loadScriptFromString(std::move(script), platformBundle.Version, std::move(platformBundle.BundleUrl), true /*synchronously*/, "" /*bytecodeFileName*/);
|
||||
instance->loadScriptFromString(std::move(script), std::move(platformBundle.BundleUrl), true /*synchronously*/);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ std::shared_ptr<Instance> CreateReactInstance(
|
|||
// Load from Assets.
|
||||
script = loadScriptFromAssets(assetManager, jsBundleFile);
|
||||
}
|
||||
instance->loadScriptFromString(std::move(script), 0 /*bundleVersion*/, jsBundleFile, false, "" /*bytecodeFileName*/);
|
||||
instance->loadScriptFromString(std::move(script), jsBundleFile, false);
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,9 +51,7 @@ ProxyExecutor::~ProxyExecutor() {
|
|||
|
||||
void ProxyExecutor::loadApplicationScript(
|
||||
std::unique_ptr<const JSBigString>,
|
||||
uint64_t /*scriptVersion*/,
|
||||
std::string sourceURL,
|
||||
std::string&& /*bytecodeFileName*/) {
|
||||
std::string sourceURL) {
|
||||
|
||||
folly::dynamic nativeModuleConfig = folly::dynamic::array;
|
||||
|
||||
|
|
|
@ -37,9 +37,7 @@ public:
|
|||
virtual ~ProxyExecutor() override;
|
||||
virtual void loadApplicationScript(
|
||||
std::unique_ptr<const JSBigString> script,
|
||||
uint64_t scriptVersion,
|
||||
std::string sourceURL,
|
||||
std::string&& bytecodeFileName) override;
|
||||
std::string sourceURL) override;
|
||||
virtual void setBundleRegistry(
|
||||
std::unique_ptr<RAMBundleRegistry> bundle) override;
|
||||
virtual void registerBundle(
|
||||
|
|
|
@ -69,47 +69,39 @@ void Instance::initializeBridge(
|
|||
|
||||
void Instance::loadApplication(std::unique_ptr<RAMBundleRegistry> bundleRegistry,
|
||||
std::unique_ptr<const JSBigString> bundle,
|
||||
uint64_t bundleVersion, // TODO(OSS Candidate ISS#2710739)
|
||||
std::string bundleURL,
|
||||
std::string&& bytecodeFileName) { // TODO(OSS Candidate ISS#2710739)
|
||||
std::string bundleURL) { // TODO(OSS Candidate ISS#2710739)
|
||||
callback_->incrementPendingJSCalls();
|
||||
SystraceSection s("Instance::loadApplication", "bundleURL",
|
||||
bundleURL);
|
||||
nativeToJsBridge_->loadApplication(std::move(bundleRegistry), std::move(bundle), bundleVersion,
|
||||
std::move(bundleURL), std::move(bytecodeFileName));
|
||||
SystraceSection s("Instance::loadApplication", "bundleURL", bundleURL);
|
||||
nativeToJsBridge_->loadApplication(
|
||||
std::move(bundleRegistry), std::move(bundle), std::move(bundleURL));
|
||||
}
|
||||
|
||||
void Instance::loadApplicationSync(std::unique_ptr<RAMBundleRegistry> bundleRegistry,
|
||||
std::unique_ptr<const JSBigString> bundle,
|
||||
uint64_t bundleVersion, // TODO(OSS Candidate ISS#2710739)
|
||||
std::string bundleURL,
|
||||
std::string&& bytecodeFileName) { // TODO(OSS Candidate ISS#2710739)
|
||||
std::string bundleURL) {
|
||||
std::unique_lock<std::mutex> lock(m_syncMutex);
|
||||
m_syncCV.wait(lock, [this] { return m_syncReady; });
|
||||
|
||||
SystraceSection s("Instance::loadApplicationSync", "bundleURL",
|
||||
bundleURL);
|
||||
nativeToJsBridge_->loadApplicationSync(std::move(bundleRegistry), std::move(bundle), bundleVersion,
|
||||
std::move(bundleURL), std::move(bytecodeFileName)); // TODO(OSS Candidate ISS#2710739)
|
||||
SystraceSection s("Instance::loadApplicationSync", "bundleURL", bundleURL);
|
||||
nativeToJsBridge_->loadApplicationSync(
|
||||
std::move(bundleRegistry), std::move(bundle), std::move(bundleURL));
|
||||
}
|
||||
|
||||
void Instance::setSourceURL(std::string sourceURL) {
|
||||
callback_->incrementPendingJSCalls();
|
||||
SystraceSection s("Instance::setSourceURL", "sourceURL", sourceURL);
|
||||
|
||||
nativeToJsBridge_->loadApplication(nullptr, nullptr, 0, std::move(sourceURL), "" /*bytecodeFileName*/); // TODO(OSS Candidate ISS#2710739)
|
||||
nativeToJsBridge_->loadApplication(nullptr, nullptr, std::move(sourceURL));
|
||||
}
|
||||
|
||||
void Instance::loadScriptFromString(std::unique_ptr<const JSBigString> bundleString,
|
||||
uint64_t bundleVersion,
|
||||
std::string bundleURL, // TODO(OSS Candidate ISS#2710739)
|
||||
bool loadSynchronously,
|
||||
std::string&& bytecodeFileName) { // TODO(OSS Candidate ISS#2710739)
|
||||
bool loadSynchronously) {
|
||||
SystraceSection s("Instance::loadScriptFromString", "bundleURL", bundleURL); // TODO(OSS Candidate ISS#2710739)
|
||||
if (loadSynchronously) {
|
||||
loadApplicationSync(nullptr, std::move(bundleString), bundleVersion, std::move(bundleURL), std::move(bytecodeFileName)); // TODO(OSS Candidate ISS#2710739)
|
||||
loadApplicationSync(nullptr, std::move(bundleString), std::move(bundleURL));
|
||||
} else {
|
||||
loadApplication(nullptr, std::move(bundleString), bundleVersion, std::move(bundleURL), std::move(bytecodeFileName)); // TODO(OSS Candidate ISS#2710739)
|
||||
loadApplication(nullptr, std::move(bundleString), std::move(bundleURL));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,11 +153,11 @@ void Instance::loadRAMBundle(std::unique_ptr<RAMBundleRegistry> bundleRegistry,
|
|||
std::string startupScriptSourceURL,
|
||||
bool loadSynchronously) {
|
||||
if (loadSynchronously) {
|
||||
loadApplicationSync(std::move(bundleRegistry), std::move(startupScript), 0 /*bundleVersion*/, // TODO(OSS Candidate ISS#2710739)
|
||||
std::move(startupScriptSourceURL), "" /*bytecodeFileName*/); // TODO(OSS Candidate ISS#2710739)
|
||||
loadApplicationSync(std::move(bundleRegistry), std::move(startupScript),
|
||||
std::move(startupScriptSourceURL));
|
||||
} else {
|
||||
loadApplication(std::move(bundleRegistry), std::move(startupScript), 0 /*bundleVersion*/, // TODO(OSS Candidate ISS#2710739)
|
||||
std::move(startupScriptSourceURL), "" /*bytecodeFileName*/); // TODO(OSS Candidate ISS#2710739)
|
||||
loadApplication(std::move(bundleRegistry), std::move(startupScript),
|
||||
std::move(startupScriptSourceURL));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,9 +62,10 @@ public:
|
|||
|
||||
void setSourceURL(std::string sourceURL);
|
||||
|
||||
virtual void loadScriptFromString(std::unique_ptr<const JSBigString> bundleString,
|
||||
uint64_t bundleVersion, std::string bundleURL, bool loadSynchronously,
|
||||
std::string&& bytecodeFileName);
|
||||
virtual void loadScriptFromString(
|
||||
std::unique_ptr<const JSBigString> bundleString,
|
||||
std::string bundleURL,
|
||||
bool loadSynchronously);
|
||||
static bool isIndexedRAMBundle(const char *sourcePath);
|
||||
static bool isIndexedRAMBundle(std::unique_ptr<const JSBigString>* string);
|
||||
void loadRAMBundleFromString(std::unique_ptr<const JSBigString> script, const std::string& sourceURL);
|
||||
|
@ -106,14 +107,10 @@ private:
|
|||
void callNativeModules(folly::dynamic &&calls, bool isEndOfBatch);
|
||||
virtual void loadApplication(std::unique_ptr<RAMBundleRegistry> bundleRegistry,
|
||||
std::unique_ptr<const JSBigString> bundle,
|
||||
uint64_t bundleVersion, // TODO(OSS Candidate ISS#2710739)
|
||||
std::string bundleURL,
|
||||
std::string&& bytecodeFileName); // TODO(OSS Candidate ISS#2710739)
|
||||
std::string bundleURL);
|
||||
virtual void loadApplicationSync(std::unique_ptr<RAMBundleRegistry> bundleRegistry,
|
||||
std::unique_ptr<const JSBigString> bundle,
|
||||
uint64_t bundleVersion, // TODO(OSS Candidate ISS#2710739)
|
||||
std::string bundleURL,
|
||||
std::string&& bytecodeFileName); // TODO(OSS Candidate ISS#2710739)
|
||||
std::string bundleURL);
|
||||
|
||||
std::shared_ptr<InstanceCallback> callback_;
|
||||
std::unique_ptr<NativeToJsBridge> nativeToJsBridge_;
|
||||
|
|
|
@ -77,9 +77,7 @@ public:
|
|||
* Execute an application script bundle in the JS context.
|
||||
*/
|
||||
virtual void loadApplicationScript(std::unique_ptr<const JSBigString> script,
|
||||
uint64_t scriptVersion, // TODO(OSS Candidate ISS#2710739)
|
||||
std::string sourceURL,
|
||||
std::string&& bytecodeFileName) = 0; // TODO(OSS Candidate ISS#2710739)
|
||||
std::string sourceURL) = 0;
|
||||
|
||||
/**
|
||||
* Add an application "RAM" bundle registry
|
||||
|
|
|
@ -105,27 +105,21 @@ NativeToJsBridge::~NativeToJsBridge() {
|
|||
void NativeToJsBridge::loadApplication(
|
||||
std::unique_ptr<RAMBundleRegistry> bundleRegistry,
|
||||
std::unique_ptr<const JSBigString> startupScript,
|
||||
uint64_t bundleVersion, // TODO(OSS Candidate ISS#2710739)
|
||||
std::string startupScriptSourceURL,
|
||||
std::string&& bytecodeFileName) { // TODO(OSS Candidate ISS#2710739)
|
||||
std::string startupScriptSourceURL) {
|
||||
|
||||
runOnExecutorQueue(
|
||||
[this,
|
||||
bundleRegistryWrap=folly::makeMoveWrapper(std::move(bundleRegistry)),
|
||||
startupScript=folly::makeMoveWrapper(std::move(startupScript)),
|
||||
bundleVersion,
|
||||
startupScriptSourceURL=std::move(startupScriptSourceURL),
|
||||
bytecodeFileName=std::move(bytecodeFileName)]
|
||||
startupScriptSourceURL=std::move(startupScriptSourceURL)]
|
||||
(JSExecutor* executor) mutable {
|
||||
auto bundleRegistry = bundleRegistryWrap.move();
|
||||
if (bundleRegistry) {
|
||||
executor->setBundleRegistry(std::move(bundleRegistry));
|
||||
}
|
||||
try {
|
||||
executor->loadApplicationScript(std::move(*startupScript),
|
||||
bundleVersion, // TODO(OSS Candidate ISS#2710739)
|
||||
std::move(startupScriptSourceURL),
|
||||
std::move(bytecodeFileName)); // TODO(OSS Candidate ISS#2710739)
|
||||
executor->loadApplicationScript(
|
||||
std::move(*startupScript), std::move(startupScriptSourceURL));
|
||||
} catch (...) {
|
||||
m_applicationScriptHasFailure = true;
|
||||
throw;
|
||||
|
@ -136,17 +130,13 @@ void NativeToJsBridge::loadApplication(
|
|||
void NativeToJsBridge::loadApplicationSync(
|
||||
std::unique_ptr<RAMBundleRegistry> bundleRegistry,
|
||||
std::unique_ptr<const JSBigString> startupScript,
|
||||
uint64_t bundleVersion,
|
||||
std::string startupScriptSourceURL,
|
||||
std::string&& bytecodeFileName) {
|
||||
std::string startupScriptSourceURL) {
|
||||
if (bundleRegistry) {
|
||||
m_executor->setBundleRegistry(std::move(bundleRegistry));
|
||||
}
|
||||
try {
|
||||
m_executor->loadApplicationScript(std::move(startupScript),
|
||||
bundleVersion, // TODO(OSS Candidate ISS#2710739)
|
||||
std::move(startupScriptSourceURL),
|
||||
std::move(bytecodeFileName)); // TODO(OSS Candidate ISS#2710739)
|
||||
m_executor->loadApplicationScript(
|
||||
std::move(startupScript), std::move(startupScriptSourceURL));
|
||||
} catch (...) {
|
||||
m_applicationScriptHasFailure = true;
|
||||
throw;
|
||||
|
|
|
@ -67,15 +67,11 @@ public:
|
|||
void loadApplication(
|
||||
std::unique_ptr<RAMBundleRegistry> bundleRegistry,
|
||||
std::unique_ptr<const JSBigString> bundle,
|
||||
uint64_t bundleVersion, // TODO(OSS Candidate ISS#2710739)
|
||||
std::string bundleURL,
|
||||
std::string&& bytecodeFileName); // TODO(OSS Candidate ISS#2710739)
|
||||
std::string bundleURL);
|
||||
void loadApplicationSync(
|
||||
std::unique_ptr<RAMBundleRegistry> bundleRegistry,
|
||||
std::unique_ptr<const JSBigString> bundle,
|
||||
uint64_t bundleVersion, // TODO(OSS Candidate ISS#2710739)
|
||||
std::string bundleURL,
|
||||
std::string&& bytecodeFileName); // TODO(OSS Candidate ISS#2710739)
|
||||
std::string bundleURL);
|
||||
|
||||
void registerBundle(uint32_t bundleId, const std::string& bundlePath);
|
||||
void setGlobalVariable(std::string propName, std::unique_ptr<const JSBigString> jsonValue);
|
||||
|
|
|
@ -368,9 +368,9 @@ static std::string simpleBasename(const std::string &path) {
|
|||
LOGV("V8Executor::simpleBasename exit");
|
||||
}
|
||||
|
||||
void V8Executor::loadApplicationScript(std::unique_ptr<const JSBigString> script, uint64_t /*scriptVersion*/, std::string sourceURL, std::string&& bytecodeFileName) {
|
||||
void V8Executor::loadApplicationScript(std::unique_ptr<const JSBigString> script, std::string sourceURL) {
|
||||
|
||||
LOGV("V8Executor::loadApplicationScript entry sourceURL = %s, bytecodeFileName = %s", sourceURL.c_str(), bytecodeFileName.c_str());
|
||||
LOGV("V8Executor::loadApplicationScript entry sourceURL = %s", sourceURL.c_str());
|
||||
SystraceSection s("V8Executor::loadApplicationScript", "sourceURL", sourceURL);
|
||||
std::string scriptName = simpleBasename(sourceURL);
|
||||
ReactMarker::logTaggedMarker(ReactMarker::RUN_JS_BUNDLE_START, scriptName.c_str());
|
||||
|
|
|
@ -54,9 +54,7 @@ public:
|
|||
|
||||
virtual void loadApplicationScript(
|
||||
std::unique_ptr<const JSBigString> script,
|
||||
uint64_t scriptVersion,
|
||||
std::string sourceURL,
|
||||
std::string&& bytecodeFileName) override;
|
||||
std::string sourceURL) override;
|
||||
|
||||
virtual void registerBundle(uint32_t bundleId, const std::string& bundlePath) override;
|
||||
|
||||
|
|
|
@ -69,9 +69,7 @@ JSIExecutor::JSIExecutor(
|
|||
|
||||
void JSIExecutor::loadApplicationScript(
|
||||
std::unique_ptr<const JSBigString> script,
|
||||
uint64_t /*scriptVersion*/, // TODO(OSS Candidate ISS#2710739)
|
||||
std::string sourceURL,
|
||||
std::string&& /*bytecodeFileName*/) { // TODO(OSS Candidate ISS#2710739)
|
||||
std::string sourceURL) {
|
||||
SystraceSection s("JSIExecutor::loadApplicationScript");
|
||||
|
||||
// TODO: check for and use precompiled HBC
|
||||
|
|
|
@ -76,9 +76,7 @@ class JSIExecutor : public JSExecutor {
|
|||
const JSIScopedTimeoutInvoker &timeoutInvoker,
|
||||
RuntimeInstaller runtimeInstaller);
|
||||
void loadApplicationScript(std::unique_ptr<const JSBigString> script,
|
||||
uint64_t scriptVersion, // TODO(OSS Candidate ISS#2710739)
|
||||
std::string sourceURL,
|
||||
std::string&& bytecodeFileName) override; // TODO(OSS Candidate ISS#2710739)
|
||||
std::string sourceURL) override;
|
||||
void setBundleRegistry(std::unique_ptr<RAMBundleRegistry>) override;
|
||||
void registerBundle(uint32_t bundleId, const std::string &bundlePath)
|
||||
override;
|
||||
|
|
Загрузка…
Ссылка в новой задаче