Skip to content

Commit a43c396

Browse files
Riccardo Cipolleschimeta-codesync[bot]
authored andcommitted
Generated from a GitHub Pull Request. Run 'jf sync' on this diff to load the correct commit data.
Differential Revision: D104228879
1 parent 535b844 commit a43c396

9 files changed

Lines changed: 7 additions & 636 deletions

File tree

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ 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")
26-
2725
# If you have ccache installed, we're going to honor it.
2826
find_program(CCACHE_FOUND ccache)
2927
if(CCACHE_FOUND)

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: 6 additions & 79 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.
@@ -133,14 +91,11 @@ struct ReentrancyCheck {
13391
#endif
13492
};
13593

136-
// This adds ReentrancyCheck and debugger enable/teardown to the given
137-
// Runtime.
94+
// This adds ReentrancyCheck to the given Runtime.
13895
class DecoratedRuntime : public jsi::WithRuntimeDecorator<ReentrancyCheck> {
13996
public:
14097
// The first argument may be another decorater which itself
14198
// decorates the real HermesRuntime, depending on the build config.
142-
// The second argument is the real HermesRuntime as well to
143-
// manage the debugger registration.
14499
DecoratedRuntime(
145100
std::unique_ptr<Runtime> runtime,
146101
HermesRuntime& hermesRuntime,
@@ -149,42 +104,17 @@ class DecoratedRuntime : public jsi::WithRuntimeDecorator<ReentrancyCheck> {
149104
const std::string& debuggerName)
150105
: jsi::WithRuntimeDecorator<ReentrancyCheck>(*runtime, reentrancyCheck_),
151106
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
107+
(void)hermesRuntime;
162108
(void)jsQueue;
163-
#endif // HERMES_ENABLE_DEBUGGER
109+
(void)enableDebugger;
110+
(void)debuggerName;
164111
}
165112

166-
~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
172-
}
113+
~DecoratedRuntime() {}
173114

174115
private:
175-
// runtime_ is a potentially decorated Runtime.
176-
// hermesRuntime is a reference to a HermesRuntime managed by runtime_.
177-
//
178-
// HermesExecutorRuntimeAdapter requirements are kept, because the
179-
// dtor will disable debugging on the HermesRuntime before the
180-
// member managing it is destroyed.
181-
182116
std::shared_ptr<Runtime> runtime_;
183117
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
188118
};
189119

190120
} // namespace
@@ -221,10 +151,7 @@ std::unique_ptr<JSExecutor> HermesExecutorFactory::createJSExecutor(
221151
//
222152
// DecoratedRuntime is held by JSIExecutor. When it gets used, it
223153
// will check that it's on the right thread, do any necessary trace
224-
// logging, then call the real HermesRuntime. When it is destroyed,
225-
// it will shut down the debugger before the HermesRuntime is. In
226-
// the normal case where debugging is not compiled in,
227-
// all that's left is the thread checking.
154+
// logging, then call the real HermesRuntime.
228155

229156
// Add js engine information to Error.prototype so in error reporting we
230157
// can send this information.

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.

0 commit comments

Comments
 (0)