Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Side by Side Diff: sky/engine/v8_inspector/InspectorDebuggerAgent.h

Issue 922053002: Remove unused V8 integration code in Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010-2011 Google Inc. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15 * its contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 #ifndef SKY_ENGINE_V8_INSPECTOR_INSPECTORDEBUGGERAGENT_H_
31 #define SKY_ENGINE_V8_INSPECTOR_INSPECTORDEBUGGERAGENT_H_
32
33 #include "gen/v8_inspector/InspectorFrontend.h"
34 #include "sky/engine/bindings/core/v8/ScriptState.h"
35 #include "sky/engine/core/frame/ConsoleTypes.h"
36 #include "sky/engine/core/inspector/ConsoleAPITypes.h"
37 #include "sky/engine/v8_inspector/AsyncCallStackTracker.h"
38 #include "sky/engine/v8_inspector/InjectedScript.h"
39 #include "sky/engine/v8_inspector/InspectorBaseAgent.h"
40 #include "sky/engine/v8_inspector/PromiseTracker.h"
41 #include "sky/engine/v8_inspector/ScriptBreakpoint.h"
42 #include "sky/engine/v8_inspector/ScriptDebugListener.h"
43 #include "sky/engine/wtf/Forward.h"
44 #include "sky/engine/wtf/HashMap.h"
45 #include "sky/engine/wtf/PassRefPtr.h"
46 #include "sky/engine/wtf/Vector.h"
47 #include "sky/engine/wtf/text/StringHash.h"
48
49 namespace blink {
50
51 class ConsoleMessage;
52 class Document;
53 class Event;
54 class EventListener;
55 class EventTarget;
56 class FormData;
57 class HTTPHeaderMap;
58 class InjectedScriptManager;
59 class InspectorFrontend;
60 class InstrumentingAgents;
61 class JavaScriptCallFrame;
62 class JSONObject;
63 class KURL;
64 class MutationObserver;
65 class ScriptArguments;
66 class ScriptAsyncCallStack;
67 class ScriptCallStack;
68 class ScriptDebugServer;
69 class ScriptRegexp;
70 class ScriptSourceCode;
71 class ScriptValue;
72 class ThreadableLoaderClient;
73 class XMLHttpRequest;
74
75 typedef String ErrorString;
76
77 class InspectorDebuggerAgent : public InspectorBaseAgent<InspectorDebuggerAgent> , public ScriptDebugListener, public InspectorBackendDispatcher::DebuggerCommand Handler {
78 WTF_MAKE_NONCOPYABLE(InspectorDebuggerAgent);
79 WTF_MAKE_FAST_ALLOCATED;
80 public:
81 enum BreakpointSource {
82 UserBreakpointSource,
83 DebugCommandBreakpointSource,
84 MonitorCommandBreakpointSource
85 };
86
87 static const char backtraceObjectGroup[];
88
89 virtual ~InspectorDebuggerAgent();
90
91 virtual void canSetScriptSource(ErrorString*, bool* result) override final { *result = true; }
92
93 virtual void virtualInit() override final;
94 virtual void setFrontend(InspectorFrontend*) override final;
95 virtual void clearFrontend() override final;
96 virtual void restore() override final;
97
98 bool isPaused();
99 bool runningNestedMessageLoop();
100 void addMessageToConsole(ConsoleMessage*);
101
102 // Part of the protocol.
103 virtual void enable(ErrorString*) override final;
104 virtual void disable(ErrorString*) override final;
105 virtual void setBreakpointsActive(ErrorString*, bool active) override final;
106 virtual void setSkipAllPauses(ErrorString*, bool skipped, const bool* untilR eload) override final;
107
108 virtual void setBreakpointByUrl(ErrorString*, int lineNumber, const String* optionalURL, const String* optionalURLRegex, const int* optionalColumnNumber, co nst String* optionalCondition, const bool* isAntiBreakpoint, TypeBuilder::Debugg er::BreakpointId*, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Location> >& locations) override final;
109 virtual void setBreakpoint(ErrorString*, const RefPtr<JSONObject>& location, const String* optionalCondition, TypeBuilder::Debugger::BreakpointId*, RefPtr<T ypeBuilder::Debugger::Location>& actualLocation) override final;
110 virtual void removeBreakpoint(ErrorString*, const String& breakpointId) over ride final;
111 virtual void continueToLocation(ErrorString*, const RefPtr<JSONObject>& loca tion, const bool* interstateLocationOpt) override final;
112 virtual void getStepInPositions(ErrorString*, const String& callFrameId, Ref Ptr<TypeBuilder::Array<TypeBuilder::Debugger::Location> >& positions) override f inal;
113 virtual void getBacktrace(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilde r::Debugger::CallFrame> >&, RefPtr<TypeBuilder::Debugger::StackTrace>&) override final;
114
115 virtual void searchInContent(ErrorString*, const String& scriptId, const Str ing& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefP tr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> >&) override final;
116 virtual void setScriptSource(ErrorString*, RefPtr<TypeBuilder::Debugger::Set ScriptSourceError>&, const String& scriptId, const String& newContent, const boo l* preview, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> >& newCa llFrames, RefPtr<JSONObject>& result, RefPtr<TypeBuilder::Debugger::StackTrace>& asyncStackTrace) override final;
117 virtual void restartFrame(ErrorString*, const String& callFrameId, RefPtr<Ty peBuilder::Array<TypeBuilder::Debugger::CallFrame> >& newCallFrames, RefPtr<JSON Object>& result, RefPtr<TypeBuilder::Debugger::StackTrace>& asyncStackTrace) ove rride final;
118 virtual void getScriptSource(ErrorString*, const String& scriptId, String* s criptSource) override final;
119 virtual void getFunctionDetails(ErrorString*, const String& functionId, RefP tr<TypeBuilder::Debugger::FunctionDetails>&) override final;
120 virtual void getCollectionEntries(ErrorString*, const String& objectId, RefP tr<TypeBuilder::Array<TypeBuilder::Debugger::CollectionEntry> >&) override final ;
121 virtual void pause(ErrorString*) override final;
122 virtual void resume(ErrorString*) override final;
123 virtual void stepOver(ErrorString*) override final;
124 virtual void stepInto(ErrorString*) override final;
125 virtual void stepOut(ErrorString*) override final;
126 virtual void setPauseOnExceptions(ErrorString*, const String& pauseState) ov erride final;
127 virtual void evaluateOnCallFrame(ErrorString*,
128 const String& callFrameId,
129 const String& expression,
130 const String* objectGroup,
131 const bool* includeCommandLineAPI,
132 const bool* doNotPauseOnExceptionsAndMuteConsole,
133 const bool* returnByValue,
134 const bool* generatePreview,
135 RefPtr<TypeBuilder::Runtime::RemoteObject>& result,
136 TypeBuilder::OptOutput<bool>* wasThrown,
137 RefPtr<TypeBuilder::Debugger::ExceptionDetails>&) override final;
138 virtual void compileScript(ErrorString*, const String& expression, const Str ing& sourceURL, const int* executionContextId, TypeBuilder::OptOutput<TypeBuilde r::Debugger::ScriptId>*, RefPtr<TypeBuilder::Debugger::ExceptionDetails>&) overr ide;
139 virtual void runScript(ErrorString*, const TypeBuilder::Debugger::ScriptId&, const int* executionContextId, const String* objectGroup, const bool* doNotPaus eOnExceptionsAndMuteConsole, RefPtr<TypeBuilder::Runtime::RemoteObject>& result, RefPtr<TypeBuilder::Debugger::ExceptionDetails>&) override;
140 virtual void setOverlayMessage(ErrorString*, const String*) override;
141 virtual void setVariableValue(ErrorString*, int in_scopeNumber, const String & in_variableName, const RefPtr<JSONObject>& in_newValue, const String* in_callF rame, const String* in_functionObjectId) override final;
142 virtual void skipStackFrames(ErrorString*, const String* pattern) override f inal;
143 virtual void setAsyncCallStackDepth(ErrorString*, int depth) override final;
144
145 void schedulePauseOnNextStatement(InspectorFrontend::Debugger::Reason::Enum breakReason, PassRefPtr<JSONObject> data);
146 void didInstallTimer(ExecutionContext*, int timerId, int timeout, bool singl eShot);
147 void didRemoveTimer(ExecutionContext*, int timerId);
148 bool willFireTimer(ExecutionContext*, int timerId);
149 void didFireTimer();
150 void didRequestAnimationFrame(Document*, int callbackId);
151 void didCancelAnimationFrame(Document*, int callbackId);
152 bool willFireAnimationFrame(Document*, int callbackId);
153 void didFireAnimationFrame();
154 void didEnqueueEvent(EventTarget*, Event*);
155 void didRemoveEvent(EventTarget*, Event*);
156 void willHandleEvent(EventTarget*, Event*, EventListener*, bool useCapture);
157 void didHandleEvent();
158 void didEnqueueMutationRecord(ExecutionContext*, MutationObserver*);
159 void didClearAllMutationRecords(ExecutionContext*, MutationObserver*);
160 void willDeliverMutationRecords(ExecutionContext*, MutationObserver*);
161 void didDeliverMutationRecords();
162 // void didPostExecutionContextTask(ExecutionContext*, ExecutionContextTask* );
163 // void didKillAllExecutionContextTasks(ExecutionContext*);
164 // void willPerformExecutionContextTask(ExecutionContext*, ExecutionContextT ask*);
165 // void didPerformExecutionContextTask();
166 int traceAsyncOperationStarting(ExecutionContext*, const String& operationNa me, int prevOperationId = 0);
167 void traceAsyncOperationCompleted(ExecutionContext*, int operationId);
168 void traceAsyncOperationCompletedCallbackStarting(ExecutionContext*, int ope rationId);
169 void traceAsyncCallbackStarting(ExecutionContext*, int operationId);
170 void traceAsyncCallbackCompleted();
171 bool canBreakProgram();
172 void breakProgram(InspectorFrontend::Debugger::Reason::Enum breakReason, Pas sRefPtr<JSONObject> data);
173 void scriptExecutionBlockedByCSP(const String& directiveText);
174
175 class Listener {
176 public:
177 virtual ~Listener() { }
178 virtual void debuggerWasEnabled() = 0;
179 virtual void debuggerWasDisabled() = 0;
180 virtual void stepInto() = 0;
181 virtual void didPause() = 0;
182 };
183 void setListener(Listener* listener) { m_listener = listener; }
184
185 bool enabled();
186
187 virtual ScriptDebugServer& scriptDebugServer() = 0;
188
189 void setBreakpoint(const String& scriptId, int lineNumber, int columnNumber, BreakpointSource, const String& condition = String());
190 void removeBreakpoint(const String& scriptId, int lineNumber, int columnNumb er, BreakpointSource);
191
192 protected:
193 explicit InspectorDebuggerAgent(InjectedScriptManager*);
194
195 virtual void startListeningScriptDebugServer() = 0;
196 virtual void stopListeningScriptDebugServer() = 0;
197 virtual void muteConsole() = 0;
198 virtual void unmuteConsole() = 0;
199 InjectedScriptManager* injectedScriptManager() { return m_injectedScriptMana ger; }
200 virtual InjectedScript injectedScriptForEval(ErrorString*, const int* execut ionContextId) = 0;
201
202 virtual void enable();
203 virtual void disable();
204 virtual SkipPauseRequest didPause(ScriptState*, const ScriptValue& callFrame s, const ScriptValue& exception, const Vector<String>& hitBreakpoints) override final;
205 virtual void didContinue() override final;
206 void reset();
207 void pageDidCommitLoad();
208
209 private:
210 bool shouldSkipInspectorInternals();
211 SkipPauseRequest shouldSkipExceptionPause();
212 SkipPauseRequest shouldSkipStepPause();
213 bool isTopCallFrameInFramework();
214
215 void cancelPauseOnNextStatement();
216 void addMessageToConsole(MessageSource, MessageType);
217
218 PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> > currentCal lFrames();
219 PassRefPtr<TypeBuilder::Debugger::StackTrace> currentAsyncStackTrace();
220
221 virtual void didParseSource(const String& scriptId, const Script&, CompileRe sult) override final;
222 virtual void didReceiveV8AsyncTaskEvent(ExecutionContext*, const String& eve ntType, const String& eventName, int id) override final;
223 virtual void didReceiveV8PromiseEvent(ScriptState*, v8::Handle<v8::Object> p romise, v8::Handle<v8::Value> parentPromise, int status) override final;
224
225 void setPauseOnExceptionsImpl(ErrorString*, int);
226
227 PassRefPtr<TypeBuilder::Debugger::Location> resolveBreakpoint(const String& breakpointId, const String& scriptId, const ScriptBreakpoint&, BreakpointSource) ;
228 void removeBreakpoint(const String& breakpointId);
229 void clear();
230 bool assertPaused(ErrorString*);
231 void clearBreakDetails();
232
233 String sourceMapURLForScript(const Script&, CompileResult);
234
235 PassRefPtr<JavaScriptCallFrame> topCallFrameSkipUnknownSources();
236 String scriptURL(JavaScriptCallFrame*);
237 AsyncCallStackTracker& asyncCallStackTracker() { return *m_asyncCallStackTra cker; };
238
239 typedef HashMap<String, Script> ScriptsMap;
240 typedef HashMap<String, Vector<String> > BreakpointIdToDebugServerBreakpoint IdsMap;
241 typedef HashMap<String, std::pair<String, BreakpointSource> > DebugServerBre akpointToBreakpointIdAndSourceMap;
242
243 RawPtr<InjectedScriptManager> m_injectedScriptManager;
244 InspectorFrontend::Debugger* m_frontend;
245 RefPtr<ScriptState> m_pausedScriptState;
246 ScriptValue m_currentCallStack;
247 ScriptsMap m_scripts;
248 BreakpointIdToDebugServerBreakpointIdsMap m_breakpointIdToDebugServerBreakpo intIds;
249 DebugServerBreakpointToBreakpointIdAndSourceMap m_serverBreakpoints;
250 String m_continueToLocationBreakpointId;
251 InspectorFrontend::Debugger::Reason::Enum m_breakReason;
252 RefPtr<JSONObject> m_breakAuxData;
253 bool m_javaScriptPauseScheduled;
254 bool m_debuggerStepScheduled;
255 bool m_steppingFromFramework;
256 bool m_pausingOnNativeEvent;
257 RawPtr<Listener> m_listener;
258
259 int m_skippedStepInCount;
260 int m_minFrameCountForSkip;
261 bool m_skipAllPauses;
262 OwnPtr<ScriptRegexp> m_cachedSkipStackRegExp;
263 OwnPtr<AsyncCallStackTracker> m_asyncCallStackTracker;
264 PromiseTracker m_promiseTracker;
265 };
266
267 } // namespace blink
268
269
270 #endif // SKY_ENGINE_V8_INSPECTOR_INSPECTORDEBUGGERAGENT_H_
OLDNEW
« no previous file with comments | « sky/engine/v8_inspector/InspectorBaseAgent.cpp ('k') | sky/engine/v8_inspector/InspectorDebuggerAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698