Skip to content

Commit 9bba27f

Browse files
authored
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.
1 parent 3c4fb85 commit 9bba27f

File tree

16 files changed

+47
-87
lines changed

16 files changed

+47
-87
lines changed

React/CxxBridge/RCTCxxBridge.mm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,8 +1337,7 @@ - (void)executeApplicationScript:(NSData *)script
13371337
sourceUrlStr.UTF8String, !async);
13381338
}
13391339
} else if (reactInstance) {
1340-
reactInstance->loadScriptFromString(std::make_unique<NSDataBigString>(script), 0,
1341-
sourceUrlStr.UTF8String, !async, ""); // TODO(OSS Candidate ISS#2710739)
1340+
reactInstance->loadScriptFromString(std::make_unique<NSDataBigString>(script), sourceUrlStr.UTF8String, !async);
13421341
} else {
13431342
std::string methodName = async ? "loadApplicationScript" : "loadApplicationScriptSync";
13441343
throw std::logic_error("Attempt to call " + methodName + ": on uninitialized bridge");

React/CxxBridge/RCTObjcExecutor.mm

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@
7676

7777
void loadApplicationScript(
7878
std::unique_ptr<const JSBigString> script,
79-
uint64_t /*scriptVersion*/, // TODO(OSS Candidate ISS#2710739)
80-
std::string sourceURL,
81-
std::string&& /*bytecodeFileName*/) override { // TODO(OSS Candidate ISS#2710739)
79+
std::string sourceURL) override {
8280
RCTProfileBeginFlowEvent();
8381
[m_jse executeApplicationScript:[NSData dataWithBytes:script->c_str() length:script->size()]
8482
sourceURL:[[NSURL alloc]

ReactAndroid/src/main/java/com/facebook/react/v8executor/InstanceManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ std::shared_ptr<Instance> CreateReactInstance(
7878
// Load from Assets.
7979
script = loadScriptFromAssets(assetManager, platformBundle.BundleUrl);
8080
}
81-
instance->loadScriptFromString(std::move(script), platformBundle.Version, std::move(platformBundle.BundleUrl), true /*synchronously*/, "" /*bytecodeFileName*/);
81+
instance->loadScriptFromString(std::move(script), std::move(platformBundle.BundleUrl), true /*synchronously*/);
8282
}
8383
}
8484

@@ -94,7 +94,7 @@ std::shared_ptr<Instance> CreateReactInstance(
9494
// Load from Assets.
9595
script = loadScriptFromAssets(assetManager, jsBundleFile);
9696
}
97-
instance->loadScriptFromString(std::move(script), 0 /*bundleVersion*/, jsBundleFile, false, "" /*bytecodeFileName*/);
97+
instance->loadScriptFromString(std::move(script), jsBundleFile, false);
9898
return instance;
9999
}
100100

ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ void CatalystInstanceImpl::jniLoadScriptFromAssets(
211211
} else if (Instance::isIndexedRAMBundle(&script)) {
212212
instance_->loadRAMBundleFromString(std::move(script), sourceURL);
213213
} else {
214-
instance_->loadScriptFromString(std::move(script), 0 /*bundleVersion*/, sourceURL, loadSynchronously, "" /*bytecodeFileName*/);
214+
instance_->loadScriptFromString(std::move(script), sourceURL, loadSynchronously);
215215
}
216216
}
217217

@@ -226,7 +226,7 @@ void CatalystInstanceImpl::jniLoadScriptFromFile(const std::string& fileName,
226226
[&fileName, &script]() {
227227
script = JSBigFileString::fromPath(fileName);
228228
});
229-
instance_->loadScriptFromString(std::move(script), 0 /*bundleVersion*/, sourceURL, loadSynchronously, "" /*bytecodeFileName*/);
229+
instance_->loadScriptFromString(std::move(script), sourceURL, loadSynchronously);
230230
}
231231
}
232232

ReactAndroid/src/main/jni/react/jni/InstanceManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ std::shared_ptr<Instance> CreateReactInstance(
7979
// Load from Assets.
8080
script = loadScriptFromAssets(assetManager, platformBundle.BundleUrl);
8181
}
82-
instance->loadScriptFromString(std::move(script), platformBundle.Version, std::move(platformBundle.BundleUrl), true /*synchronously*/, "" /*bytecodeFileName*/);
82+
instance->loadScriptFromString(std::move(script), std::move(platformBundle.BundleUrl), true /*synchronously*/);
8383
}
8484
}
8585

@@ -95,7 +95,7 @@ std::shared_ptr<Instance> CreateReactInstance(
9595
// Load from Assets.
9696
script = loadScriptFromAssets(assetManager, jsBundleFile);
9797
}
98-
instance->loadScriptFromString(std::move(script), 0 /*bundleVersion*/, jsBundleFile, false, "" /*bytecodeFileName*/);
98+
instance->loadScriptFromString(std::move(script), jsBundleFile, false);
9999
return instance;
100100
}
101101

ReactAndroid/src/main/jni/react/jni/ProxyExecutor.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ ProxyExecutor::~ProxyExecutor() {
5151

5252
void ProxyExecutor::loadApplicationScript(
5353
std::unique_ptr<const JSBigString>,
54-
uint64_t /*scriptVersion*/,
55-
std::string sourceURL,
56-
std::string&& /*bytecodeFileName*/) {
54+
std::string sourceURL) {
5755

5856
folly::dynamic nativeModuleConfig = folly::dynamic::array;
5957

ReactAndroid/src/main/jni/react/jni/ProxyExecutor.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ class ProxyExecutor : public JSExecutor {
3737
virtual ~ProxyExecutor() override;
3838
virtual void loadApplicationScript(
3939
std::unique_ptr<const JSBigString> script,
40-
uint64_t scriptVersion,
41-
std::string sourceURL,
42-
std::string&& bytecodeFileName) override;
40+
std::string sourceURL) override;
4341
virtual void setBundleRegistry(
4442
std::unique_ptr<RAMBundleRegistry> bundle) override;
4543
virtual void registerBundle(

ReactCommon/cxxreact/Instance.cpp

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -69,47 +69,39 @@ void Instance::initializeBridge(
6969

7070
void Instance::loadApplication(std::unique_ptr<RAMBundleRegistry> bundleRegistry,
7171
std::unique_ptr<const JSBigString> bundle,
72-
uint64_t bundleVersion, // TODO(OSS Candidate ISS#2710739)
73-
std::string bundleURL,
74-
std::string&& bytecodeFileName) { // TODO(OSS Candidate ISS#2710739)
72+
std::string bundleURL) { // TODO(OSS Candidate ISS#2710739)
7573
callback_->incrementPendingJSCalls();
76-
SystraceSection s("Instance::loadApplication", "bundleURL",
77-
bundleURL);
78-
nativeToJsBridge_->loadApplication(std::move(bundleRegistry), std::move(bundle), bundleVersion,
79-
std::move(bundleURL), std::move(bytecodeFileName));
74+
SystraceSection s("Instance::loadApplication", "bundleURL", bundleURL);
75+
nativeToJsBridge_->loadApplication(
76+
std::move(bundleRegistry), std::move(bundle), std::move(bundleURL));
8077
}
8178

8279
void Instance::loadApplicationSync(std::unique_ptr<RAMBundleRegistry> bundleRegistry,
8380
std::unique_ptr<const JSBigString> bundle,
84-
uint64_t bundleVersion, // TODO(OSS Candidate ISS#2710739)
85-
std::string bundleURL,
86-
std::string&& bytecodeFileName) { // TODO(OSS Candidate ISS#2710739)
81+
std::string bundleURL) {
8782
std::unique_lock<std::mutex> lock(m_syncMutex);
8883
m_syncCV.wait(lock, [this] { return m_syncReady; });
8984

90-
SystraceSection s("Instance::loadApplicationSync", "bundleURL",
91-
bundleURL);
92-
nativeToJsBridge_->loadApplicationSync(std::move(bundleRegistry), std::move(bundle), bundleVersion,
93-
std::move(bundleURL), std::move(bytecodeFileName)); // TODO(OSS Candidate ISS#2710739)
85+
SystraceSection s("Instance::loadApplicationSync", "bundleURL", bundleURL);
86+
nativeToJsBridge_->loadApplicationSync(
87+
std::move(bundleRegistry), std::move(bundle), std::move(bundleURL));
9488
}
9589

9690
void Instance::setSourceURL(std::string sourceURL) {
9791
callback_->incrementPendingJSCalls();
9892
SystraceSection s("Instance::setSourceURL", "sourceURL", sourceURL);
9993

100-
nativeToJsBridge_->loadApplication(nullptr, nullptr, 0, std::move(sourceURL), "" /*bytecodeFileName*/); // TODO(OSS Candidate ISS#2710739)
94+
nativeToJsBridge_->loadApplication(nullptr, nullptr, std::move(sourceURL));
10195
}
10296

10397
void Instance::loadScriptFromString(std::unique_ptr<const JSBigString> bundleString,
104-
uint64_t bundleVersion,
10598
std::string bundleURL, // TODO(OSS Candidate ISS#2710739)
106-
bool loadSynchronously,
107-
std::string&& bytecodeFileName) { // TODO(OSS Candidate ISS#2710739)
99+
bool loadSynchronously) {
108100
SystraceSection s("Instance::loadScriptFromString", "bundleURL", bundleURL); // TODO(OSS Candidate ISS#2710739)
109101
if (loadSynchronously) {
110-
loadApplicationSync(nullptr, std::move(bundleString), bundleVersion, std::move(bundleURL), std::move(bytecodeFileName)); // TODO(OSS Candidate ISS#2710739)
102+
loadApplicationSync(nullptr, std::move(bundleString), std::move(bundleURL));
111103
} else {
112-
loadApplication(nullptr, std::move(bundleString), bundleVersion, std::move(bundleURL), std::move(bytecodeFileName)); // TODO(OSS Candidate ISS#2710739)
104+
loadApplication(nullptr, std::move(bundleString), std::move(bundleURL));
113105
}
114106
}
115107

@@ -161,11 +153,11 @@ void Instance::loadRAMBundle(std::unique_ptr<RAMBundleRegistry> bundleRegistry,
161153
std::string startupScriptSourceURL,
162154
bool loadSynchronously) {
163155
if (loadSynchronously) {
164-
loadApplicationSync(std::move(bundleRegistry), std::move(startupScript), 0 /*bundleVersion*/, // TODO(OSS Candidate ISS#2710739)
165-
std::move(startupScriptSourceURL), "" /*bytecodeFileName*/); // TODO(OSS Candidate ISS#2710739)
156+
loadApplicationSync(std::move(bundleRegistry), std::move(startupScript),
157+
std::move(startupScriptSourceURL));
166158
} else {
167-
loadApplication(std::move(bundleRegistry), std::move(startupScript), 0 /*bundleVersion*/, // TODO(OSS Candidate ISS#2710739)
168-
std::move(startupScriptSourceURL), "" /*bytecodeFileName*/); // TODO(OSS Candidate ISS#2710739)
159+
loadApplication(std::move(bundleRegistry), std::move(startupScript),
160+
std::move(startupScriptSourceURL));
169161
}
170162
}
171163

ReactCommon/cxxreact/Instance.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ class RN_EXPORT Instance {
6262

6363
void setSourceURL(std::string sourceURL);
6464

65-
virtual void loadScriptFromString(std::unique_ptr<const JSBigString> bundleString,
66-
uint64_t bundleVersion, std::string bundleURL, bool loadSynchronously,
67-
std::string&& bytecodeFileName);
65+
virtual void loadScriptFromString(
66+
std::unique_ptr<const JSBigString> bundleString,
67+
std::string bundleURL,
68+
bool loadSynchronously);
6869
static bool isIndexedRAMBundle(const char *sourcePath);
6970
static bool isIndexedRAMBundle(std::unique_ptr<const JSBigString>* string);
7071
void loadRAMBundleFromString(std::unique_ptr<const JSBigString> script, const std::string& sourceURL);
@@ -106,14 +107,10 @@ class RN_EXPORT Instance {
106107
void callNativeModules(folly::dynamic &&calls, bool isEndOfBatch);
107108
virtual void loadApplication(std::unique_ptr<RAMBundleRegistry> bundleRegistry,
108109
std::unique_ptr<const JSBigString> bundle,
109-
uint64_t bundleVersion, // TODO(OSS Candidate ISS#2710739)
110-
std::string bundleURL,
111-
std::string&& bytecodeFileName); // TODO(OSS Candidate ISS#2710739)
110+
std::string bundleURL);
112111
virtual void loadApplicationSync(std::unique_ptr<RAMBundleRegistry> bundleRegistry,
113112
std::unique_ptr<const JSBigString> bundle,
114-
uint64_t bundleVersion, // TODO(OSS Candidate ISS#2710739)
115-
std::string bundleURL,
116-
std::string&& bytecodeFileName); // TODO(OSS Candidate ISS#2710739)
113+
std::string bundleURL);
117114

118115
std::shared_ptr<InstanceCallback> callback_;
119116
std::unique_ptr<NativeToJsBridge> nativeToJsBridge_;

ReactCommon/cxxreact/JSExecutor.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ class RN_EXPORT JSExecutor {
7777
* Execute an application script bundle in the JS context.
7878
*/
7979
virtual void loadApplicationScript(std::unique_ptr<const JSBigString> script,
80-
uint64_t scriptVersion, // TODO(OSS Candidate ISS#2710739)
81-
std::string sourceURL,
82-
std::string&& bytecodeFileName) = 0; // TODO(OSS Candidate ISS#2710739)
80+
std::string sourceURL) = 0;
8381

8482
/**
8583
* Add an application "RAM" bundle registry

0 commit comments

Comments
 (0)