Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ file(TO_CMAKE_PATH "${REACT_ANDROID_DIR}" REACT_ANDROID_DIR)
file(TO_CMAKE_PATH "${REACT_BUILD_DIR}" REACT_BUILD_DIR)
file(TO_CMAKE_PATH "${REACT_COMMON_DIR}" REACT_COMMON_DIR)

set(HERMES_V1_ENABLED OFF CACHE BOOL "Build with support for Hermes v1")

# If you have ccache installed, we're going to honor it.
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,4 @@ function(target_compile_reactnative_options target_name scope)
if(ANDROID)
target_compile_definitions(${target_name} ${scope} RN_SERIALIZABLE_STATE)
endif()
if(HERMES_V1_ENABLED)
target_compile_definitions(${target_name} ${scope} HERMES_V1_ENABLED=1)
endif()
endfunction()
Original file line number Diff line number Diff line change
Expand Up @@ -17,55 +17,13 @@

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

#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
#include <hermes/inspector-modern/chrome/Registration.h>
#include <hermes/inspector/RuntimeAdapter.h>
#endif

using namespace facebook::hermes;
using namespace facebook::jsi;

namespace facebook::react {

namespace {

#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)

class HermesExecutorRuntimeAdapter
: public facebook::hermes::inspector_modern::RuntimeAdapter {
public:
HermesExecutorRuntimeAdapter(
std::shared_ptr<HermesRuntime> runtime,
std::shared_ptr<MessageQueueThread> thread)
: runtime_(runtime), thread_(std::move(thread)) {}

virtual ~HermesExecutorRuntimeAdapter() = default;

HermesRuntime& getRuntime() override {
return *runtime_;
}

void tickleJs() override {
thread_->runOnQueue(
[weakRuntime = std::weak_ptr<HermesRuntime>(runtime_)]() {
auto runtime = weakRuntime.lock();
if (!runtime) {
return;
}
jsi::Function func =
runtime->global().getPropertyAsFunction(*runtime, "__tickleJs");
func.call(*runtime);
});
}

private:
std::shared_ptr<HermesRuntime> runtime_;

std::shared_ptr<MessageQueueThread> thread_;
};

#endif // defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)

struct ReentrancyCheck {
// This is effectively a very subtle and complex assert, so only
// include it in builds which would include asserts.
Expand Down Expand Up @@ -149,26 +107,13 @@ class DecoratedRuntime : public jsi::WithRuntimeDecorator<ReentrancyCheck> {
const std::string& debuggerName)
: jsi::WithRuntimeDecorator<ReentrancyCheck>(*runtime, reentrancyCheck_),
runtime_(std::move(runtime)) {
#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
enableDebugger_ = enableDebugger;
if (enableDebugger_) {
std::shared_ptr<HermesRuntime> rt(runtime_, &hermesRuntime);
auto adapter =
std::make_unique<HermesExecutorRuntimeAdapter>(rt, jsQueue);
debugToken_ = facebook::hermes::inspector_modern::chrome::enableDebugging(
std::move(adapter), debuggerName);
}
#else
(void)hermesRuntime;
(void)jsQueue;
#endif // HERMES_ENABLE_DEBUGGER
(void)enableDebugger;
(void)debuggerName;
}

~DecoratedRuntime() {
#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
if (enableDebugger_) {
facebook::hermes::inspector_modern::chrome::disableDebugging(debugToken_);
}
#endif // HERMES_ENABLE_DEBUGGER
}

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

std::shared_ptr<Runtime> runtime_;
ReentrancyCheck reentrancyCheck_;
#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
bool enableDebugger_;
facebook::hermes::inspector_modern::chrome::DebugSessionToken debugToken_;
#endif // HERMES_ENABLE_DEBUGGER
};

} // namespace
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading