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

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: Fixed presubmit errors 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_debuggerAgent(adoptPtr(new V8DebuggerAgent(injectedScriptManager, debugg er, 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_debuggerAgent->enable(errorString);
dgozman 2015/08/15 01:05:56 Looks strange to have |m_debuggerAgent| in Debugge
yurys 2015/08/17 17:15:06 Done.
50 } 56 }
51 57
58 void InspectorDebuggerAgent::disable(ErrorString* errorString)
59 {
60 m_debuggerAgent->disable(errorString);
61 }
62
63 void InspectorDebuggerAgent::setBreakpointsActive(ErrorString* errorString, bool inActive)
64 {
65 m_debuggerAgent->setBreakpointsActive(errorString, inActive);
66 }
67
68 void InspectorDebuggerAgent::setSkipAllPauses(ErrorString* errorString, bool inS kipped)
69 {
70 m_debuggerAgent->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_debuggerAgent->setBreakpointByUrl(errorString, inLineNumber, inUrl, inUrlR egex, 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_debuggerAgent->setBreakpoint(errorString, inLocation, inCondition, outBrea kpointId, outActualLocation);
81 }
82
83 void InspectorDebuggerAgent::removeBreakpoint(ErrorString* errorString, const St ring& inBreakpointId)
84 {
85 m_debuggerAgent->removeBreakpoint(errorString, inBreakpointId);
86 }
87
88 void InspectorDebuggerAgent::continueToLocation(ErrorString* errorString, const RefPtr<JSONObject>& inLocation, const bool* inInterstatementLocation)
89 {
90 m_debuggerAgent->continueToLocation(errorString, inLocation, inInterstatemen tLocation);
91 }
92
93 void InspectorDebuggerAgent::stepOver(ErrorString* errorString)
94 {
95 m_debuggerAgent->stepOver(errorString);
96 }
97
98 void InspectorDebuggerAgent::stepInto(ErrorString* errorString)
99 {
100 m_debuggerAgent->stepInto(errorString);
101 }
102
103 void InspectorDebuggerAgent::stepOut(ErrorString* errorString)
104 {
105 m_debuggerAgent->stepOut(errorString);
106 }
107
108 void InspectorDebuggerAgent::pause(ErrorString* errorString)
109 {
110 m_debuggerAgent->pause(errorString);
111 }
112
113 void InspectorDebuggerAgent::resume(ErrorString* errorString)
114 {
115 m_debuggerAgent->resume(errorString);
116 }
117
118 void InspectorDebuggerAgent::stepIntoAsync(ErrorString* errorString)
119 {
120 m_debuggerAgent->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_debuggerAgent->searchInContent(errorString, inScriptId, inQuery, inCaseSen sitive, inIsRegex, outResult);
126 }
127
128 void InspectorDebuggerAgent::canSetScriptSource(ErrorString* errorString, bool* outResult)
129 {
130 m_debuggerAgent->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_debuggerAgent->setScriptSource(errorString, errorData, inScriptId, inScrip tSource, inPreview, optOutCallFrames, optOutStackChanged, optOutAsyncStackTrace) ;
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_debuggerAgent->restartFrame(errorString, inCallFrameId, outCallFrames, opt OutAsyncStackTrace);
141 }
142
143 void InspectorDebuggerAgent::getScriptSource(ErrorString* errorString, const Str ing& inScriptId, String* outScriptSource)
144 {
145 m_debuggerAgent->getScriptSource(errorString, inScriptId, outScriptSource);
146 }
147
148 void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const String& inFunctionId, RefPtr<TypeBuilder::Debugger::FunctionDetails>& outDetails )
149 {
150 m_debuggerAgent->getFunctionDetails(errorString, inFunctionId, outDetails);
151 }
152
153 void InspectorDebuggerAgent::getGeneratorObjectDetails(ErrorString* errorString, const String& inObjectId, RefPtr<TypeBuilder::Debugger::GeneratorObjectDetails> & outDetails)
154 {
155 m_debuggerAgent->getGeneratorObjectDetails(errorString, inObjectId, outDetai ls);
156 }
157
158 void InspectorDebuggerAgent::getCollectionEntries(ErrorString* errorString, cons t String& inObjectId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Collectio nEntry>>& outEntries)
159 {
160 m_debuggerAgent->getCollectionEntries(errorString, inObjectId, outEntries);
161 }
162
163 void InspectorDebuggerAgent::setPauseOnExceptions(ErrorString* errorString, cons t String& inState)
164 {
165 m_debuggerAgent->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_debuggerAgent->evaluateOnCallFrame(errorString, inCallFrameId, inExpressio n, inObjectGroup, inIncludeCommandLineAPI, inDoNotPauseOnExceptionsAndMuteConsol e, inReturnByValue, inGeneratePreview, outResult, optOutWasThrown, optOutExcepti onDetails);
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_debuggerAgent->compileScript(errorString, inExpression, inSourceURL, inPer sistScript, 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_debuggerAgent->runScript(errorString, inScriptId, inExecutionContextId, in ObjectGroup, inDoNotPauseOnExceptionsAndMuteConsole, outResult, optOutExceptionD etails);
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_debuggerAgent->setVariableValue(errorString, inScopeNumber, inVariableName , inNewValue, inCallFrameId, inFunctionObjectId);
186 }
187
188 void InspectorDebuggerAgent::getStepInPositions(ErrorString* errorString, const String& inCallFrameId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Location >>& optOutStepInPositions)
189 {
190 m_debuggerAgent->getStepInPositions(errorString, inCallFrameId, optOutStepIn Positions);
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_debuggerAgent->getBacktrace(errorString, outCallFrames, optOutAsyncStackTr ace);
196 }
197
198 void InspectorDebuggerAgent::skipStackFrames(ErrorString* errorString, const Str ing* inScript, const bool* inSkipContentScripts)
199 {
200 m_debuggerAgent->skipStackFrames(errorString, inScript, inSkipContentScripts );
201 }
202
203 void InspectorDebuggerAgent::setAsyncCallStackDepth(ErrorString* errorString, in t inMaxDepth)
204 {
205 m_debuggerAgent->setAsyncCallStackDepth(errorString, inMaxDepth);
206 }
207
208 void InspectorDebuggerAgent::enablePromiseTracker(ErrorString* errorString, cons t bool* inCaptureStacks)
209 {
210 m_debuggerAgent->enablePromiseTracker(errorString, inCaptureStacks);
211 }
212
213 void InspectorDebuggerAgent::disablePromiseTracker(ErrorString* errorString)
214 {
215 m_debuggerAgent->disablePromiseTracker(errorString);
216 }
217
218 void InspectorDebuggerAgent::getPromiseById(ErrorString* errorString, int inProm iseId, const String* inObjectGroup, RefPtr<TypeBuilder::Runtime::RemoteObject>& outPromise)
219 {
220 m_debuggerAgent->getPromiseById(errorString, inPromiseId, inObjectGroup, out Promise);
221 }
222
223 void InspectorDebuggerAgent::flushAsyncOperationEvents(ErrorString* errorString)
224 {
225 m_debuggerAgent->flushAsyncOperationEvents(errorString);
226 }
227
228 void InspectorDebuggerAgent::setAsyncOperationBreakpoint(ErrorString* errorStrin g, int inOperationId)
229 {
230 m_debuggerAgent->setAsyncOperationBreakpoint(errorString, inOperationId);
231 }
232
233 void InspectorDebuggerAgent::removeAsyncOperationBreakpoint(ErrorString* errorSt ring, int inOperationId)
234 {
235 m_debuggerAgent->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_debuggerAgent->isPaused();
252 }
253
254 PassRefPtrWillBeRawPtr<ScriptAsyncCallStack> InspectorDebuggerAgent::currentAsyn cStackTraceForConsole()
255 {
256 return m_debuggerAgent->currentAsyncStackTraceForConsole();
257 }
258
259 void InspectorDebuggerAgent::didFireTimer()
260 {
261 m_debuggerAgent->cancelPauseOnNextStatement();
262 }
263
264 void InspectorDebuggerAgent::didHandleEvent()
265 {
266 m_debuggerAgent->cancelPauseOnNextStatement();
267 }
268
269 void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directive Text)
270 {
271 if (m_debuggerAgent->debugger().pauseOnExceptionsState() == V8Debugger::Dont PauseOnExceptions)
272 return;
273 RefPtr<JSONObject> directive = JSONObject::create();
274 directive->setString("directiveText", directiveText);
275 m_debuggerAgent->breakProgram(InspectorFrontend::Debugger::Reason::CSPViolat ion, directive.release());
276 }
277
278 void InspectorDebuggerAgent::willCallFunction(const DevToolsFunctionInfo& info)
279 {
280 m_debuggerAgent->willCallFunction(info.scriptId());
281 }
282
283 void InspectorDebuggerAgent::didCallFunction()
284 {
285 m_debuggerAgent->didCallFunction();
286 }
287
288 void InspectorDebuggerAgent::willEvaluateScript()
289 {
290 m_debuggerAgent->willEvaluateScript();
291 }
292
293 void InspectorDebuggerAgent::didEvaluateScript()
294 {
295 m_debuggerAgent->didEvaluateScript();
296 }
297
298 bool InspectorDebuggerAgent::getEditedScript(const String& url, String* content)
299 {
300 return m_debuggerAgent->getEditedScript(url, content);
301 }
302
303 // InspectorBaseAgent overrides.
304 void InspectorDebuggerAgent::init()
305 {
306 m_debuggerAgent->setInspectorState(m_state);
307 }
308
309 void InspectorDebuggerAgent::setFrontend(InspectorFrontend* frontend)
310 {
311 m_debuggerAgent->setFrontend(InspectorFrontend::Debugger::from(frontend));
312 }
313
314 void InspectorDebuggerAgent::clearFrontend()
315 {
316 m_debuggerAgent->clearFrontend();
317 }
318
319 void InspectorDebuggerAgent::restore()
320 {
321 m_debuggerAgent->restore();
322 }
323
62 } // namespace blink 324 } // 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