// Copyright 2004-present Facebook. All Rights Reserved. #pragma once #include "Dispatcher.h" #include #include #include #include #include #include #include namespace JSC { class JSGlobalObject; } namespace facebook { namespace react { /* * An dispatcher that is able to register JavaScriptCore agents that extend the InspectorAgentBase * base class. */ class LegacyDispatcher : public Dispatcher { public: LegacyDispatcher(JSC::JSGlobalObject& globalObject); void addAgent(std::string domain, std::unique_ptr agent); void onConnect(std::shared_ptr channel) override; void onDisconnect() override; private: class FrontendChannel : public Inspector::InspectorFrontendChannel { public: FrontendChannel(std::shared_ptr channel); bool sendMessageToFrontend(const WTF::String& message) override; private: std::shared_ptr channel_; }; JSC::JSGlobalObject& globalObject_; std::vector domains_; Inspector::InspectorAgentRegistry agents_; std::unique_ptr frontendChannel_; std::unique_ptr dispatcher_; }; } }