Make RuntimeAdapter use only HermesRuntime

Summary:
Changelog: [Internal]

Make runtime use more consistent, always using the same undecorated runtime. This prevents the previous mixing of decorated and undecorated runtimes.

Reviewed By: jpporto

Differential Revision: D38035166

fbshipit-source-id: 81929e42ccc4de6d5c5c09ee7ee31f055af82735
This commit is contained in:
Matt Blagden
2022-08-04 14:50:45 -07:00
committed by Facebook GitHub Bot
parent 402b00a513
commit 04e0ffdfa5
@@ -41,12 +41,9 @@ class HermesExecutorRuntimeAdapter
: public facebook::hermes::inspector::RuntimeAdapter {
public:
HermesExecutorRuntimeAdapter(
std::shared_ptr<Runtime> runtime,
HermesRuntime &hermesRuntime,
std::shared_ptr<HermesRuntime> runtime,
std::shared_ptr<MessageQueueThread> thread)
: runtime_(runtime),
hermesRuntime_(hermesRuntime),
thread_(std::move(thread)) {}
: runtime_(runtime), thread_(std::move(thread)) {}
virtual ~HermesExecutorRuntimeAdapter() = default;
@@ -55,7 +52,7 @@ class HermesExecutorRuntimeAdapter
}
debugger::Debugger &getDebugger() override {
return hermesRuntime_.getDebugger();
return runtime_->getDebugger();
}
void tickleJs() override {
@@ -69,8 +66,7 @@ class HermesExecutorRuntimeAdapter
}
private:
std::shared_ptr<Runtime> runtime_;
HermesRuntime &hermesRuntime_;
std::shared_ptr<HermesRuntime> runtime_;
std::shared_ptr<MessageQueueThread> thread_;
};
@@ -160,8 +156,8 @@ class DecoratedRuntime : public jsi::WithRuntimeDecorator<ReentrancyCheck> {
runtime_(std::move(runtime)),
hermesRuntime_(hermesRuntime) {
#ifdef HERMES_ENABLE_DEBUGGER
auto adapter = std::make_unique<HermesExecutorRuntimeAdapter>(
runtime_, hermesRuntime_, jsQueue);
std::shared_ptr<HermesRuntime> rt(runtime_, &hermesRuntime);
auto adapter = std::make_unique<HermesExecutorRuntimeAdapter>(rt, jsQueue);
facebook::hermes::inspector::chrome::enableDebugging(
std::move(adapter), "Hermes React Native");
#else
@@ -171,7 +167,7 @@ class DecoratedRuntime : public jsi::WithRuntimeDecorator<ReentrancyCheck> {
~DecoratedRuntime() {
#ifdef HERMES_ENABLE_DEBUGGER
facebook::hermes::inspector::chrome::disableDebugging(*runtime_);
facebook::hermes::inspector::chrome::disableDebugging(hermesRuntime_);
#endif
}