2 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef InspectorDOMDebuggerAgent_h
32 #define InspectorDOMDebuggerAgent_h
35 #include "core/inspector/InspectorBaseAgent.h"
36 #include "core/inspector/InspectorDebuggerAgent.h"
37 #include "wtf/HashMap.h"
38 #include "wtf/PassOwnPtr.h"
39 #include "wtf/text/WTFString.h"
47 class InspectorDOMAgent;
48 class InspectorDebuggerAgent;
49 class InspectorFrontend;
50 class InstrumentingAgents;
54 typedef String ErrorString;
56 class InspectorDOMDebuggerAgent FINAL : public InspectorBaseAgent<InspectorDOMDebuggerAgent>, public InspectorDebuggerAgent::Listener, public InspectorBackendDispatcher::DOMDebuggerCommandHandler {
57 WTF_MAKE_NONCOPYABLE(InspectorDOMDebuggerAgent);
59 static PassOwnPtr<InspectorDOMDebuggerAgent> create(InspectorDOMAgent*, InspectorDebuggerAgent*);
61 virtual ~InspectorDOMDebuggerAgent();
63 // DOMDebugger API for InspectorFrontend
64 virtual void setXHRBreakpoint(ErrorString*, const String& url) OVERRIDE;
65 virtual void removeXHRBreakpoint(ErrorString*, const String& url) OVERRIDE;
66 virtual void setEventListenerBreakpoint(ErrorString*, const String& eventName) OVERRIDE;
67 virtual void removeEventListenerBreakpoint(ErrorString*, const String& eventName) OVERRIDE;
68 virtual void setInstrumentationBreakpoint(ErrorString*, const String& eventName) OVERRIDE;
69 virtual void removeInstrumentationBreakpoint(ErrorString*, const String& eventName) OVERRIDE;
70 virtual void setDOMBreakpoint(ErrorString*, int nodeId, const String& type) OVERRIDE;
71 virtual void removeDOMBreakpoint(ErrorString*, int nodeId, const String& type) OVERRIDE;
73 // InspectorInstrumentation API
74 void willInsertDOMNode(Node* parent);
75 void didInvalidateStyleAttr(Node*);
76 void didInsertDOMNode(Node*);
77 void willRemoveDOMNode(Node*);
78 void didRemoveDOMNode(Node*);
79 void willModifyDOMAttr(Element*, const AtomicString&, const AtomicString&);
80 void willSendXMLHttpRequest(const String& url);
81 void didInstallTimer(ExecutionContext*, int timerId, int timeout, bool singleShot);
82 void didRemoveTimer(ExecutionContext*, int timerId);
83 void willFireTimer(ExecutionContext*, int timerId);
84 void didRequestAnimationFrame(Document*, int callbackId);
85 void didCancelAnimationFrame(Document*, int callbackId);
86 void willFireAnimationFrame(Document*, int callbackId);
87 void willHandleEvent(EventTarget*, const AtomicString& eventType, EventListener*, bool useCapture);
88 void didFireWebGLError(const String& errorName);
89 void didFireWebGLWarning();
90 void didFireWebGLErrorOrWarning(const String& message);
91 void willExecuteCustomElementCallback(Element*);
93 void didProcessTask();
95 virtual void clearFrontend() OVERRIDE;
96 virtual void discardAgent() OVERRIDE;
99 InspectorDOMDebuggerAgent(InspectorDOMAgent*, InspectorDebuggerAgent*);
101 void pauseOnNativeEventIfNeeded(PassRefPtr<JSONObject> eventData, bool synchronous);
102 PassRefPtr<JSONObject> preparePauseOnNativeEventData(bool isDOMEvent, const String& eventName);
104 // InspectorDebuggerAgent::Listener implementation.
105 virtual void debuggerWasEnabled() OVERRIDE;
106 virtual void debuggerWasDisabled() OVERRIDE;
107 virtual void stepInto() OVERRIDE;
108 virtual void didPause() OVERRIDE;
111 void descriptionForDOMEvent(Node* target, int breakpointType, bool insertion, JSONObject* description);
112 void updateSubtreeBreakpoints(Node*, uint32_t rootMask, bool set);
113 bool hasBreakpoint(Node*, int type);
114 void setBreakpoint(ErrorString*, const String& eventName);
115 void removeBreakpoint(ErrorString*, const String& eventName);
119 InspectorDOMAgent* m_domAgent;
120 InspectorDebuggerAgent* m_debuggerAgent;
121 HashMap<Node*, uint32_t> m_domBreakpoints;
122 bool m_pauseInNextEventListener;
125 } // namespace WebCore
128 #endif // !defined(InspectorDOMDebuggerAgent_h)