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

Side by Side Diff: Source/core/inspector/InspectorDebuggerAgent.cpp

Issue 1286343003: DevTools: make InspectorDebuggerAgent aggregate V8DebuggerAgent instead of inheriting (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed dgozman's comments Created 5 years, 4 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
1 /* 1 /*
2 * Copyright (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 12 matching lines...) Expand all
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 #include "config.h" 30 #include "config.h"
31 #include "core/inspector/InspectorDebuggerAgent.h" 31 #include "core/inspector/InspectorDebuggerAgent.h"
32 32
33 #include "bindings/core/v8/V8Binding.h"
34 #include "core/inspector/ScriptAsyncCallStack.h"
35 #include "core/inspector/v8/V8Debugger.h"
36
33 namespace blink { 37 namespace blink {
34 38
35 InspectorDebuggerAgent::InspectorDebuggerAgent(InjectedScriptManager* injectedSc riptManager, V8Debugger* debugger, int contextGroupId) 39 InspectorDebuggerAgent::InspectorDebuggerAgent(InjectedScriptManager* injectedSc riptManager, V8Debugger* debugger, int contextGroupId)
36 : V8DebuggerAgent(injectedScriptManager, debugger, this, contextGroupId) 40 : InspectorBaseAgent<InspectorDebuggerAgent, InspectorFrontend::Debugger>("D ebugger")
41 , m_v8DebuggerAgent(adoptPtr(new V8DebuggerAgent(injectedScriptManager, debu gger, this, contextGroupId)))
37 { 42 {
38 } 43 }
39 44
40 InspectorDebuggerAgent::~InspectorDebuggerAgent() 45 InspectorDebuggerAgent::~InspectorDebuggerAgent()
41 { 46 {
42 #if !ENABLE(OILPAN) 47 #if !ENABLE(OILPAN)
43 ASSERT(!m_instrumentingAgents->inspectorDebuggerAgent()); 48 ASSERT(!m_instrumentingAgents->inspectorDebuggerAgent());
44 #endif 49 #endif
45 } 50 }
46 51
52 // Protocol implementation.
47 void InspectorDebuggerAgent::enable(ErrorString* errorString) 53 void InspectorDebuggerAgent::enable(ErrorString* errorString)
48 { 54 {
49 V8DebuggerAgent::enable(errorString); 55 m_v8DebuggerAgent->enable(errorString);
50 } 56 }
51 57
58 void InspectorDebuggerAgent::disable(ErrorString* errorString)
59 {
60 m_v8DebuggerAgent->disable(errorString);
61 }
62
63 void InspectorDebuggerAgent::setBreakpointsActive(ErrorString* errorString, bool inActive)
64 {
65 m_v8DebuggerAgent->setBreakpointsActive(errorString, inActive);
66 }
67
68 void InspectorDebuggerAgent::setSkipAllPauses(ErrorString* errorString, bool inS kipped)
69 {
70 m_v8DebuggerAgent->setSkipAllPauses(errorString, inSkipped);
71 }
72
73 void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int in LineNumber, const String* inUrl, const String* inUrlRegex, const int* inColumnNu mber, const String* inCondition, TypeBuilder::Debugger::BreakpointId* outBreakpo intId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Location>>& outLocations )
74 {
75 m_v8DebuggerAgent->setBreakpointByUrl(errorString, inLineNumber, inUrl, inUr lRegex, inColumnNumber, inCondition, outBreakpointId, outLocations);
76 }
77
78 void InspectorDebuggerAgent::setBreakpoint(ErrorString* errorString, const RefPt r<JSONObject>& inLocation, const String* inCondition, TypeBuilder::Debugger::Bre akpointId* outBreakpointId, RefPtr<TypeBuilder::Debugger::Location>& outActualLo cation)
79 {
80 m_v8DebuggerAgent->setBreakpoint(errorString, inLocation, inCondition, outBr eakpointId, outActualLocation);
81 }
82
83 void InspectorDebuggerAgent::removeBreakpoint(ErrorString* errorString, const St ring& inBreakpointId)
84 {
85 m_v8DebuggerAgent->removeBreakpoint(errorString, inBreakpointId);
86 }
87
88 void InspectorDebuggerAgent::continueToLocation(ErrorString* errorString, const RefPtr<JSONObject>& inLocation, const bool* inInterstatementLocation)
89 {
90 m_v8DebuggerAgent->continueToLocation(errorString, inLocation, inInterstatem entLocation);
91 }
92
93 void InspectorDebuggerAgent::stepOver(ErrorString* errorString)
94 {
95 m_v8DebuggerAgent->stepOver(errorString);
96 }
97
98 void InspectorDebuggerAgent::stepInto(ErrorString* errorString)
99 {
100 m_v8DebuggerAgent->stepInto(errorString);
101 }
102
103 void InspectorDebuggerAgent::stepOut(ErrorString* errorString)
104 {
105 m_v8DebuggerAgent->stepOut(errorString);
106 }
107
108 void InspectorDebuggerAgent::pause(ErrorString* errorString)
109 {
110 m_v8DebuggerAgent->pause(errorString);
111 }
112
113 void InspectorDebuggerAgent::resume(ErrorString* errorString)
114 {
115 m_v8DebuggerAgent->resume(errorString);
116 }
117
118 void InspectorDebuggerAgent::stepIntoAsync(ErrorString* errorString)
119 {
120 m_v8DebuggerAgent->stepIntoAsync(errorString);
121 }
122
123 void InspectorDebuggerAgent::searchInContent(ErrorString* errorString, const Str ing& inScriptId, const String& inQuery, const bool* inCaseSensitive, const bool* inIsRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::SearchMatch>>& outR esult)
124 {
125 m_v8DebuggerAgent->searchInContent(errorString, inScriptId, inQuery, inCaseS ensitive, inIsRegex, outResult);
126 }
127
128 void InspectorDebuggerAgent::canSetScriptSource(ErrorString* errorString, bool* outResult)
129 {
130 m_v8DebuggerAgent->canSetScriptSource(errorString, outResult);
131 }
132
133 void InspectorDebuggerAgent::setScriptSource(ErrorString* errorString, RefPtr<Ty peBuilder::Debugger::SetScriptSourceError>& errorData, const String& inScriptId, const String& inScriptSource, const bool* inPreview, RefPtr<TypeBuilder::Array< TypeBuilder::Debugger::CallFrame>>& optOutCallFrames, TypeBuilder::OptOutput<boo l>* optOutStackChanged, RefPtr<TypeBuilder::Debugger::StackTrace>& optOutAsyncSt ackTrace)
134 {
135 m_v8DebuggerAgent->setScriptSource(errorString, errorData, inScriptId, inScr iptSource, inPreview, optOutCallFrames, optOutStackChanged, optOutAsyncStackTrac e);
136 }
137
138 void InspectorDebuggerAgent::restartFrame(ErrorString* errorString, const String & inCallFrameId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame>>& o utCallFrames, RefPtr<TypeBuilder::Debugger::StackTrace>& optOutAsyncStackTrace)
139 {
140 m_v8DebuggerAgent->restartFrame(errorString, inCallFrameId, outCallFrames, o ptOutAsyncStackTrace);
141 }
142
143 void InspectorDebuggerAgent::getScriptSource(ErrorString* errorString, const Str ing& inScriptId, String* outScriptSource)
144 {
145 m_v8DebuggerAgent->getScriptSource(errorString, inScriptId, outScriptSource) ;
146 }
147
148 void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const String& inFunctionId, RefPtr<TypeBuilder::Debugger::FunctionDetails>& outDetails )
149 {
150 m_v8DebuggerAgent->getFunctionDetails(errorString, inFunctionId, outDetails) ;
151 }
152
153 void InspectorDebuggerAgent::getGeneratorObjectDetails(ErrorString* errorString, const String& inObjectId, RefPtr<TypeBuilder::Debugger::GeneratorObjectDetails> & outDetails)
154 {
155 m_v8DebuggerAgent->getGeneratorObjectDetails(errorString, inObjectId, outDet ails);
156 }
157
158 void InspectorDebuggerAgent::getCollectionEntries(ErrorString* errorString, cons t String& inObjectId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Collectio nEntry>>& outEntries)
159 {
160 m_v8DebuggerAgent->getCollectionEntries(errorString, inObjectId, outEntries) ;
161 }
162
163 void InspectorDebuggerAgent::setPauseOnExceptions(ErrorString* errorString, cons t String& inState)
164 {
165 m_v8DebuggerAgent->setPauseOnExceptions(errorString, inState);
166 }
167
168 void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const String& inCallFrameId, const String& inExpression, const String* inObjectGroup, const bool* inIncludeCommandLineAPI, const bool* inDoNotPauseOnExceptionsAndMut eConsole, const bool* inReturnByValue, const bool* inGeneratePreview, RefPtr<Typ eBuilder::Runtime::RemoteObject>& outResult, TypeBuilder::OptOutput<bool>* optOu tWasThrown, RefPtr<TypeBuilder::Debugger::ExceptionDetails>& optOutExceptionDeta ils)
169 {
170 m_v8DebuggerAgent->evaluateOnCallFrame(errorString, inCallFrameId, inExpress ion, inObjectGroup, inIncludeCommandLineAPI, inDoNotPauseOnExceptionsAndMuteCons ole, inReturnByValue, inGeneratePreview, outResult, optOutWasThrown, optOutExcep tionDetails);
171 }
172
173 void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const Strin g& inExpression, const String& inSourceURL, bool inPersistScript, const int* inE xecutionContextId, TypeBuilder::OptOutput<TypeBuilder::Debugger::ScriptId>* optO utScriptId, RefPtr<TypeBuilder::Debugger::ExceptionDetails>& optOutExceptionDeta ils)
174 {
175 m_v8DebuggerAgent->compileScript(errorString, inExpression, inSourceURL, inP ersistScript, inExecutionContextId, optOutScriptId, optOutExceptionDetails);
176 }
177
178 void InspectorDebuggerAgent::runScript(ErrorString* errorString, const String& i nScriptId, const int* inExecutionContextId, const String* inObjectGroup, const b ool* inDoNotPauseOnExceptionsAndMuteConsole, RefPtr<TypeBuilder::Runtime::Remote Object>& outResult, RefPtr<TypeBuilder::Debugger::ExceptionDetails>& optOutExcep tionDetails)
179 {
180 m_v8DebuggerAgent->runScript(errorString, inScriptId, inExecutionContextId, inObjectGroup, inDoNotPauseOnExceptionsAndMuteConsole, outResult, optOutExceptio nDetails);
181 }
182
183 void InspectorDebuggerAgent::setVariableValue(ErrorString* errorString, int inSc opeNumber, const String& inVariableName, const RefPtr<JSONObject>& inNewValue, c onst String* inCallFrameId, const String* inFunctionObjectId)
184 {
185 m_v8DebuggerAgent->setVariableValue(errorString, inScopeNumber, inVariableNa me, inNewValue, inCallFrameId, inFunctionObjectId);
186 }
187
188 void InspectorDebuggerAgent::getStepInPositions(ErrorString* errorString, const String& inCallFrameId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Location >>& optOutStepInPositions)
189 {
190 m_v8DebuggerAgent->getStepInPositions(errorString, inCallFrameId, optOutStep InPositions);
191 }
192
193 void InspectorDebuggerAgent::getBacktrace(ErrorString* errorString, RefPtr<TypeB uilder::Array<TypeBuilder::Debugger::CallFrame>>& outCallFrames, RefPtr<TypeBuil der::Debugger::StackTrace>& optOutAsyncStackTrace)
194 {
195 m_v8DebuggerAgent->getBacktrace(errorString, outCallFrames, optOutAsyncStack Trace);
196 }
197
198 void InspectorDebuggerAgent::skipStackFrames(ErrorString* errorString, const Str ing* inScript, const bool* inSkipContentScripts)
199 {
200 m_v8DebuggerAgent->skipStackFrames(errorString, inScript, inSkipContentScrip ts);
201 }
202
203 void InspectorDebuggerAgent::setAsyncCallStackDepth(ErrorString* errorString, in t inMaxDepth)
204 {
205 m_v8DebuggerAgent->setAsyncCallStackDepth(errorString, inMaxDepth);
206 }
207
208 void InspectorDebuggerAgent::enablePromiseTracker(ErrorString* errorString, cons t bool* inCaptureStacks)
209 {
210 m_v8DebuggerAgent->enablePromiseTracker(errorString, inCaptureStacks);
211 }
212
213 void InspectorDebuggerAgent::disablePromiseTracker(ErrorString* errorString)
214 {
215 m_v8DebuggerAgent->disablePromiseTracker(errorString);
216 }
217
218 void InspectorDebuggerAgent::getPromiseById(ErrorString* errorString, int inProm iseId, const String* inObjectGroup, RefPtr<TypeBuilder::Runtime::RemoteObject>& outPromise)
219 {
220 m_v8DebuggerAgent->getPromiseById(errorString, inPromiseId, inObjectGroup, o utPromise);
221 }
222
223 void InspectorDebuggerAgent::flushAsyncOperationEvents(ErrorString* errorString)
224 {
225 m_v8DebuggerAgent->flushAsyncOperationEvents(errorString);
226 }
227
228 void InspectorDebuggerAgent::setAsyncOperationBreakpoint(ErrorString* errorStrin g, int inOperationId)
229 {
230 m_v8DebuggerAgent->setAsyncOperationBreakpoint(errorString, inOperationId);
231 }
232
233 void InspectorDebuggerAgent::removeAsyncOperationBreakpoint(ErrorString* errorSt ring, int inOperationId)
234 {
235 m_v8DebuggerAgent->removeAsyncOperationBreakpoint(errorString, inOperationId );
236 }
237
238 // V8DebuggerAgent::Client implementation.
52 void InspectorDebuggerAgent::debuggerAgentEnabled() 239 void InspectorDebuggerAgent::debuggerAgentEnabled()
53 { 240 {
54 m_instrumentingAgents->setInspectorDebuggerAgent(this); 241 m_instrumentingAgents->setInspectorDebuggerAgent(this);
55 } 242 }
56 243
57 void InspectorDebuggerAgent::debuggerAgentDisabled() 244 void InspectorDebuggerAgent::debuggerAgentDisabled()
58 { 245 {
59 m_instrumentingAgents->setInspectorDebuggerAgent(nullptr); 246 m_instrumentingAgents->setInspectorDebuggerAgent(nullptr);
60 } 247 }
61 248
249 bool InspectorDebuggerAgent::isPaused()
250 {
251 return m_v8DebuggerAgent->isPaused();
252 }
253
254 PassRefPtrWillBeRawPtr<ScriptAsyncCallStack> InspectorDebuggerAgent::currentAsyn cStackTraceForConsole()
255 {
256 return m_v8DebuggerAgent->currentAsyncStackTraceForConsole();
257 }
258
259 void InspectorDebuggerAgent::didFireTimer()
260 {
261 m_v8DebuggerAgent->cancelPauseOnNextStatement();
262 }
263
264 void InspectorDebuggerAgent::didHandleEvent()
265 {
266 m_v8DebuggerAgent->cancelPauseOnNextStatement();
267 }
268
269 void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directive Text)
270 {
271 if (m_v8DebuggerAgent->debugger().pauseOnExceptionsState() == V8Debugger::Do ntPauseOnExceptions)
272 return;
273 RefPtr<JSONObject> directive = JSONObject::create();
274 directive->setString("directiveText", directiveText);
275 m_v8DebuggerAgent->breakProgram(InspectorFrontend::Debugger::Reason::CSPViol ation, directive.release());
276 }
277
278 void InspectorDebuggerAgent::willCallFunction(const DevToolsFunctionInfo& info)
279 {
280 m_v8DebuggerAgent->willCallFunction(info.scriptId());
281 }
282
283 void InspectorDebuggerAgent::didCallFunction()
284 {
285 m_v8DebuggerAgent->didCallFunction();
286 }
287
288 void InspectorDebuggerAgent::willEvaluateScript()
289 {
290 m_v8DebuggerAgent->willEvaluateScript();
291 }
292
293 void InspectorDebuggerAgent::didEvaluateScript()
294 {
295 m_v8DebuggerAgent->didEvaluateScript();
296 }
297
298 // InspectorBaseAgent overrides.
299 void InspectorDebuggerAgent::init()
300 {
301 m_v8DebuggerAgent->setInspectorState(m_state);
302 }
303
304 void InspectorDebuggerAgent::setFrontend(InspectorFrontend* frontend)
305 {
306 m_v8DebuggerAgent->setFrontend(InspectorFrontend::Debugger::from(frontend));
307 }
308
309 void InspectorDebuggerAgent::clearFrontend()
310 {
311 m_v8DebuggerAgent->clearFrontend();
312 }
313
314 void InspectorDebuggerAgent::restore()
315 {
316 m_v8DebuggerAgent->restore();
317 }
318
62 } // namespace blink 319 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorDebuggerAgent.h ('k') | Source/core/inspector/InspectorInstrumentation.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698