Chromium Code Reviews

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp

Issue 1936593002: [DevTools] Remove state from v8 agent wrappers, remove unnecessary classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-everything-from-agents
Patch Set: rebased Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" 5 #include "platform/v8_inspector/V8DebuggerAgentImpl.h"
6 6
7 #include "platform/inspector_protocol/String16.h" 7 #include "platform/inspector_protocol/String16.h"
8 #include "platform/inspector_protocol/Values.h" 8 #include "platform/inspector_protocol/Values.h"
9 #include "platform/v8_inspector/InjectedScript.h" 9 #include "platform/v8_inspector/InjectedScript.h"
10 #include "platform/v8_inspector/InspectedContext.h" 10 #include "platform/v8_inspector/InspectedContext.h"
(...skipping 28 matching lines...)
39 static const char v8AsyncTaskEventDidHandle[] = "didHandle"; 39 static const char v8AsyncTaskEventDidHandle[] = "didHandle";
40 } 40 }
41 41
42 namespace blink { 42 namespace blink {
43 43
44 namespace DebuggerAgentState { 44 namespace DebuggerAgentState {
45 static const char javaScriptBreakpoints[] = "javaScriptBreakopints"; 45 static const char javaScriptBreakpoints[] = "javaScriptBreakopints";
46 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState"; 46 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState";
47 static const char asyncCallStackDepth[] = "asyncCallStackDepth"; 47 static const char asyncCallStackDepth[] = "asyncCallStackDepth";
48 static const char blackboxPattern[] = "blackboxPattern"; 48 static const char blackboxPattern[] = "blackboxPattern";
49 static const char debuggerEnabled[] = "debuggerEnabled";
49 50
50 // Breakpoint properties. 51 // Breakpoint properties.
51 static const char url[] = "url"; 52 static const char url[] = "url";
52 static const char isRegex[] = "isRegex"; 53 static const char isRegex[] = "isRegex";
53 static const char lineNumber[] = "lineNumber"; 54 static const char lineNumber[] = "lineNumber";
54 static const char columnNumber[] = "columnNumber"; 55 static const char columnNumber[] = "columnNumber";
55 static const char condition[] = "condition"; 56 static const char condition[] = "condition";
56 static const char skipAllPauses[] = "skipAllPauses"; 57 static const char skipAllPauses[] = "skipAllPauses";
57 58
58 } // namespace DebuggerAgentState; 59 } // namespace DebuggerAgentState;
(...skipping 127 matching lines...)
186 return true; 187 return true;
187 *errorString = "Debugger agent is not enabled"; 188 *errorString = "Debugger agent is not enabled";
188 return false; 189 return false;
189 } 190 }
190 191
191 void V8DebuggerAgentImpl::enable() 192 void V8DebuggerAgentImpl::enable()
192 { 193 {
193 // debugger().addListener may result in reporting all parsed scripts to 194 // debugger().addListener may result in reporting all parsed scripts to
194 // the agent so it should already be in enabled state by then. 195 // the agent so it should already be in enabled state by then.
195 m_enabled = true; 196 m_enabled = true;
197 m_state->setBoolean(DebuggerAgentState::debuggerEnabled, true);
196 debugger().debuggerAgentEnabled(); 198 debugger().debuggerAgentEnabled();
197 199
198 protocol::Vector<V8DebuggerParsedScript> compiledScripts; 200 protocol::Vector<V8DebuggerParsedScript> compiledScripts;
199 debugger().getCompiledScripts(m_session->contextGroupId(), compiledScripts); 201 debugger().getCompiledScripts(m_session->contextGroupId(), compiledScripts);
200 for (size_t i = 0; i < compiledScripts.size(); i++) 202 for (size_t i = 0; i < compiledScripts.size(); i++)
201 didParseSource(compiledScripts[i]); 203 didParseSource(compiledScripts[i]);
202 204
203 // FIXME(WK44513): breakpoints activated flag should be synchronized between all front-ends 205 // FIXME(WK44513): breakpoints activated flag should be synchronized between all front-ends
204 debugger().setBreakpointsActivated(true); 206 debugger().setBreakpointsActivated(true);
205 m_session->changeInstrumentationCounter(+1); 207 m_session->changeInstrumentationCounter(+1);
(...skipping 41 matching lines...)
247 m_continueToLocationBreakpointId = String16(); 249 m_continueToLocationBreakpointId = String16();
248 clearBreakDetails(); 250 clearBreakDetails();
249 m_scheduledDebuggerStep = NoStep; 251 m_scheduledDebuggerStep = NoStep;
250 m_skipNextDebuggerStepOut = false; 252 m_skipNextDebuggerStepOut = false;
251 m_javaScriptPauseScheduled = false; 253 m_javaScriptPauseScheduled = false;
252 m_steppingFromFramework = false; 254 m_steppingFromFramework = false;
253 m_pausingOnNativeEvent = false; 255 m_pausingOnNativeEvent = false;
254 m_skippedStepFrameCount = 0; 256 m_skippedStepFrameCount = 0;
255 m_recursionLevelForStepFrame = 0; 257 m_recursionLevelForStepFrame = 0;
256 m_skipAllPauses = false; 258 m_skipAllPauses = false;
257 m_enabled = false;
258 m_blackboxPattern = nullptr; 259 m_blackboxPattern = nullptr;
259 m_state->remove(DebuggerAgentState::blackboxPattern); 260 m_state->remove(DebuggerAgentState::blackboxPattern);
261 m_enabled = false;
262 m_state->setBoolean(DebuggerAgentState::debuggerEnabled, false);
260 } 263 }
261 264
262 void V8DebuggerAgentImpl::internalSetAsyncCallStackDepth(int depth) 265 void V8DebuggerAgentImpl::internalSetAsyncCallStackDepth(int depth)
263 { 266 {
264 if (depth <= 0) { 267 if (depth <= 0) {
265 m_maxAsyncCallStackDepth = 0; 268 m_maxAsyncCallStackDepth = 0;
266 allAsyncTasksCanceled(); 269 allAsyncTasksCanceled();
267 } else { 270 } else {
268 m_maxAsyncCallStackDepth = depth; 271 m_maxAsyncCallStackDepth = depth;
269 } 272 }
270 } 273 }
271 274
272 void V8DebuggerAgentImpl::setInspectorState(protocol::DictionaryValue* state) 275 void V8DebuggerAgentImpl::setInspectorState(protocol::DictionaryValue* state)
273 { 276 {
274 m_state = state; 277 m_state = state;
275 } 278 }
276 279
277 void V8DebuggerAgentImpl::clearFrontend() 280 void V8DebuggerAgentImpl::clearFrontend()
278 { 281 {
279 ErrorString error; 282 ErrorString error;
280 disable(&error); 283 disable(&error);
281 ASSERT(m_frontend); 284 ASSERT(m_frontend);
282 m_frontend = nullptr; 285 m_frontend = nullptr;
283 } 286 }
284 287
285 void V8DebuggerAgentImpl::restore() 288 void V8DebuggerAgentImpl::restore()
286 { 289 {
287 ASSERT(!m_enabled); 290 ASSERT(!m_enabled);
291 if (!m_state->booleanProperty(DebuggerAgentState::debuggerEnabled, false))
292 return;
288 if (!m_session->client()->canExecuteScripts()) 293 if (!m_session->client()->canExecuteScripts())
289 return; 294 return;
290 295
291 enable(); 296 enable();
292 ErrorString error; 297 ErrorString error;
293 298
294 int pauseState = V8DebuggerImpl::DontPauseOnExceptions; 299 int pauseState = V8DebuggerImpl::DontPauseOnExceptions;
295 m_state->getNumber(DebuggerAgentState::pauseOnExceptionsState, &pauseState); 300 m_state->getNumber(DebuggerAgentState::pauseOnExceptionsState, &pauseState);
296 setPauseOnExceptionsImpl(&error, pauseState); 301 setPauseOnExceptionsImpl(&error, pauseState);
297 ASSERT(error.isEmpty()); 302 ASSERT(error.isEmpty());
(...skipping 1156 matching lines...)
1454 if (!enabled()) 1459 if (!enabled())
1455 return; 1460 return;
1456 m_scheduledDebuggerStep = NoStep; 1461 m_scheduledDebuggerStep = NoStep;
1457 m_scripts.clear(); 1462 m_scripts.clear();
1458 m_blackboxedPositions.clear(); 1463 m_blackboxedPositions.clear();
1459 m_breakpointIdToDebuggerBreakpointIds.clear(); 1464 m_breakpointIdToDebuggerBreakpointIds.clear();
1460 allAsyncTasksCanceled(); 1465 allAsyncTasksCanceled();
1461 } 1466 }
1462 1467
1463 } // namespace blink 1468 } // namespace blink
OLDNEW

Powered by Google App Engine