react-native/ReactCommon/inspector/LegacyScriptDebugServer.h
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

46 lines
1.4 KiB
C++

// Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#include <JavaScriptCore/config.h>
#include <JavaScriptCore/ScriptDebugServer.h>
namespace JSC {
class JSGlobalObject;
}
namespace facebook {
namespace react {
class LegacyScriptDebugServer : public Inspector::ScriptDebugServer {
public:
LegacyScriptDebugServer(JSC::JSGlobalObject& object);
void addListener(Inspector::ScriptDebugListener* listener);
void removeListener(Inspector::ScriptDebugListener* listener, bool isBeingDestroyed);
JSC::JSGlobalObject& globalObject() const { return globalObject_; }
void recompileAllJSFunctions() override;
private:
ListenerSet* getListenersForGlobalObject(JSC::JSGlobalObject*) override { return &listeners_; }
void didPause(JSC::JSGlobalObject*) override { }
void didContinue(JSC::JSGlobalObject*) override { }
void runEventLoopWhilePaused() override;
bool isContentScript(JSC::ExecState*) const override { return false; }
// NOTE: Currently all exceptions are reported at the API boundary through reportAPIException.
// Until a time comes where an exception can be caused outside of the API (e.g. setTimeout
// or some other async operation in a pure JSContext) we can ignore exceptions reported here.
// TODO: Should we actually ignore them?
void reportException(JSC::ExecState*, JSC::JSValue) const override { }
ListenerSet listeners_;
JSC::JSGlobalObject& globalObject_;
};
}
}