Skip to content

Commit e56decd

Browse files
committed
Remove legacy Hermes C++ code and HERMES_V1_ENABLED compile definition
Legacy Hermes support is no longer needed since 0.86 branch has been cut. This removes all dead code behind `!defined(HERMES_V1_ENABLED)` guards and the CMake infrastructure that set the HERMES_V1_ENABLED compile definition.
1 parent 91702e5 commit e56decd

9 files changed

Lines changed: 5 additions & 618 deletions

File tree

packages/react-native/ReactAndroid/src/main/jni/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ file(TO_CMAKE_PATH "${REACT_ANDROID_DIR}" REACT_ANDROID_DIR)
2222
file(TO_CMAKE_PATH "${REACT_BUILD_DIR}" REACT_BUILD_DIR)
2323
file(TO_CMAKE_PATH "${REACT_COMMON_DIR}" REACT_COMMON_DIR)
2424

25-
set(HERMES_V1_ENABLED OFF CACHE BOOL "Build with support for Hermes v1")
25+
set(HERMES_V1_ENABLED ON CACHE BOOL "Build with support for Hermes v1")
2626

2727
# If you have ccache installed, we're going to honor it.
2828
find_program(CCACHE_FOUND ccache)

packages/react-native/ReactCommon/cmake-utils/react-native-flags.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,5 @@ function(target_compile_reactnative_options target_name scope)
3232
if(ANDROID)
3333
target_compile_definitions(${target_name} ${scope} RN_SERIALIZABLE_STATE)
3434
endif()
35-
if(HERMES_V1_ENABLED)
36-
target_compile_definitions(${target_name} ${scope} HERMES_V1_ENABLED=1)
37-
endif()
35+
target_compile_definitions(${target_name} ${scope} HERMES_V1_ENABLED=1)
3836
endfunction()

packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp

Lines changed: 3 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -17,55 +17,13 @@
1717

1818
#include <hermes/inspector-modern/chrome/HermesRuntimeTargetDelegate.h>
1919

20-
#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
21-
#include <hermes/inspector-modern/chrome/Registration.h>
22-
#include <hermes/inspector/RuntimeAdapter.h>
23-
#endif
24-
2520
using namespace facebook::hermes;
2621
using namespace facebook::jsi;
2722

2823
namespace facebook::react {
2924

3025
namespace {
3126

32-
#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
33-
34-
class HermesExecutorRuntimeAdapter
35-
: public facebook::hermes::inspector_modern::RuntimeAdapter {
36-
public:
37-
HermesExecutorRuntimeAdapter(
38-
std::shared_ptr<HermesRuntime> runtime,
39-
std::shared_ptr<MessageQueueThread> thread)
40-
: runtime_(runtime), thread_(std::move(thread)) {}
41-
42-
virtual ~HermesExecutorRuntimeAdapter() = default;
43-
44-
HermesRuntime& getRuntime() override {
45-
return *runtime_;
46-
}
47-
48-
void tickleJs() override {
49-
thread_->runOnQueue(
50-
[weakRuntime = std::weak_ptr<HermesRuntime>(runtime_)]() {
51-
auto runtime = weakRuntime.lock();
52-
if (!runtime) {
53-
return;
54-
}
55-
jsi::Function func =
56-
runtime->global().getPropertyAsFunction(*runtime, "__tickleJs");
57-
func.call(*runtime);
58-
});
59-
}
60-
61-
private:
62-
std::shared_ptr<HermesRuntime> runtime_;
63-
64-
std::shared_ptr<MessageQueueThread> thread_;
65-
};
66-
67-
#endif // defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
68-
6927
struct ReentrancyCheck {
7028
// This is effectively a very subtle and complex assert, so only
7129
// include it in builds which would include asserts.
@@ -149,26 +107,13 @@ class DecoratedRuntime : public jsi::WithRuntimeDecorator<ReentrancyCheck> {
149107
const std::string& debuggerName)
150108
: jsi::WithRuntimeDecorator<ReentrancyCheck>(*runtime, reentrancyCheck_),
151109
runtime_(std::move(runtime)) {
152-
#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
153-
enableDebugger_ = enableDebugger;
154-
if (enableDebugger_) {
155-
std::shared_ptr<HermesRuntime> rt(runtime_, &hermesRuntime);
156-
auto adapter =
157-
std::make_unique<HermesExecutorRuntimeAdapter>(rt, jsQueue);
158-
debugToken_ = facebook::hermes::inspector_modern::chrome::enableDebugging(
159-
std::move(adapter), debuggerName);
160-
}
161-
#else
110+
(void)hermesRuntime;
162111
(void)jsQueue;
163-
#endif // HERMES_ENABLE_DEBUGGER
112+
(void)enableDebugger;
113+
(void)debuggerName;
164114
}
165115

166116
~DecoratedRuntime() {
167-
#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
168-
if (enableDebugger_) {
169-
facebook::hermes::inspector_modern::chrome::disableDebugging(debugToken_);
170-
}
171-
#endif // HERMES_ENABLE_DEBUGGER
172117
}
173118

174119
private:
@@ -181,10 +126,6 @@ class DecoratedRuntime : public jsi::WithRuntimeDecorator<ReentrancyCheck> {
181126

182127
std::shared_ptr<Runtime> runtime_;
183128
ReentrancyCheck reentrancyCheck_;
184-
#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
185-
bool enableDebugger_;
186-
facebook::hermes::inspector_modern::chrome::DebugSessionToken debugToken_;
187-
#endif // HERMES_ENABLE_DEBUGGER
188129
};
189130

190131
} // namespace

packages/react-native/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.cpp

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

packages/react-native/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.h

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

packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp

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

0 commit comments

Comments
 (0)