Alexander Blom 0ac7bf29af 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
2016-11-02 12:29:14 -07:00

36 lines
1.0 KiB
C++

// 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));
}
}
}