Skip to content

Commit 80df54c

Browse files
sammy-SCfacebook-github-bot
authored andcommitted
Remove dead JSIndexedRAMBundle from cxxreact
Summary: `JSIndexedRAMBundle` was a deprecated legacy-architecture class (annotated `[[deprecated("This API will be removed along with the legacy architecture.")]]` and guarded by `#ifndef RCT_REMOVE_LEGACY_ARCH`) for parsing indexed RAM bundles. It was only ever instantiated by `Instance::loadRAMBundleFromString` and `Instance::loadRAMBundleFromFile`, and those two `Instance` methods have no callers anywhere in fbsource: the old Android entry point `CatalystInstanceImpl` that used to call them has been deleted, and the new architecture (`ReactInstance` / bridgeless) routes `loadScriptFromFile` through `loadJSBundleFromFile` in the new runtime, never touching the legacy `Instance`. The only remaining user was its own unit test. This removes `JSIndexedRAMBundle` and the two dead `Instance` RAM-bundle loaders that referenced it: - Delete `JSIndexedRAMBundle.cpp`, `JSIndexedRAMBundle.h`, and `JSIndexedRAMBundleTest.cpp`. - Remove `loadRAMBundleFromString` / `loadRAMBundleFromFile` from `Instance.cpp` / `Instance.h` and drop the now-unused include. - Drop `JSIndexedRAMBundle.h` from `CXXREACT_PUBLIC_HEADERS` in `cxxreact/BUCK`. - Update the committed C++ API snapshots accordingly. The broader legacy RAM-bundle machinery (`RAMBundleRegistry`, `JSModulesUnbundle`, `Instance::loadRAMBundle`, `JSIExecutor::setBundleRegistry`) is left in place; it belongs to the same `RCT_REMOVE_LEGACY_ARCH` legacy bridge and can be removed as a follow-up. Differential Revision: D108001933
1 parent 4adca58 commit 80df54c

11 files changed

Lines changed: 0 additions & 380 deletions

File tree

packages/react-native/ReactCommon/cxxreact/Instance.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "RecoverableError.h"
2121
#include "TraceSection.h"
2222

23-
#include <cxxreact/JSIndexedRAMBundle.h>
2423
#include <folly/json.h>
2524
#include <react/debug/react_native_assert.h>
2625

@@ -175,30 +174,6 @@ void Instance::loadScriptFromString(
175174
}
176175
}
177176

178-
void Instance::loadRAMBundleFromString(
179-
std::unique_ptr<const JSBigString> script,
180-
const std::string& sourceURL) {
181-
auto bundle = std::make_unique<JSIndexedRAMBundle>(std::move(script));
182-
auto startupScript = bundle->getStartupCode();
183-
auto registry = RAMBundleRegistry::singleBundleRegistry(std::move(bundle));
184-
loadRAMBundle(std::move(registry), std::move(startupScript), sourceURL, true);
185-
}
186-
187-
void Instance::loadRAMBundleFromFile(
188-
const std::string& sourcePath,
189-
const std::string& sourceURL,
190-
bool loadSynchronously) {
191-
auto bundle = std::make_unique<JSIndexedRAMBundle>(sourcePath.c_str());
192-
auto startupScript = bundle->getStartupCode();
193-
auto registry = RAMBundleRegistry::multipleBundlesRegistry(
194-
std::move(bundle), JSIndexedRAMBundle::buildFactory());
195-
loadRAMBundle(
196-
std::move(registry),
197-
std::move(startupScript),
198-
sourceURL,
199-
loadSynchronously);
200-
}
201-
202177
void Instance::loadRAMBundle(
203178
std::unique_ptr<RAMBundleRegistry> bundleRegistry,
204179
std::unique_ptr<const JSBigString> startupScript,

packages/react-native/ReactCommon/cxxreact/Instance.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ class RN_EXPORT [[deprecated("This API will be removed along with the legacy arc
5757
void setSourceURL(std::string sourceURL);
5858

5959
void loadScriptFromString(std::unique_ptr<const JSBigString> string, std::string sourceURL, bool loadSynchronously);
60-
void loadRAMBundleFromString(std::unique_ptr<const JSBigString> script, const std::string &sourceURL);
61-
void loadRAMBundleFromFile(const std::string &sourcePath, const std::string &sourceURL, bool loadSynchronously);
6260
void loadRAMBundle(
6361
std::unique_ptr<RAMBundleRegistry> bundleRegistry,
6462
std::unique_ptr<const JSBigString> startupScript,

packages/react-native/ReactCommon/cxxreact/JSIndexedRAMBundle.cpp

Lines changed: 0 additions & 145 deletions
This file was deleted.

packages/react-native/ReactCommon/cxxreact/JSIndexedRAMBundle.h

Lines changed: 0 additions & 72 deletions
This file was deleted.

packages/react-native/ReactCommon/cxxreact/tests/JSIndexedRAMBundleTest.cpp

Lines changed: 0 additions & 76 deletions
This file was deleted.

scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2727,8 +2727,6 @@ class facebook::react::Instance {
27272727
public void initializeBridge(std::unique_ptr<facebook::react::InstanceCallback> callback, std::shared_ptr<facebook::react::JSExecutorFactory> jsef, std::shared_ptr<facebook::react::MessageQueueThread> jsQueue, std::shared_ptr<facebook::react::ModuleRegistry> moduleRegistry, facebook::react::jsinspector_modern::HostTarget* inspectorTarget = nullptr);
27282728
public void initializeRuntime();
27292729
public void loadRAMBundle(std::unique_ptr<facebook::react::RAMBundleRegistry> bundleRegistry, std::unique_ptr<const facebook::react::JSBigString> startupScript, std::string startupScriptSourceURL, bool loadSynchronously);
2730-
public void loadRAMBundleFromFile(const std::string& sourcePath, const std::string& sourceURL, bool loadSynchronously);
2731-
public void loadRAMBundleFromString(std::unique_ptr<const facebook::react::JSBigString> script, const std::string& sourceURL);
27322730
public void loadScriptFromString(std::unique_ptr<const facebook::react::JSBigString> string, std::string sourceURL, bool loadSynchronously);
27332731
public void registerBundle(uint32_t bundleId, const std::string& bundlePath);
27342732
public void setGlobalVariable(std::string propName, std::unique_ptr<const facebook::react::JSBigString> jsonValue);
@@ -3004,14 +3002,6 @@ class facebook::react::JSINativeModules {
30043002
public void reset();
30053003
}
30063004

3007-
class facebook::react::JSIndexedRAMBundle : public facebook::react::JSModulesUnbundle {
3008-
public JSIndexedRAMBundle(const char* sourcePath);
3009-
public JSIndexedRAMBundle(std::unique_ptr<const facebook::react::JSBigString> script);
3010-
public static std::function<std::unique_ptr<facebook::react::JSModulesUnbundle>(std::string)> buildFactory();
3011-
public std::unique_ptr<const facebook::react::JSBigString> getStartupCode();
3012-
public virtual facebook::react::JSModulesUnbundle::Module getModule(uint32_t moduleId) const override;
3013-
}
3014-
30153005
class facebook::react::JSModulesUnbundle {
30163006
public JSModulesUnbundle();
30173007
public virtual facebook::react::JSModulesUnbundle::Module getModule(uint32_t moduleId) const = 0;

scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2724,8 +2724,6 @@ class facebook::react::Instance {
27242724
public void initializeBridge(std::unique_ptr<facebook::react::InstanceCallback> callback, std::shared_ptr<facebook::react::JSExecutorFactory> jsef, std::shared_ptr<facebook::react::MessageQueueThread> jsQueue, std::shared_ptr<facebook::react::ModuleRegistry> moduleRegistry, facebook::react::jsinspector_modern::HostTarget* inspectorTarget = nullptr);
27252725
public void initializeRuntime();
27262726
public void loadRAMBundle(std::unique_ptr<facebook::react::RAMBundleRegistry> bundleRegistry, std::unique_ptr<const facebook::react::JSBigString> startupScript, std::string startupScriptSourceURL, bool loadSynchronously);
2727-
public void loadRAMBundleFromFile(const std::string& sourcePath, const std::string& sourceURL, bool loadSynchronously);
2728-
public void loadRAMBundleFromString(std::unique_ptr<const facebook::react::JSBigString> script, const std::string& sourceURL);
27292727
public void loadScriptFromString(std::unique_ptr<const facebook::react::JSBigString> string, std::string sourceURL, bool loadSynchronously);
27302728
public void registerBundle(uint32_t bundleId, const std::string& bundlePath);
27312729
public void setGlobalVariable(std::string propName, std::unique_ptr<const facebook::react::JSBigString> jsonValue);
@@ -3001,14 +2999,6 @@ class facebook::react::JSINativeModules {
30012999
public void reset();
30023000
}
30033001

3004-
class facebook::react::JSIndexedRAMBundle : public facebook::react::JSModulesUnbundle {
3005-
public JSIndexedRAMBundle(const char* sourcePath);
3006-
public JSIndexedRAMBundle(std::unique_ptr<const facebook::react::JSBigString> script);
3007-
public static std::function<std::unique_ptr<facebook::react::JSModulesUnbundle>(std::string)> buildFactory();
3008-
public std::unique_ptr<const facebook::react::JSBigString> getStartupCode();
3009-
public virtual facebook::react::JSModulesUnbundle::Module getModule(uint32_t moduleId) const override;
3010-
}
3011-
30123002
class facebook::react::JSModulesUnbundle {
30133003
public JSModulesUnbundle();
30143004
public virtual facebook::react::JSModulesUnbundle::Module getModule(uint32_t moduleId) const = 0;

0 commit comments

Comments
 (0)