WorkerInspectorController.h [plain text]
#pragma once
#include "WorkerScriptDebugServer.h"
#include <inspector/InspectorAgentRegistry.h>
#include <inspector/InspectorEnvironment.h>
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <wtf/Stopwatch.h>
namespace Inspector {
class FrontendChannel;
class FrontendRouter;
};
namespace WebCore {
class InstrumentingAgents;
class WebInjectedScriptManager;
class WorkerGlobalScope;
struct WorkerAgentContext;
class WorkerInspectorController final : public Inspector::InspectorEnvironment {
WTF_MAKE_NONCOPYABLE(WorkerInspectorController);
WTF_MAKE_FAST_ALLOCATED;
public:
explicit WorkerInspectorController(WorkerGlobalScope&);
virtual ~WorkerInspectorController();
void workerTerminating();
void connectFrontend();
void disconnectFrontend(Inspector::DisconnectReason);
void dispatchMessageFromFrontend(const String&);
bool developerExtrasEnabled() const override { return true; }
bool canAccessInspectedScriptState(JSC::ExecState*) const override { return true; }
Inspector::InspectorFunctionCallHandler functionCallHandler() const override;
Inspector::InspectorEvaluateHandler evaluateHandler() const override;
void frontendInitialized() override { }
Ref<WTF::Stopwatch> executionStopwatch() override { return m_executionStopwatch.copyRef(); }
WorkerScriptDebugServer& scriptDebugServer() override { return m_scriptDebugServer; }
JSC::VM& vm() override;
private:
friend class InspectorInstrumentation;
WorkerAgentContext workerAgentContext();
void createLazyAgents();
Ref<InstrumentingAgents> m_instrumentingAgents;
std::unique_ptr<WebInjectedScriptManager> m_injectedScriptManager;
Ref<Inspector::FrontendRouter> m_frontendRouter;
Ref<Inspector::BackendDispatcher> m_backendDispatcher;
Ref<WTF::Stopwatch> m_executionStopwatch;
WorkerScriptDebugServer m_scriptDebugServer;
Inspector::AgentRegistry m_agents;
WorkerGlobalScope& m_workerGlobalScope;
std::unique_ptr<Inspector::FrontendChannel> m_forwardingChannel;
bool m_didCreateLazyAgents { false };
};
}