InspectorAuditAgent.h [plain text]
#pragma once
#include "InspectorAgentBase.h"
#include "InspectorBackendDispatchers.h"
#include "JSCInlines.h"
#include <wtf/FastMalloc.h>
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
namespace Inspector {
class InjectedScript;
class InjectedScriptManager;
class ScriptDebugServer;
typedef String ErrorString;
class JS_EXPORT_PRIVATE InspectorAuditAgent : public InspectorAgentBase, public AuditBackendDispatcherHandler {
WTF_MAKE_NONCOPYABLE(InspectorAuditAgent);
WTF_MAKE_FAST_ALLOCATED;
public:
~InspectorAuditAgent() override;
void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) final;
void willDestroyFrontendAndBackend(DisconnectReason) final;
void setup(ErrorString&, const int* executionContextId) final;
void run(ErrorString&, const String& test, const int* executionContextId, RefPtr<Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown) final;
void teardown(ErrorString&) final;
bool hasActiveAudit() const;
protected:
InspectorAuditAgent(AgentContext&);
InjectedScriptManager& injectedScriptManager() { return m_injectedScriptManager; }
virtual InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) = 0;
virtual void populateAuditObject(JSC::JSGlobalObject*, JSC::Strong<JSC::JSObject>& auditObject);
virtual void muteConsole() { };
virtual void unmuteConsole() { };
private:
RefPtr<AuditBackendDispatcher> m_backendDispatcher;
InjectedScriptManager& m_injectedScriptManager;
ScriptDebugServer& m_scriptDebugServer;
JSC::Strong<JSC::JSObject> m_injectedWebInspectorAuditValue;
};
}