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:
Alexander Blom
2016-11-02 12:18:13 -07:00
committed by Facebook Github Bot
parent 156e5d9837
commit 0ac7bf29af
15 changed files with 592 additions and 0 deletions

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