mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Add Page, Runtime, Debugger agents
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
This commit is contained in:
committed by
Facebook Github Bot
parent
156e5d9837
commit
0ac7bf29af
35
ReactCommon/inspector/LegacyAgents.cpp
Normal file
35
ReactCommon/inspector/LegacyAgents.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
#include "LegacyAgents.h"
|
||||
|
||||
#include "LegacyInspectorEnvironment.h"
|
||||
#include "LegacyRuntimeAgent.h"
|
||||
#include "LegacyDebuggerAgent.h"
|
||||
|
||||
#include <JavaScriptCore/config.h>
|
||||
#include <JavaScriptCore/JSGlobalObject.h>
|
||||
#include <folly/Memory.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
using namespace Inspector;
|
||||
|
||||
LegacyAgents::LegacyAgents(
|
||||
JSC::JSGlobalObject& globalObject,
|
||||
std::unique_ptr<LegacyInspectorEnvironment> environment,
|
||||
ConsoleAgent* consoleAgent)
|
||||
: LegacyDispatcher(globalObject)
|
||||
, environment_(std::move(environment)) {
|
||||
auto injectedScriptManager = environment_->injectedScriptManager();
|
||||
auto runtimeAgent = folly::make_unique<LegacyRuntimeAgent>(injectedScriptManager, globalObject);
|
||||
auto debuggerAgent = folly::make_unique<LegacyDebuggerAgent>(injectedScriptManager, globalObject, consoleAgent);
|
||||
|
||||
runtimeAgent->setScriptDebugServer(&debuggerAgent->scriptDebugServer());
|
||||
|
||||
addAgent("Runtime", std::move(runtimeAgent));
|
||||
addAgent("Debugger", std::move(debuggerAgent));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user