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

Side by Side Diff: Source/core/inspector/V8DebuggerAgent.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 // 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 "config.h" 5 #include "config.h"
6 #include "core/inspector/V8DebuggerAgent.h" 6 #include "core/inspector/V8DebuggerAgent.h"
7 7
8 #include "bindings/core/v8/ScriptCallStackFactory.h" 8 #include "bindings/core/v8/ScriptCallStackFactory.h"
9 #include "bindings/core/v8/ScriptRegexp.h" 9 #include "bindings/core/v8/ScriptRegexp.h"
10 #include "bindings/core/v8/ScriptValue.h" 10 #include "bindings/core/v8/ScriptValue.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 return V8JavaScriptCallFrame::unwrap(value); 115 return V8JavaScriptCallFrame::unwrap(value);
116 } 116 }
117 117
118 static PassRefPtrWillBeRawPtr<ScriptCallStack> toScriptCallStack(v8::Local<v8::O bject> callFrames) 118 static PassRefPtrWillBeRawPtr<ScriptCallStack> toScriptCallStack(v8::Local<v8::O bject> callFrames)
119 { 119 {
120 RefPtr<JavaScriptCallFrame> jsCallFrame = toJavaScriptCallFrame(callFrames); 120 RefPtr<JavaScriptCallFrame> jsCallFrame = toJavaScriptCallFrame(callFrames);
121 return jsCallFrame ? toScriptCallStack(jsCallFrame.get()) : nullptr; 121 return jsCallFrame ? toScriptCallStack(jsCallFrame.get()) : nullptr;
122 } 122 }
123 123
124 V8DebuggerAgent::V8DebuggerAgent(InjectedScriptManager* injectedScriptManager, V 8Debugger* debugger, V8DebuggerAgent::Client* client, int contextGroupId) 124 V8DebuggerAgent::V8DebuggerAgent(InjectedScriptManager* injectedScriptManager, V 8Debugger* debugger, V8DebuggerAgent::Client* client, int contextGroupId)
125 : InspectorBaseAgent<V8DebuggerAgent, InspectorFrontend::Debugger>("Debugger ") 125 : m_injectedScriptManager(injectedScriptManager)
126 , m_injectedScriptManager(injectedScriptManager)
127 , m_debugger(debugger) 126 , m_debugger(debugger)
128 , m_client(client) 127 , m_client(client)
129 , m_contextGroupId(contextGroupId) 128 , m_contextGroupId(contextGroupId)
129 , m_state(nullptr)
130 , m_frontend(nullptr)
130 , m_isolate(debugger->isolate()) 131 , m_isolate(debugger->isolate())
131 , m_pausedScriptState(nullptr) 132 , m_pausedScriptState(nullptr)
132 , m_breakReason(InspectorFrontend::Debugger::Reason::Other) 133 , m_breakReason(InspectorFrontend::Debugger::Reason::Other)
133 , m_scheduledDebuggerStep(NoStep) 134 , m_scheduledDebuggerStep(NoStep)
134 , m_skipNextDebuggerStepOut(false) 135 , m_skipNextDebuggerStepOut(false)
135 , m_javaScriptPauseScheduled(false) 136 , m_javaScriptPauseScheduled(false)
136 , m_steppingFromFramework(false) 137 , m_steppingFromFramework(false)
137 , m_pausingOnNativeEvent(false) 138 , m_pausingOnNativeEvent(false)
138 , m_pausingOnAsyncOperation(false) 139 , m_pausingOnAsyncOperation(false)
139 , m_skippedStepFrameCount(0) 140 , m_skippedStepFrameCount(0)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 return m_state->getBoolean(DebuggerAgentState::debuggerEnabled); 201 return m_state->getBoolean(DebuggerAgentState::debuggerEnabled);
201 } 202 }
202 203
203 void V8DebuggerAgent::enable(ErrorString*) 204 void V8DebuggerAgent::enable(ErrorString*)
204 { 205 {
205 if (enabled()) 206 if (enabled())
206 return; 207 return;
207 208
208 enable(); 209 enable();
209 210
210 ASSERT(frontend()); 211 ASSERT(m_frontend);
211 } 212 }
212 213
213 void V8DebuggerAgent::disable(ErrorString*) 214 void V8DebuggerAgent::disable(ErrorString*)
214 { 215 {
215 if (!enabled()) 216 if (!enabled())
216 return; 217 return;
217 218
218 disable(); 219 disable();
219 m_state->setBoolean(DebuggerAgentState::debuggerEnabled, false); 220 m_state->setBoolean(DebuggerAgentState::debuggerEnabled, false);
220 } 221 }
(...skipping 20 matching lines...) Expand all
241 if (depth <= 0) { 242 if (depth <= 0) {
242 m_maxAsyncCallStackDepth = 0; 243 m_maxAsyncCallStackDepth = 0;
243 resetAsyncCallTracker(); 244 resetAsyncCallTracker();
244 } else { 245 } else {
245 m_maxAsyncCallStackDepth = depth; 246 m_maxAsyncCallStackDepth = depth;
246 } 247 }
247 for (auto& listener: m_asyncCallTrackingListeners) 248 for (auto& listener: m_asyncCallTrackingListeners)
248 listener->asyncCallTrackingStateChanged(m_maxAsyncCallStackDepth); 249 listener->asyncCallTrackingStateChanged(m_maxAsyncCallStackDepth);
249 } 250 }
250 251
252 void V8DebuggerAgent::clearFrontend()
253 {
254 ErrorString error;
255 disable(&error);
256 ASSERT(m_frontend);
257 m_frontend = nullptr;
258 }
259
251 void V8DebuggerAgent::restore() 260 void V8DebuggerAgent::restore()
252 { 261 {
253 if (enabled()) { 262 if (enabled()) {
254 frontend()->globalObjectCleared(); 263 m_frontend->globalObjectCleared();
255 enable(); 264 enable();
256 long pauseState = m_state->getLong(DebuggerAgentState::pauseOnExceptions State, V8Debugger::DontPauseOnExceptions); 265 long pauseState = m_state->getLong(DebuggerAgentState::pauseOnExceptions State, V8Debugger::DontPauseOnExceptions);
257 String error; 266 String error;
258 setPauseOnExceptionsImpl(&error, pauseState); 267 setPauseOnExceptionsImpl(&error, pauseState);
259 m_cachedSkipStackRegExp = compileSkipCallFramePattern(m_state->getString (DebuggerAgentState::skipStackPattern)); 268 m_cachedSkipStackRegExp = compileSkipCallFramePattern(m_state->getString (DebuggerAgentState::skipStackPattern));
260 increaseCachedSkipStackGeneration(); 269 increaseCachedSkipStackGeneration();
261 m_skipContentScripts = m_state->getBoolean(DebuggerAgentState::skipConte ntScripts); 270 m_skipContentScripts = m_state->getBoolean(DebuggerAgentState::skipConte ntScripts);
262 m_skipAllPauses = m_state->getBoolean(DebuggerAgentState::skipAllPauses) ; 271 m_skipAllPauses = m_state->getBoolean(DebuggerAgentState::skipAllPauses) ;
263 internalSetAsyncCallStackDepth(m_state->getLong(DebuggerAgentState::asyn cCallStackDepth)); 272 internalSetAsyncCallStackDepth(m_state->getLong(DebuggerAgentState::asyn cCallStackDepth));
264 promiseTracker().setEnabled(m_state->getBoolean(DebuggerAgentState::prom iseTrackerEnabled), m_state->getBoolean(DebuggerAgentState::promiseTrackerCaptur eStacks)); 273 promiseTracker().setEnabled(m_state->getBoolean(DebuggerAgentState::prom iseTrackerEnabled), m_state->getBoolean(DebuggerAgentState::promiseTrackerCaptur eStacks));
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 ASSERT(enabled()); 713 ASSERT(enabled());
705 if (m_scheduledDebuggerStep != StepInto || m_javaScriptPauseScheduled || isP aused()) 714 if (m_scheduledDebuggerStep != StepInto || m_javaScriptPauseScheduled || isP aused())
706 return; 715 return;
707 clearBreakDetails(); 716 clearBreakDetails();
708 m_pausingOnNativeEvent = false; 717 m_pausingOnNativeEvent = false;
709 m_skippedStepFrameCount = 0; 718 m_skippedStepFrameCount = 0;
710 m_recursionLevelForStepFrame = 0; 719 m_recursionLevelForStepFrame = 0;
711 debugger().setPauseOnNextStatement(true); 720 debugger().setPauseOnNextStatement(true);
712 } 721 }
713 722
714 void V8DebuggerAgent::didFireTimer()
715 {
716 cancelPauseOnNextStatement();
717 }
718
719 void V8DebuggerAgent::didHandleEvent()
720 {
721 cancelPauseOnNextStatement();
722 }
723
724 void V8DebuggerAgent::cancelPauseOnNextStatement() 723 void V8DebuggerAgent::cancelPauseOnNextStatement()
725 { 724 {
726 if (m_javaScriptPauseScheduled || isPaused()) 725 if (m_javaScriptPauseScheduled || isPaused())
727 return; 726 return;
728 clearBreakDetails(); 727 clearBreakDetails();
729 m_pausingOnNativeEvent = false; 728 m_pausingOnNativeEvent = false;
730 debugger().setPauseOnNextStatement(false); 729 debugger().setPauseOnNextStatement(false);
731 } 730 }
732 731
733 bool V8DebuggerAgent::v8AsyncTaskEventsEnabled() const 732 bool V8DebuggerAgent::v8AsyncTaskEventsEnabled() const
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 if (value.isEmpty()) { 1107 if (value.isEmpty()) {
1109 *errorString = "Promise with specified ID not found."; 1108 *errorString = "Promise with specified ID not found.";
1110 return; 1109 return;
1111 } 1110 }
1112 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(v alue.scriptState()); 1111 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(v alue.scriptState());
1113 promise = injectedScript.wrapObject(value, objectGroup ? *objectGroup : ""); 1112 promise = injectedScript.wrapObject(value, objectGroup ? *objectGroup : "");
1114 } 1113 }
1115 1114
1116 void V8DebuggerAgent::didUpdatePromise(InspectorFrontend::Debugger::EventType::E num eventType, PassRefPtr<TypeBuilder::Debugger::PromiseDetails> promise) 1115 void V8DebuggerAgent::didUpdatePromise(InspectorFrontend::Debugger::EventType::E num eventType, PassRefPtr<TypeBuilder::Debugger::PromiseDetails> promise)
1117 { 1116 {
1118 if (frontend()) 1117 if (m_frontend)
1119 frontend()->promiseUpdated(eventType, promise); 1118 m_frontend->promiseUpdated(eventType, promise);
1120 } 1119 }
1121 1120
1122 int V8DebuggerAgent::traceAsyncOperationStarting(const String& description) 1121 int V8DebuggerAgent::traceAsyncOperationStarting(const String& description)
1123 { 1122 {
1124 v8::HandleScope scope(m_isolate); 1123 v8::HandleScope scope(m_isolate);
1125 v8::Local<v8::Object> callFrames = debugger().currentCallFramesForAsyncStack (); 1124 v8::Local<v8::Object> callFrames = debugger().currentCallFramesForAsyncStack ();
1126 RefPtrWillBeRawPtr<AsyncCallChain> chain = nullptr; 1125 RefPtrWillBeRawPtr<AsyncCallChain> chain = nullptr;
1127 if (callFrames.IsEmpty()) { 1126 if (callFrames.IsEmpty()) {
1128 if (m_currentAsyncCallChain) 1127 if (m_currentAsyncCallChain)
1129 chain = AsyncCallChain::create(nullptr, m_currentAsyncCallChain.get( ), m_maxAsyncCallStackDepth); 1128 chain = AsyncCallChain::create(nullptr, m_currentAsyncCallChain.get( ), m_maxAsyncCallStackDepth);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 } 1230 }
1232 m_asyncOperations.remove(operationId); 1231 m_asyncOperations.remove(operationId);
1233 m_asyncOperationBreakpoints.remove(operationId); 1232 m_asyncOperationBreakpoints.remove(operationId);
1234 m_pausingAsyncOperations.remove(operationId); 1233 m_pausingAsyncOperations.remove(operationId);
1235 shouldNotify = !m_asyncOperationNotifications.take(operationId); 1234 shouldNotify = !m_asyncOperationNotifications.take(operationId);
1236 } 1235 }
1237 if (m_startingStepIntoAsync) { 1236 if (m_startingStepIntoAsync) {
1238 if (!m_pausingOnAsyncOperation && m_pausingAsyncOperations.isEmpty()) 1237 if (!m_pausingOnAsyncOperation && m_pausingAsyncOperations.isEmpty())
1239 clearStepIntoAsync(); 1238 clearStepIntoAsync();
1240 } 1239 }
1241 if (frontend() && shouldNotify) 1240 if (m_frontend && shouldNotify)
1242 frontend()->asyncOperationCompleted(operationId); 1241 m_frontend->asyncOperationCompleted(operationId);
1243 } 1242 }
1244 1243
1245 void V8DebuggerAgent::flushAsyncOperationEvents(ErrorString*) 1244 void V8DebuggerAgent::flushAsyncOperationEvents(ErrorString*)
1246 { 1245 {
1247 if (!frontend()) 1246 if (!m_frontend)
1248 return; 1247 return;
1249 1248
1250 for (int operationId : m_asyncOperationNotifications) { 1249 for (int operationId : m_asyncOperationNotifications) {
1251 RefPtrWillBeRawPtr<AsyncCallChain> chain = m_asyncOperations.get(operati onId); 1250 RefPtrWillBeRawPtr<AsyncCallChain> chain = m_asyncOperations.get(operati onId);
1252 ASSERT(chain); 1251 ASSERT(chain);
1253 const AsyncCallStackVector& callStacks = chain->callStacks(); 1252 const AsyncCallStackVector& callStacks = chain->callStacks();
1254 ASSERT(!callStacks.isEmpty()); 1253 ASSERT(!callStacks.isEmpty());
1255 1254
1256 RefPtr<AsyncOperation> operation; 1255 RefPtr<AsyncOperation> operation;
1257 RefPtr<AsyncStackTrace> lastAsyncStackTrace; 1256 RefPtr<AsyncStackTrace> lastAsyncStackTrace;
(...skipping 14 matching lines...) Expand all
1272 .setCallFrames(scriptCallStack->buildInspectorArray()); 1271 .setCallFrames(scriptCallStack->buildInspectorArray());
1273 asyncStackTrace->setDescription(callStack->description()); 1272 asyncStackTrace->setDescription(callStack->description());
1274 if (lastAsyncStackTrace) 1273 if (lastAsyncStackTrace)
1275 lastAsyncStackTrace->setAsyncStackTrace(asyncStackTrace); 1274 lastAsyncStackTrace->setAsyncStackTrace(asyncStackTrace);
1276 else 1275 else
1277 operation->setAsyncStackTrace(asyncStackTrace); 1276 operation->setAsyncStackTrace(asyncStackTrace);
1278 lastAsyncStackTrace = asyncStackTrace.release(); 1277 lastAsyncStackTrace = asyncStackTrace.release();
1279 } 1278 }
1280 1279
1281 if (operation) 1280 if (operation)
1282 frontend()->asyncOperationStarted(operation.release()); 1281 m_frontend->asyncOperationStarted(operation.release());
1283 } 1282 }
1284 1283
1285 m_asyncOperationNotifications.clear(); 1284 m_asyncOperationNotifications.clear();
1286 } 1285 }
1287 1286
1288 void V8DebuggerAgent::clearCurrentAsyncOperation() 1287 void V8DebuggerAgent::clearCurrentAsyncOperation()
1289 { 1288 {
1290 if (m_pendingTraceAsyncOperationCompleted && m_currentAsyncOperationId != un knownAsyncOperationId) 1289 if (m_pendingTraceAsyncOperationCompleted && m_currentAsyncOperationId != un knownAsyncOperationId)
1291 traceAsyncOperationCompleted(m_currentAsyncOperationId); 1290 traceAsyncOperationCompleted(m_currentAsyncOperationId);
1292 1291
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 *errorString = "Can only perform operation while tracking async call sta cks."; 1329 *errorString = "Can only perform operation while tracking async call sta cks.";
1331 return; 1330 return;
1332 } 1331 }
1333 if (operationId <= 0) { 1332 if (operationId <= 0) {
1334 *errorString = "Wrong async operation id."; 1333 *errorString = "Wrong async operation id.";
1335 return; 1334 return;
1336 } 1335 }
1337 m_asyncOperationBreakpoints.remove(operationId); 1336 m_asyncOperationBreakpoints.remove(operationId);
1338 } 1337 }
1339 1338
1340 void V8DebuggerAgent::scriptExecutionBlockedByCSP(const String& directiveText)
1341 {
1342 if (debugger().pauseOnExceptionsState() != V8Debugger::DontPauseOnExceptions ) {
1343 RefPtr<JSONObject> directive = JSONObject::create();
1344 directive->setString("directiveText", directiveText);
1345 breakProgram(InspectorFrontend::Debugger::Reason::CSPViolation, directiv e.release());
1346 }
1347 }
1348
1349 void V8DebuggerAgent::addAsyncCallTrackingListener(AsyncCallTrackingListener* li stener) 1339 void V8DebuggerAgent::addAsyncCallTrackingListener(AsyncCallTrackingListener* li stener)
1350 { 1340 {
1351 m_asyncCallTrackingListeners.add(listener); 1341 m_asyncCallTrackingListeners.add(listener);
1352 } 1342 }
1353 1343
1354 void V8DebuggerAgent::removeAsyncCallTrackingListener(AsyncCallTrackingListener* listener) 1344 void V8DebuggerAgent::removeAsyncCallTrackingListener(AsyncCallTrackingListener* listener)
1355 { 1345 {
1356 ASSERT(m_asyncCallTrackingListeners.contains(listener)); 1346 ASSERT(m_asyncCallTrackingListeners.contains(listener));
1357 m_asyncCallTrackingListeners.remove(listener); 1347 m_asyncCallTrackingListeners.remove(listener);
1358 } 1348 }
1359 1349
1360 void V8DebuggerAgent::willCallFunction(ExecutionContext*, const DevToolsFunction Info& info) 1350 void V8DebuggerAgent::willCallFunction(int scriptId)
1361 { 1351 {
1362 changeJavaScriptRecursionLevel(+1); 1352 changeJavaScriptRecursionLevel(+1);
1363 // Fast return. 1353 // Fast return.
1364 if (m_scheduledDebuggerStep != StepInto) 1354 if (m_scheduledDebuggerStep != StepInto)
1365 return; 1355 return;
1366 // Skip unknown scripts (e.g. InjectedScript). 1356 // Skip unknown scripts (e.g. InjectedScript).
1367 if (!m_scripts.contains(String::number(info.scriptId()))) 1357 if (!m_scripts.contains(String::number(scriptId)))
1368 return; 1358 return;
1369 schedulePauseOnNextStatementIfSteppingInto(); 1359 schedulePauseOnNextStatementIfSteppingInto();
1370 } 1360 }
1371 1361
1372 void V8DebuggerAgent::didCallFunction() 1362 void V8DebuggerAgent::didCallFunction()
1373 { 1363 {
1374 changeJavaScriptRecursionLevel(-1); 1364 changeJavaScriptRecursionLevel(-1);
1375 } 1365 }
1376 1366
1377 void V8DebuggerAgent::willEvaluateScript(const String&, int) 1367 void V8DebuggerAgent::willEvaluateScript()
1378 { 1368 {
1379 changeJavaScriptRecursionLevel(+1); 1369 changeJavaScriptRecursionLevel(+1);
1380 schedulePauseOnNextStatementIfSteppingInto(); 1370 schedulePauseOnNextStatementIfSteppingInto();
1381 } 1371 }
1382 1372
1383 void V8DebuggerAgent::didEvaluateScript() 1373 void V8DebuggerAgent::didEvaluateScript()
1384 { 1374 {
1385 changeJavaScriptRecursionLevel(-1); 1375 changeJavaScriptRecursionLevel(-1);
1386 } 1376 }
1387 1377
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 bool isInternalScript = script.isInternalScript(); 1506 bool isInternalScript = script.isInternalScript();
1517 bool hasSourceURL = script.hasSourceURL(); 1507 bool hasSourceURL = script.hasSourceURL();
1518 String scriptURL = script.sourceURL(); 1508 String scriptURL = script.sourceURL();
1519 String sourceMapURL = sourceMapURLForScript(script, parsedScript.compileResu lt); 1509 String sourceMapURL = sourceMapURLForScript(script, parsedScript.compileResu lt);
1520 1510
1521 const String* sourceMapURLParam = sourceMapURL.isNull() ? nullptr : &sourceM apURL; 1511 const String* sourceMapURLParam = sourceMapURL.isNull() ? nullptr : &sourceM apURL;
1522 const bool* isContentScriptParam = isContentScript ? &isContentScript : null ptr; 1512 const bool* isContentScriptParam = isContentScript ? &isContentScript : null ptr;
1523 const bool* isInternalScriptParam = isInternalScript ? &isInternalScript : n ullptr; 1513 const bool* isInternalScriptParam = isInternalScript ? &isInternalScript : n ullptr;
1524 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; 1514 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr;
1525 if (!hasSyntaxError) 1515 if (!hasSyntaxError)
1526 frontend()->scriptParsed(parsedScript.scriptId, scriptURL, script.startL ine(), script.startColumn(), script.endLine(), script.endColumn(), isContentScri ptParam, isInternalScriptParam, sourceMapURLParam, hasSourceURLParam); 1516 m_frontend->scriptParsed(parsedScript.scriptId, scriptURL, script.startL ine(), script.startColumn(), script.endLine(), script.endColumn(), isContentScri ptParam, isInternalScriptParam, sourceMapURLParam, hasSourceURLParam);
1527 else 1517 else
1528 frontend()->scriptFailedToParse(parsedScript.scriptId, scriptURL, script .startLine(), script.startColumn(), script.endLine(), script.endColumn(), isCont entScriptParam, isInternalScriptParam, sourceMapURLParam, hasSourceURLParam); 1518 m_frontend->scriptFailedToParse(parsedScript.scriptId, scriptURL, script .startLine(), script.startColumn(), script.endLine(), script.endColumn(), isCont entScriptParam, isInternalScriptParam, sourceMapURLParam, hasSourceURLParam);
1529 1519
1530 m_scripts.set(parsedScript.scriptId, script); 1520 m_scripts.set(parsedScript.scriptId, script);
1531 1521
1532 if (scriptURL.isEmpty() || hasSyntaxError) 1522 if (scriptURL.isEmpty() || hasSyntaxError)
1533 return; 1523 return;
1534 1524
1535 RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState ::javaScriptBreakpoints); 1525 RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState ::javaScriptBreakpoints);
1536 for (auto& cookie : *breakpointsCookie) { 1526 for (auto& cookie : *breakpointsCookie) {
1537 RefPtr<JSONObject> breakpointObject = cookie.value->asObject(); 1527 RefPtr<JSONObject> breakpointObject = cookie.value->asObject();
1538 bool isRegex; 1528 bool isRegex;
1539 breakpointObject->getBoolean(DebuggerAgentState::isRegex, &isRegex); 1529 breakpointObject->getBoolean(DebuggerAgentState::isRegex, &isRegex);
1540 String url; 1530 String url;
1541 breakpointObject->getString(DebuggerAgentState::url, &url); 1531 breakpointObject->getString(DebuggerAgentState::url, &url);
1542 if (!matches(scriptURL, url, isRegex)) 1532 if (!matches(scriptURL, url, isRegex))
1543 continue; 1533 continue;
1544 ScriptBreakpoint breakpoint; 1534 ScriptBreakpoint breakpoint;
1545 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint. lineNumber); 1535 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint. lineNumber);
1546 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin t.columnNumber); 1536 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin t.columnNumber);
1547 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c ondition); 1537 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c ondition);
1548 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(coo kie.key, parsedScript.scriptId, breakpoint, UserBreakpointSource); 1538 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(coo kie.key, parsedScript.scriptId, breakpoint, UserBreakpointSource);
1549 if (location) 1539 if (location)
1550 frontend()->breakpointResolved(cookie.key, location); 1540 m_frontend->breakpointResolved(cookie.key, location);
1551 } 1541 }
1552 } 1542 }
1553 1543
1554 V8DebuggerListener::SkipPauseRequest V8DebuggerAgent::didPause(v8::Local<v8::Con text> context, v8::Local<v8::Object> callFrames, v8::Local<v8::Value> v8exceptio n, const Vector<String>& hitBreakpoints, bool isPromiseRejection) 1544 V8DebuggerListener::SkipPauseRequest V8DebuggerAgent::didPause(v8::Local<v8::Con text> context, v8::Local<v8::Object> callFrames, v8::Local<v8::Value> v8exceptio n, const Vector<String>& hitBreakpoints, bool isPromiseRejection)
1555 { 1545 {
1556 ScriptState* scriptState = ScriptState::from(context); 1546 ScriptState* scriptState = ScriptState::from(context);
1557 ScriptValue exception(scriptState, v8exception); 1547 ScriptValue exception(scriptState, v8exception);
1558 1548
1559 V8DebuggerListener::SkipPauseRequest result; 1549 V8DebuggerListener::SkipPauseRequest result;
1560 if (m_skipAllPauses) 1550 if (m_skipAllPauses)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 1594
1605 BreakpointSource source = breakpointIterator->value.second; 1595 BreakpointSource source = breakpointIterator->value.second;
1606 if (m_breakReason == InspectorFrontend::Debugger::Reason::Other && s ource == DebugCommandBreakpointSource) 1596 if (m_breakReason == InspectorFrontend::Debugger::Reason::Other && s ource == DebugCommandBreakpointSource)
1607 m_breakReason = InspectorFrontend::Debugger::Reason::DebugComman d; 1597 m_breakReason = InspectorFrontend::Debugger::Reason::DebugComman d;
1608 } 1598 }
1609 } 1599 }
1610 1600
1611 if (!m_asyncOperationNotifications.isEmpty()) 1601 if (!m_asyncOperationNotifications.isEmpty())
1612 flushAsyncOperationEvents(nullptr); 1602 flushAsyncOperationEvents(nullptr);
1613 1603
1614 frontend()->paused(currentCallFrames(), m_breakReason, m_breakAuxData, hitBr eakpointIds, currentAsyncStackTrace()); 1604 m_frontend->paused(currentCallFrames(), m_breakReason, m_breakAuxData, hitBr eakpointIds, currentAsyncStackTrace());
1615 m_scheduledDebuggerStep = NoStep; 1605 m_scheduledDebuggerStep = NoStep;
1616 m_javaScriptPauseScheduled = false; 1606 m_javaScriptPauseScheduled = false;
1617 m_steppingFromFramework = false; 1607 m_steppingFromFramework = false;
1618 m_pausingOnNativeEvent = false; 1608 m_pausingOnNativeEvent = false;
1619 m_skippedStepFrameCount = 0; 1609 m_skippedStepFrameCount = 0;
1620 m_recursionLevelForStepFrame = 0; 1610 m_recursionLevelForStepFrame = 0;
1621 clearStepIntoAsync(); 1611 clearStepIntoAsync();
1622 1612
1623 if (!m_continueToLocationBreakpointId.isEmpty()) { 1613 if (!m_continueToLocationBreakpointId.isEmpty()) {
1624 debugger().removeBreakpoint(m_continueToLocationBreakpointId); 1614 debugger().removeBreakpoint(m_continueToLocationBreakpointId);
1625 m_continueToLocationBreakpointId = ""; 1615 m_continueToLocationBreakpointId = "";
1626 } 1616 }
1627 return result; 1617 return result;
1628 } 1618 }
1629 1619
1630 void V8DebuggerAgent::didContinue() 1620 void V8DebuggerAgent::didContinue()
1631 { 1621 {
1632 m_pausedScriptState = nullptr; 1622 m_pausedScriptState = nullptr;
1633 m_currentCallStack.Reset(); 1623 m_currentCallStack.Reset();
1634 clearBreakDetails(); 1624 clearBreakDetails();
1635 frontend()->resumed(); 1625 m_frontend->resumed();
1636 } 1626 }
1637 1627
1638 bool V8DebuggerAgent::canBreakProgram() 1628 bool V8DebuggerAgent::canBreakProgram()
1639 { 1629 {
1640 return debugger().canBreakProgram(); 1630 return debugger().canBreakProgram();
1641 } 1631 }
1642 1632
1643 void V8DebuggerAgent::breakProgram(InspectorFrontend::Debugger::Reason::Enum bre akReason, PassRefPtr<JSONObject> data) 1633 void V8DebuggerAgent::breakProgram(InspectorFrontend::Debugger::Reason::Enum bre akReason, PassRefPtr<JSONObject> data)
1644 { 1634 {
1645 ASSERT(enabled()); 1635 ASSERT(enabled());
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 removeBreakpoint(generateBreakpointId(scriptId, lineNumber, columnNumber, so urce)); 1700 removeBreakpoint(generateBreakpointId(scriptId, lineNumber, columnNumber, so urce));
1711 } 1701 }
1712 1702
1713 void V8DebuggerAgent::reset() 1703 void V8DebuggerAgent::reset()
1714 { 1704 {
1715 m_scheduledDebuggerStep = NoStep; 1705 m_scheduledDebuggerStep = NoStep;
1716 m_scripts.clear(); 1706 m_scripts.clear();
1717 m_breakpointIdToDebuggerBreakpointIds.clear(); 1707 m_breakpointIdToDebuggerBreakpointIds.clear();
1718 resetAsyncCallTracker(); 1708 resetAsyncCallTracker();
1719 promiseTracker().clear(); 1709 promiseTracker().clear();
1720 if (frontend()) 1710 if (m_frontend)
1721 frontend()->globalObjectCleared(); 1711 m_frontend->globalObjectCleared();
1722 } 1712 }
1723 1713
1724 void V8DebuggerAgent::resetModifiedSources() 1714 void V8DebuggerAgent::resetModifiedSources()
1725 { 1715 {
1726 m_editedScripts.clear(); 1716 m_editedScripts.clear();
1727 } 1717 }
1728 1718
1729 DEFINE_TRACE(V8DebuggerAgent)
1730 {
1731 #if ENABLE(OILPAN)
1732 visitor->trace(m_injectedScriptManager);
1733 visitor->trace(m_v8AsyncCallTracker);
1734 visitor->trace(m_promiseTracker);
1735 visitor->trace(m_asyncOperations);
1736 visitor->trace(m_currentAsyncCallChain);
1737 visitor->trace(m_asyncCallTrackingListeners);
1738 #endif
1739 InspectorBaseAgent::trace(visitor);
1740 }
1741
1742 PassRefPtr<TypeBuilder::Debugger::ExceptionDetails> V8DebuggerAgent::createExcep tionDetails(v8::Isolate* isolate, v8::Local<v8::Message> message) 1719 PassRefPtr<TypeBuilder::Debugger::ExceptionDetails> V8DebuggerAgent::createExcep tionDetails(v8::Isolate* isolate, v8::Local<v8::Message> message)
1743 { 1720 {
1744 RefPtr<ExceptionDetails> exceptionDetails = ExceptionDetails::create().setTe xt(toCoreStringWithUndefinedOrNullCheck(message->Get())); 1721 RefPtr<ExceptionDetails> exceptionDetails = ExceptionDetails::create().setTe xt(toCoreStringWithUndefinedOrNullCheck(message->Get()));
1745 exceptionDetails->setLine(message->GetLineNumber()); 1722 exceptionDetails->setLine(message->GetLineNumber());
1746 exceptionDetails->setColumn(message->GetStartColumn()); 1723 exceptionDetails->setColumn(message->GetStartColumn());
1747 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace(); 1724 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace();
1748 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0) 1725 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0)
1749 exceptionDetails->setStackTrace(createScriptCallStack(isolate, messageSt ackTrace, messageStackTrace->GetFrameCount())->buildInspectorArray()); 1726 exceptionDetails->setStackTrace(createScriptCallStack(isolate, messageSt ackTrace, messageStackTrace->GetFrameCount())->buildInspectorArray());
1750 return exceptionDetails.release(); 1727 return exceptionDetails.release();
1751 } 1728 }
1752 1729
1753 } // namespace blink 1730 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698