mirror of
https://github.com/status-im/react-native.git
synced 2025-01-16 12:34:17 +00:00
0ac7bf29af
Summary: Runtime and Debugger agents are shipped with JSC so we reuse them. Messages are routed to them through the `LegacyDispatcher` which also handles translating their events. The Page agent emits the `Page.getResourceTree` method that the Chrome inspector expects. Reviewed By: michalgr Differential Revision: D4021499 fbshipit-source-id: a93d0add01cee732401f8e8db1d43205bfbd4cd4
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "Dispatcher.h"
|
|
|
|
#include <JavaScriptCore/config.h>
|
|
#include <JavaScriptCore/InspectorAgentRegistry.h>
|
|
#include <JavaScriptCore/InspectorAgentBase.h>
|
|
#include <JavaScriptCore/InspectorFrontendChannel.h>
|
|
#include <JavaScriptCore/InspectorBackendDispatcher.h>
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
namespace JSC {
|
|
class JSGlobalObject;
|
|
}
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
class LegacyDispatcher : public Dispatcher {
|
|
public:
|
|
LegacyDispatcher(JSC::JSGlobalObject& globalObject);
|
|
void addAgent(std::string domain, std::unique_ptr<Inspector::InspectorAgentBase> agent);
|
|
|
|
void onConnect(std::shared_ptr<Channel> channel) override;
|
|
void onDisconnect() override;
|
|
private:
|
|
class FrontendChannel : public Inspector::InspectorFrontendChannel {
|
|
public:
|
|
FrontendChannel(std::shared_ptr<Channel> channel);
|
|
bool sendMessageToFrontend(const WTF::String& message) override;
|
|
private:
|
|
std::shared_ptr<Channel> channel_;
|
|
};
|
|
|
|
JSC::JSGlobalObject& globalObject_;
|
|
std::vector<std::string> domains_;
|
|
Inspector::InspectorAgentRegistry agents_;
|
|
|
|
std::unique_ptr<FrontendChannel> frontendChannel_;
|
|
std::unique_ptr<Inspector::InspectorBackendDispatcher> dispatcher_;
|
|
};
|
|
|
|
}
|
|
}
|