Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions React/CxxBridge/RCTCxxBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1337,8 +1337,8 @@ - (void)executeApplicationScript:(NSData *)script
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), 0, // TODO(OSS Candidate ISS#2710739)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the 0 here is for bundleVersion which still differs

sourceUrlStr.UTF8String, !async);
} else {
std::string methodName = async ? "loadApplicationScript" : "loadApplicationScriptSync";
throw std::logic_error("Attempt to call " + methodName + ": on uninitialized bridge");
Expand Down
3 changes: 1 addition & 2 deletions React/CxxBridge/RCTObjcExecutor.mm
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@
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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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), platformBundle.Version, std::move(platformBundle.BundleUrl), true /*synchronously*/);
}
}

Expand All @@ -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), 0 /*bundleVersion*/, jsBundleFile, false);
return instance;
}

Expand Down
4 changes: 2 additions & 2 deletions ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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), 0 /*bundleVersion*/, sourceURL, loadSynchronously);
}
}

Expand All @@ -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), 0 /*bundleVersion*/, sourceURL, loadSynchronously);
}
}

Expand Down
4 changes: 2 additions & 2 deletions ReactAndroid/src/main/jni/react/jni/InstanceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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), platformBundle.Version, std::move(platformBundle.BundleUrl), true /*synchronously*/);
}
}

Expand All @@ -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), 0 /*bundleVersion*/, jsBundleFile, false);
return instance;
}

Expand Down
3 changes: 1 addition & 2 deletions ReactAndroid/src/main/jni/react/jni/ProxyExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,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;

Expand Down
3 changes: 1 addition & 2 deletions ReactAndroid/src/main/jni/react/jni/ProxyExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ class ProxyExecutor : public JSExecutor {
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(
Expand Down
23 changes: 10 additions & 13 deletions ReactCommon/cxxreact/Instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,46 +70,43 @@ 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));
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)
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, 0, std::move(sourceURL)); // TODO(OSS Candidate ISS#2710739)
}

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), bundleVersion, std::move(bundleURL)); // TODO(OSS Candidate ISS#2710739)
} else {
loadApplication(nullptr, std::move(bundleString), bundleVersion, std::move(bundleURL), std::move(bytecodeFileName)); // TODO(OSS Candidate ISS#2710739)
loadApplication(nullptr, std::move(bundleString), bundleVersion, std::move(bundleURL)); // TODO(OSS Candidate ISS#2710739)
}
}

Expand Down Expand Up @@ -162,10 +159,10 @@ void Instance::loadRAMBundle(std::unique_ptr<RAMBundleRegistry> bundleRegistry,
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)
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)
std::move(startupScriptSourceURL));
}
}

Expand Down
9 changes: 3 additions & 6 deletions ReactCommon/cxxreact/Instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ class RN_EXPORT Instance {
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);
uint64_t bundleVersion, 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);
Expand Down Expand Up @@ -107,13 +106,11 @@ class RN_EXPORT Instance {
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_;
Expand Down
3 changes: 1 addition & 2 deletions ReactCommon/cxxreact/JSExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ class RN_EXPORT JSExecutor {
*/
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
Expand Down
15 changes: 5 additions & 10 deletions ReactCommon/cxxreact/NativeToJsBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,14 @@ 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) {
Expand All @@ -124,8 +122,7 @@ void NativeToJsBridge::loadApplication(
try {
executor->loadApplicationScript(std::move(*startupScript),
bundleVersion, // TODO(OSS Candidate ISS#2710739)
std::move(startupScriptSourceURL),
std::move(bytecodeFileName)); // TODO(OSS Candidate ISS#2710739)
std::move(startupScriptSourceURL));
} catch (...) {
m_applicationScriptHasFailure = true;
throw;
Expand All @@ -137,16 +134,14 @@ 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)
std::move(startupScriptSourceURL));
} catch (...) {
m_applicationScriptHasFailure = true;
throw;
Expand Down
6 changes: 2 additions & 4 deletions ReactCommon/cxxreact/NativeToJsBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,12 @@ class NativeToJsBridge {
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);
Expand Down
4 changes: 2 additions & 2 deletions ReactCommon/cxxreact/V8Executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, uint64_t /*scriptVersion*/, 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());
Expand Down
3 changes: 1 addition & 2 deletions ReactCommon/cxxreact/V8Executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ class RN_EXPORT V8Executor : public JSExecutor, public PrivateDataBase {
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;

Expand Down
3 changes: 1 addition & 2 deletions ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,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
Expand Down
3 changes: 1 addition & 2 deletions ReactCommon/jsiexecutor/jsireact/JSIExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ class JSIExecutor : public JSExecutor {
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;
Expand Down