InspectorDOMDebuggerAgent.h [plain text]
#pragma once
#include "InspectorWebAgentBase.h"
#include <inspector/InspectorBackendDispatchers.h>
#include <inspector/agents/InspectorDebuggerAgent.h>
#include <wtf/HashMap.h>
#include <wtf/text/WTFString.h>
namespace Inspector {
class InspectorObject;
}
namespace WebCore {
class Element;
class InspectorDOMAgent;
class Node;
typedef String ErrorString;
class InspectorDOMDebuggerAgent final : public InspectorAgentBase, public Inspector::InspectorDebuggerAgent::Listener, public Inspector::DOMDebuggerBackendDispatcherHandler {
WTF_MAKE_NONCOPYABLE(InspectorDOMDebuggerAgent);
WTF_MAKE_FAST_ALLOCATED;
public:
InspectorDOMDebuggerAgent(WebAgentContext&, InspectorDOMAgent*, Inspector::InspectorDebuggerAgent*);
virtual ~InspectorDOMDebuggerAgent();
void setXHRBreakpoint(ErrorString&, const String& url, const bool* const optionalIsRegex) override;
void removeXHRBreakpoint(ErrorString&, const String& url) override;
void setEventListenerBreakpoint(ErrorString&, const String& eventName) override;
void removeEventListenerBreakpoint(ErrorString&, const String& eventName) override;
void setInstrumentationBreakpoint(ErrorString&, const String& eventName) override;
void removeInstrumentationBreakpoint(ErrorString&, const String& eventName) override;
void setDOMBreakpoint(ErrorString&, int nodeId, const String& type) override;
void removeDOMBreakpoint(ErrorString&, int nodeId, const String& type) override;
void willInsertDOMNode(Node& parent);
void didInvalidateStyleAttr(Node&);
void didInsertDOMNode(Node&);
void willRemoveDOMNode(Node&);
void didRemoveDOMNode(Node&);
void willModifyDOMAttr(Element&);
void willSendXMLHttpRequest(const String& url);
void pauseOnNativeEventIfNeeded(bool isDOMEvent, const String& eventName, bool synchronous);
void mainFrameDOMContentLoaded();
void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
void discardAgent() override;
private:
void debuggerWasEnabled() override;
void debuggerWasDisabled() override;
void disable();
void descriptionForDOMEvent(Node& target, int breakpointType, bool insertion, Inspector::InspectorObject& description);
void updateSubtreeBreakpoints(Node*, uint32_t rootMask, bool set);
bool hasBreakpoint(Node*, int type);
void discardBindings();
void setBreakpoint(ErrorString&, const String& eventName);
void removeBreakpoint(ErrorString&, const String& eventName);
RefPtr<Inspector::DOMDebuggerBackendDispatcher> m_backendDispatcher;
InspectorDOMAgent* m_domAgent { nullptr };
Inspector::InspectorDebuggerAgent* m_debuggerAgent { nullptr };
HashMap<Node*, uint32_t> m_domBreakpoints;
HashSet<String> m_eventListenerBreakpoints;
enum class XHRBreakpointType { Text, RegularExpression };
HashMap<String, XHRBreakpointType> m_xhrBreakpoints;
bool m_pauseOnAllXHRsEnabled { false };
};
}