diff --git a/packages/react-native/ReactCommon/cxxreact/JSExecutor.cpp b/packages/react-native/ReactCommon/cxxreact/JSExecutor.cpp index b6130f1ecfe..e68a716d772 100644 --- a/packages/react-native/ReactCommon/cxxreact/JSExecutor.cpp +++ b/packages/react-native/ReactCommon/cxxreact/JSExecutor.cpp @@ -39,6 +39,7 @@ std::unique_ptr JSExecutor::createAgentDelegate( jsinspector_modern::FrontendChannel frontendChannel, jsinspector_modern::SessionState& sessionState, + std::unique_ptr, const jsinspector_modern::ExecutionContextDescription& executionContextDescription) { (void)executionContextDescription; diff --git a/packages/react-native/ReactCommon/cxxreact/JSExecutor.h b/packages/react-native/ReactCommon/cxxreact/JSExecutor.h index ac0c4ce64a3..e89f9245452 100644 --- a/packages/react-native/ReactCommon/cxxreact/JSExecutor.h +++ b/packages/react-native/ReactCommon/cxxreact/JSExecutor.h @@ -147,6 +147,8 @@ class RN_EXPORT JSExecutor : public jsinspector_modern::RuntimeTargetDelegate { createAgentDelegate( jsinspector_modern::FrontendChannel frontendChannel, jsinspector_modern::SessionState& sessionState, + std::unique_ptr + previouslyExportedState, const jsinspector_modern::ExecutionContextDescription& executionContextDescription) override; }; diff --git a/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp b/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp index 09c1dad5045..4b1414253d3 100644 --- a/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp +++ b/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp @@ -261,6 +261,8 @@ std::unique_ptr HermesExecutor::createAgentDelegate( jsinspector_modern::FrontendChannel frontendChannel, jsinspector_modern::SessionState& sessionState, + std::unique_ptr + previouslyExportedState, const jsinspector_modern::ExecutionContextDescription& executionContextDescription) { std::shared_ptr hermesRuntimeShared(runtime_, &hermesRuntime_); @@ -268,6 +270,7 @@ HermesExecutor::createAgentDelegate( new jsinspector_modern::HermesRuntimeAgentDelegate( frontendChannel, sessionState, + std::move(previouslyExportedState), executionContextDescription, hermesRuntimeShared, [jsQueueWeak = std::weak_ptr(jsQueue_), diff --git a/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.h b/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.h index a7658fea1a9..689a58f7f05 100644 --- a/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.h +++ b/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.h @@ -58,6 +58,8 @@ class HermesExecutor : public JSIExecutor { createAgentDelegate( jsinspector_modern::FrontendChannel frontendChannel, jsinspector_modern::SessionState& sessionState, + std::unique_ptr + previouslyExportedState, const jsinspector_modern::ExecutionContextDescription& executionContextDescription) override; diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeAgentDelegate.cpp b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeAgentDelegate.cpp index 57a19a8978e..bfea30fc827 100644 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeAgentDelegate.cpp +++ b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeAgentDelegate.cpp @@ -67,6 +67,26 @@ class HermesRuntimeAgentDelegate::Impl final : public RuntimeAgentDelegate { using HermesCDPHandler = hermes::inspector_modern::chrome::CDPHandler; using HermesExecutionContextDescription = hermes::inspector_modern::chrome::CDPHandlerExecutionContextDescription; + using HermesState = hermes::inspector_modern::chrome::State; + + struct HermesStateWrapper : public ExportedState { + explicit HermesStateWrapper(std::unique_ptr state) + : state_(std::move(state)) {} + + static std::unique_ptr unwrapDestructively( + ExportedState* wrapper) { + if (!wrapper) { + return nullptr; + } + if (auto* typedWrapper = dynamic_cast(wrapper)) { + return std::move(typedWrapper->state_); + } + return nullptr; + } + + private: + std::unique_ptr state_; + }; public: /** @@ -75,6 +95,10 @@ class HermesRuntimeAgentDelegate::Impl final : public RuntimeAgentDelegate { * \param sessionState The state of the current CDP session. This will only * be accessed on the main thread (during the constructor, in handleRequest, * etc). + * \param previouslyExportedState The exported state from a previous instance + * of RuntimeAgentDelegate (NOT necessarily HermesRuntimeAgentDelegate). This + * may be nullptr, and if not nullptr it may be of any concrete type that + * implements RuntimeAgentDelegate::ExportedState. * \param executionContextDescription A description of the execution context * represented by this runtime. This is used for disambiguating the * source/destination of CDP messages when there are multiple runtimes @@ -87,6 +111,8 @@ class HermesRuntimeAgentDelegate::Impl final : public RuntimeAgentDelegate { Impl( FrontendChannel frontendChannel, SessionState& sessionState, + std::unique_ptr + previouslyExportedState, const ExecutionContextDescription& executionContextDescription, std::shared_ptr runtime, RuntimeExecutor runtimeExecutor) @@ -96,7 +122,9 @@ class HermesRuntimeAgentDelegate::Impl final : public RuntimeAgentDelegate { runtimeExecutor), /* waitForDebugger */ false, /* enableConsoleAPICapturing */ false, - /* state */ nullptr, + /* state */ + HermesStateWrapper::unwrapDestructively( + previouslyExportedState.get()), {.isRuntimeDomainEnabled = sessionState.isRuntimeDomainEnabled}, HermesExecutionContextDescription{ .id = executionContextDescription.id, @@ -139,6 +167,10 @@ class HermesRuntimeAgentDelegate::Impl final : public RuntimeAgentDelegate { return true; } + virtual std::unique_ptr getExportedState() override { + return std::make_unique(hermes_->getState()); + } + private: std::shared_ptr hermes_; }; @@ -155,6 +187,7 @@ class HermesRuntimeAgentDelegate::Impl final Impl( FrontendChannel frontendChannel, SessionState& sessionState, + std::unique_ptr, const ExecutionContextDescription&, std::shared_ptr runtime, RuntimeExecutor) @@ -169,12 +202,15 @@ class HermesRuntimeAgentDelegate::Impl final HermesRuntimeAgentDelegate::HermesRuntimeAgentDelegate( FrontendChannel frontendChannel, SessionState& sessionState, + std::unique_ptr + previouslyExportedState, const ExecutionContextDescription& executionContextDescription, std::shared_ptr runtime, RuntimeExecutor runtimeExecutor) : impl_(std::make_unique( std::move(frontendChannel), sessionState, + std::move(previouslyExportedState), executionContextDescription, std::move(runtime), std::move(runtimeExecutor))) {} @@ -184,4 +220,9 @@ bool HermesRuntimeAgentDelegate::handleRequest( return impl_->handleRequest(req); } +std::unique_ptr +HermesRuntimeAgentDelegate::getExportedState() { + return impl_->getExportedState(); +} + } // namespace facebook::react::jsinspector_modern diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeAgentDelegate.h b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeAgentDelegate.h index 4f8e92c47e0..e6be5dc7246 100644 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeAgentDelegate.h +++ b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeAgentDelegate.h @@ -26,6 +26,10 @@ class HermesRuntimeAgentDelegate : public RuntimeAgentDelegate { * \param sessionState The state of the current CDP session. This will only * be accessed on the main thread (during the constructor, in handleRequest, * etc). + * \param previouslyExportedState The exported state from a previous instance + * of RuntimeAgentDelegate (NOT necessarily HermesRuntimeAgentDelegate). This + * may be nullptr, and if not nullptr it may be of any concrete type that + * implements RuntimeAgentDelegate::ExportedState. * \param executionContextDescription A description of the execution context * represented by this runtime. This is used for disambiguating the * source/destination of CDP messages when there are multiple runtimes @@ -38,6 +42,8 @@ class HermesRuntimeAgentDelegate : public RuntimeAgentDelegate { HermesRuntimeAgentDelegate( FrontendChannel frontendChannel, SessionState& sessionState, + std::unique_ptr + previouslyExportedState, const ExecutionContextDescription& executionContextDescription, std::shared_ptr runtime, RuntimeExecutor runtimeExecutor); @@ -52,6 +58,8 @@ class HermesRuntimeAgentDelegate : public RuntimeAgentDelegate { */ bool handleRequest(const cdp::PreparsedRequest& req) override; + virtual std::unique_ptr getExportedState() override; + private: // We use the private implementation idiom to keep HERMES_ENABLE_DEBUGGER // checks out of the header. diff --git a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.cpp b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.cpp index 4ac2f1a4d3a..05071cfe4b8 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.cpp @@ -6,6 +6,7 @@ */ #include "RuntimeAgent.h" +#include "SessionState.h" namespace facebook::react::jsinspector_modern { @@ -120,4 +121,18 @@ void RuntimeAgent::notifyBindingCalled( "name", bindingName)("payload", payload)))); } +RuntimeAgent::ExportedState RuntimeAgent::getExportedState() { + return { + .delegateState = delegate_ ? delegate_->getExportedState() : nullptr, + }; +} + +RuntimeAgent::~RuntimeAgent() { + // TODO: Eventually, there may be more than one Runtime per Page, and we'll + // need to store multiple agent states here accordingly. For now let's do + // the simple thing and assume (as we do elsewhere) that only one Runtime + // per Page can exist at a time. + sessionState_.lastRuntimeAgentExportedState = getExportedState(); +} + } // namespace facebook::react::jsinspector_modern diff --git a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.h b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.h index 4f676634d63..0310f2a9165 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.h +++ b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.h @@ -10,13 +10,13 @@ #include "InspectorInterfaces.h" #include "RuntimeAgentDelegate.h" #include "RuntimeTarget.h" -#include "SessionState.h" #include namespace facebook::react::jsinspector_modern { class RuntimeTargetController; +struct SessionState; /** * An Agent that handles requests from the Chrome DevTools Protocol @@ -48,6 +48,8 @@ class RuntimeAgent final { SessionState& sessionState, std::unique_ptr delegate); + ~RuntimeAgent(); + /** * Handle a CDP request. The response will be sent over the provided * \c FrontendChannel synchronously or asynchronously. Performs any @@ -69,6 +71,17 @@ class RuntimeAgent final { const std::string& bindingName, const std::string& payload); + struct ExportedState { + std::unique_ptr delegateState; + }; + + /** + * Export the RuntimeAgent's state, if available. This will be called + * shortly before the RuntimeAgent is destroyed to preserve state that may be + * needed when constructin a new RuntimeAgent. + */ + ExportedState getExportedState(); + private: FrontendChannel frontendChannel_; RuntimeTargetController& targetController_; diff --git a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgentDelegate.h b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgentDelegate.h index 1c705001e3f..d7042d60d48 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgentDelegate.h +++ b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgentDelegate.h @@ -19,6 +19,11 @@ namespace facebook::react::jsinspector_modern { */ class RuntimeAgentDelegate { public: + class ExportedState { + public: + virtual ~ExportedState() = default; + }; + virtual ~RuntimeAgentDelegate() = default; /** @@ -30,6 +35,17 @@ class RuntimeAgentDelegate { * agent expects another agent to respond to the request instead. */ virtual bool handleRequest(const cdp::PreparsedRequest& req) = 0; + + /** + * Export RuntimeAgentDelegate-specific state that should persist across + * consecutive RuntimeTargets in this session. + * If the RuntimeTarget is destroyed and later logically replaced by a new + * one (e.g. as part of an Instance reload), the state returned here will be + * passed to \ref RuntimeTargetDelegate::createAgentDelegate. + */ + inline virtual std::unique_ptr getExportedState() { + return std::make_unique(); + } }; } // namespace facebook::react::jsinspector_modern diff --git a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.cpp b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.cpp index 747ae1fc099..c9a8be6f597 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.cpp @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +#include "SessionState.h" + #include using namespace facebook::jsi; @@ -33,13 +35,18 @@ RuntimeTarget::RuntimeTarget( std::shared_ptr RuntimeTarget::createAgent( FrontendChannel channel, SessionState& sessionState) { + auto runtimeAgentState = + std::move(sessionState.lastRuntimeAgentExportedState); auto runtimeAgent = std::make_shared( channel, controller_, executionContextDescription_, sessionState, delegate_.createAgentDelegate( - channel, sessionState, executionContextDescription_)); + channel, + sessionState, + std::move(runtimeAgentState.delegateState), + executionContextDescription_)); agents_.insert(runtimeAgent); return runtimeAgent; } diff --git a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.h b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.h index 2ccab82d422..20c42cb2644 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.h +++ b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.h @@ -13,7 +13,6 @@ #include "InspectorInterfaces.h" #include "RuntimeAgent.h" #include "ScopedExecutor.h" -#include "SessionState.h" #include "WeakList.h" #include @@ -35,6 +34,7 @@ namespace facebook::react::jsinspector_modern { class RuntimeAgent; class RuntimeAgentDelegate; class RuntimeTarget; +struct SessionState; /** * Receives events from a RuntimeTarget. This is a shared interface that @@ -47,6 +47,8 @@ class RuntimeTargetDelegate { virtual std::unique_ptr createAgentDelegate( FrontendChannel channel, SessionState& sessionState, + std::unique_ptr + previouslyExportedState, const ExecutionContextDescription& executionContextDescription) = 0; }; diff --git a/packages/react-native/ReactCommon/jsinspector-modern/SessionState.h b/packages/react-native/ReactCommon/jsinspector-modern/SessionState.h index 16d6cb1b75c..a0329cc2db7 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/SessionState.h +++ b/packages/react-native/ReactCommon/jsinspector-modern/SessionState.h @@ -8,6 +8,7 @@ #pragma once #include "ExecutionContext.h" +#include "RuntimeAgent.h" #include #include @@ -34,6 +35,12 @@ struct SessionState { std::unordered_map subscribedBindings; + /** + * Stores the state object exported from the last main RuntimeAgent, if any, + * before it was destroyed. + */ + RuntimeAgent::ExportedState lastRuntimeAgentExportedState; + // Here, we will eventually allow RuntimeAgents to store their own arbitrary // state (e.g. some sort of K/V storage of folly::dynamic?) diff --git a/packages/react-native/ReactCommon/jsinspector-modern/tests/InspectorMocks.h b/packages/react-native/ReactCommon/jsinspector-modern/tests/InspectorMocks.h index 08c1f354066..4a2346cc638 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/tests/InspectorMocks.h +++ b/packages/react-native/ReactCommon/jsinspector-modern/tests/InspectorMocks.h @@ -131,6 +131,8 @@ class MockRuntimeTargetDelegate : public RuntimeTargetDelegate { createAgentDelegate, (FrontendChannel channel, SessionState& sessionState, + std::unique_ptr + previouslyExportedState, const ExecutionContextDescription&), (override)); }; @@ -140,6 +142,7 @@ class MockRuntimeAgentDelegate : public RuntimeAgentDelegate { inline MockRuntimeAgentDelegate( FrontendChannel frontendChannel, SessionState& sessionState, + std::unique_ptr, const ExecutionContextDescription& executionContextDescription) : frontendChannel(std::move(frontendChannel)), sessionState(sessionState), diff --git a/packages/react-native/ReactCommon/jsinspector-modern/tests/PageTargetTest.cpp b/packages/react-native/ReactCommon/jsinspector-modern/tests/PageTargetTest.cpp index d43bbff7e4e..31b01eb1571 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/tests/PageTargetTest.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/tests/PageTargetTest.cpp @@ -31,10 +31,11 @@ class PageTargetTest : public Test { protected: PageTargetTest() { - EXPECT_CALL(runtimeTargetDelegate_, createAgentDelegate(_, _, _)) + EXPECT_CALL(runtimeTargetDelegate_, createAgentDelegate(_, _, _, _)) .WillRepeatedly(runtimeAgentDelegates_.lazily_make_unique< FrontendChannel, SessionState&, + std::unique_ptr, const ExecutionContextDescription&>()); } @@ -444,7 +445,7 @@ TEST_F(PageTargetProtocolTest, MessageRoutingWhileNoRuntimeAgentDelegate) { TEST_F(PageTargetProtocolTest, InstanceWithNullRuntimeAgentDelegate) { InSequence s; - EXPECT_CALL(runtimeTargetDelegate_, createAgentDelegate(_, _, _)) + EXPECT_CALL(runtimeTargetDelegate_, createAgentDelegate(_, _, _, _)) .WillRepeatedly(ReturnNull()); auto& instanceTarget = page_->registerInstance(instanceTargetDelegate_); diff --git a/packages/react-native/ReactCommon/jsinspector-modern/tests/engines/JsiIntegrationTestGenericEngineAdapter.cpp b/packages/react-native/ReactCommon/jsinspector-modern/tests/engines/JsiIntegrationTestGenericEngineAdapter.cpp index 15adb108738..ee842d237dc 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/tests/engines/JsiIntegrationTestGenericEngineAdapter.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/tests/engines/JsiIntegrationTestGenericEngineAdapter.cpp @@ -24,6 +24,7 @@ std::unique_ptr JsiIntegrationTestGenericEngineAdapter::createAgentDelegate( FrontendChannel frontendChannel, SessionState& sessionState, + std::unique_ptr, const ExecutionContextDescription&) { return std::unique_ptr( new FallbackRuntimeAgentDelegate( diff --git a/packages/react-native/ReactCommon/jsinspector-modern/tests/engines/JsiIntegrationTestGenericEngineAdapter.h b/packages/react-native/ReactCommon/jsinspector-modern/tests/engines/JsiIntegrationTestGenericEngineAdapter.h index e87c212c090..665477e303b 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/tests/engines/JsiIntegrationTestGenericEngineAdapter.h +++ b/packages/react-native/ReactCommon/jsinspector-modern/tests/engines/JsiIntegrationTestGenericEngineAdapter.h @@ -28,6 +28,8 @@ class JsiIntegrationTestGenericEngineAdapter : public RuntimeTargetDelegate { virtual std::unique_ptr createAgentDelegate( FrontendChannel frontendChannel, SessionState& sessionState, + std::unique_ptr + previouslyExportedState, const ExecutionContextDescription& executionContextDescription) override; jsi::Runtime& getRuntime() const noexcept; diff --git a/packages/react-native/ReactCommon/jsinspector-modern/tests/engines/JsiIntegrationTestHermesEngineAdapter.cpp b/packages/react-native/ReactCommon/jsinspector-modern/tests/engines/JsiIntegrationTestHermesEngineAdapter.cpp index 534eeeb6546..57efca34257 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/tests/engines/JsiIntegrationTestHermesEngineAdapter.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/tests/engines/JsiIntegrationTestHermesEngineAdapter.cpp @@ -23,11 +23,14 @@ std::unique_ptr JsiIntegrationTestHermesEngineAdapter::createAgentDelegate( FrontendChannel frontendChannel, SessionState& sessionState, + std::unique_ptr + previouslyExportedState, const ExecutionContextDescription& executionContextDescription) { return std::unique_ptr( new HermesRuntimeAgentDelegate( frontendChannel, sessionState, + std::move(previouslyExportedState), executionContextDescription, runtime_, getRuntimeExecutor())); diff --git a/packages/react-native/ReactCommon/jsinspector-modern/tests/engines/JsiIntegrationTestHermesEngineAdapter.h b/packages/react-native/ReactCommon/jsinspector-modern/tests/engines/JsiIntegrationTestHermesEngineAdapter.h index 47540a76bc8..08c35800e25 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/tests/engines/JsiIntegrationTestHermesEngineAdapter.h +++ b/packages/react-native/ReactCommon/jsinspector-modern/tests/engines/JsiIntegrationTestHermesEngineAdapter.h @@ -28,6 +28,8 @@ class JsiIntegrationTestHermesEngineAdapter : public RuntimeTargetDelegate { virtual std::unique_ptr createAgentDelegate( FrontendChannel frontendChannel, SessionState& sessionState, + std::unique_ptr + previouslyExportedState, const ExecutionContextDescription& executionContextDescription) override; jsi::Runtime& getRuntime() const noexcept; diff --git a/packages/react-native/ReactCommon/react/runtime/JSRuntimeFactory.cpp b/packages/react-native/ReactCommon/react/runtime/JSRuntimeFactory.cpp index 28567871d55..832d21e40c7 100644 --- a/packages/react-native/ReactCommon/react/runtime/JSRuntimeFactory.cpp +++ b/packages/react-native/ReactCommon/react/runtime/JSRuntimeFactory.cpp @@ -22,6 +22,7 @@ std::unique_ptr JSIRuntimeHolder::createAgentDelegate( jsinspector_modern::FrontendChannel frontendChannel, jsinspector_modern::SessionState& sessionState, + std::unique_ptr, const jsinspector_modern::ExecutionContextDescription& executionContextDescription) { (void)executionContextDescription; diff --git a/packages/react-native/ReactCommon/react/runtime/JSRuntimeFactory.h b/packages/react-native/ReactCommon/react/runtime/JSRuntimeFactory.h index af97c2d940e..f7b17be8562 100644 --- a/packages/react-native/ReactCommon/react/runtime/JSRuntimeFactory.h +++ b/packages/react-native/ReactCommon/react/runtime/JSRuntimeFactory.h @@ -44,6 +44,8 @@ class JSIRuntimeHolder : public JSRuntime { std::unique_ptr createAgentDelegate( jsinspector_modern::FrontendChannel frontendChannel, jsinspector_modern::SessionState& sessionState, + std::unique_ptr + previouslyExportedState, const jsinspector_modern::ExecutionContextDescription& executionContextDescription) override; diff --git a/packages/react-native/ReactCommon/react/runtime/hermes/HermesInstance.cpp b/packages/react-native/ReactCommon/react/runtime/hermes/HermesInstance.cpp index 3de09a64c3d..13308c81c26 100644 --- a/packages/react-native/ReactCommon/react/runtime/hermes/HermesInstance.cpp +++ b/packages/react-native/ReactCommon/react/runtime/hermes/HermesInstance.cpp @@ -107,12 +107,15 @@ class HermesJSRuntime : public JSRuntime { std::unique_ptr createAgentDelegate( jsinspector_modern::FrontendChannel frontendChannel, jsinspector_modern::SessionState& sessionState, + std::unique_ptr + previouslyExportedState, const jsinspector_modern::ExecutionContextDescription& executionContextDescription) override { return std::unique_ptr( new jsinspector_modern::HermesRuntimeAgentDelegate( frontendChannel, sessionState, + std::move(previouslyExportedState), executionContextDescription, runtime_, [msgQueueThreadWeak = std::weak_ptr(msgQueueThread_),