| OLD | NEW |
| 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 } | 328 } |
| 329 | 329 |
| 330 static PassOwnPtr<protocol::DictionaryValue> buildObjectForBreakpointCookie(cons
t String16& url, int lineNumber, int columnNumber, const String16& condition, bo
ol isRegex) | 330 static PassOwnPtr<protocol::DictionaryValue> buildObjectForBreakpointCookie(cons
t String16& url, int lineNumber, int columnNumber, const String16& condition, bo
ol isRegex) |
| 331 { | 331 { |
| 332 OwnPtr<protocol::DictionaryValue> breakpointObject = protocol::DictionaryVal
ue::create(); | 332 OwnPtr<protocol::DictionaryValue> breakpointObject = protocol::DictionaryVal
ue::create(); |
| 333 breakpointObject->setString(DebuggerAgentState::url, url); | 333 breakpointObject->setString(DebuggerAgentState::url, url); |
| 334 breakpointObject->setNumber(DebuggerAgentState::lineNumber, lineNumber); | 334 breakpointObject->setNumber(DebuggerAgentState::lineNumber, lineNumber); |
| 335 breakpointObject->setNumber(DebuggerAgentState::columnNumber, columnNumber); | 335 breakpointObject->setNumber(DebuggerAgentState::columnNumber, columnNumber); |
| 336 breakpointObject->setString(DebuggerAgentState::condition, condition); | 336 breakpointObject->setString(DebuggerAgentState::condition, condition); |
| 337 breakpointObject->setBoolean(DebuggerAgentState::isRegex, isRegex); | 337 breakpointObject->setBoolean(DebuggerAgentState::isRegex, isRegex); |
| 338 return breakpointObject.release(); | 338 return breakpointObject; |
| 339 } | 339 } |
| 340 | 340 |
| 341 static bool matches(V8DebuggerImpl* debugger, const String16& url, const String1
6& pattern, bool isRegex) | 341 static bool matches(V8DebuggerImpl* debugger, const String16& url, const String1
6& pattern, bool isRegex) |
| 342 { | 342 { |
| 343 if (isRegex) { | 343 if (isRegex) { |
| 344 V8Regex regex(debugger, pattern, true); | 344 V8Regex regex(debugger, pattern, true); |
| 345 return regex.match(url) != -1; | 345 return regex.match(url) != -1; |
| 346 } | 346 } |
| 347 return url == pattern; | 347 return url == pattern; |
| 348 } | 348 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 372 } | 372 } |
| 373 } | 373 } |
| 374 String16 condition = optionalCondition.fromMaybe(""); | 374 String16 condition = optionalCondition.fromMaybe(""); |
| 375 bool isRegex = optionalURLRegex.isJust(); | 375 bool isRegex = optionalURLRegex.isJust(); |
| 376 | 376 |
| 377 String16 breakpointId = (isRegex ? "/" + url + "/" : url) + ":" + String16::
number(lineNumber) + ":" + String16::number(columnNumber); | 377 String16 breakpointId = (isRegex ? "/" + url + "/" : url) + ":" + String16::
number(lineNumber) + ":" + String16::number(columnNumber); |
| 378 protocol::DictionaryValue* breakpointsCookie = m_state->getObject(DebuggerAg
entState::javaScriptBreakpoints); | 378 protocol::DictionaryValue* breakpointsCookie = m_state->getObject(DebuggerAg
entState::javaScriptBreakpoints); |
| 379 if (!breakpointsCookie) { | 379 if (!breakpointsCookie) { |
| 380 OwnPtr<protocol::DictionaryValue> newValue = protocol::DictionaryValue::
create(); | 380 OwnPtr<protocol::DictionaryValue> newValue = protocol::DictionaryValue::
create(); |
| 381 breakpointsCookie = newValue.get(); | 381 breakpointsCookie = newValue.get(); |
| 382 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, newValue.r
elease()); | 382 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, std::move(
newValue)); |
| 383 } | 383 } |
| 384 if (breakpointsCookie->get(breakpointId)) { | 384 if (breakpointsCookie->get(breakpointId)) { |
| 385 *errorString = "Breakpoint at specified location already exists."; | 385 *errorString = "Breakpoint at specified location already exists."; |
| 386 return; | 386 return; |
| 387 } | 387 } |
| 388 | 388 |
| 389 breakpointsCookie->setObject(breakpointId, buildObjectForBreakpointCookie(ur
l, lineNumber, columnNumber, condition, isRegex)); | 389 breakpointsCookie->setObject(breakpointId, buildObjectForBreakpointCookie(ur
l, lineNumber, columnNumber, condition, isRegex)); |
| 390 | 390 |
| 391 ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition); | 391 ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition); |
| 392 for (auto& script : m_scripts) { | 392 for (auto& script : m_scripts) { |
| 393 if (!matches(m_debugger, script.second->sourceURL(), url, isRegex)) | 393 if (!matches(m_debugger, script.second->sourceURL(), url, isRegex)) |
| 394 continue; | 394 continue; |
| 395 OwnPtr<protocol::Debugger::Location> location = resolveBreakpoint(breakp
ointId, script.first, breakpoint, UserBreakpointSource); | 395 OwnPtr<protocol::Debugger::Location> location = resolveBreakpoint(breakp
ointId, script.first, breakpoint, UserBreakpointSource); |
| 396 if (location) | 396 if (location) |
| 397 (*locations)->addItem(location.release()); | 397 (*locations)->addItem(std::move(location)); |
| 398 } | 398 } |
| 399 | 399 |
| 400 *outBreakpointId = breakpointId; | 400 *outBreakpointId = breakpointId; |
| 401 } | 401 } |
| 402 | 402 |
| 403 static bool parseLocation(ErrorString* errorString, PassOwnPtr<protocol::Debugge
r::Location> location, String16* scriptId, int* lineNumber, int* columnNumber) | 403 static bool parseLocation(ErrorString* errorString, PassOwnPtr<protocol::Debugge
r::Location> location, String16* scriptId, int* lineNumber, int* columnNumber) |
| 404 { | 404 { |
| 405 *scriptId = location->getScriptId(); | 405 *scriptId = location->getScriptId(); |
| 406 *lineNumber = location->getLineNumber(); | 406 *lineNumber = location->getLineNumber(); |
| 407 *columnNumber = location->getColumnNumber(0); | 407 *columnNumber = location->getColumnNumber(0); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 Maybe<protocol::Debugger::SetScriptSourceError>* optOutCompileError) | 623 Maybe<protocol::Debugger::SetScriptSourceError>* optOutCompileError) |
| 624 { | 624 { |
| 625 if (!checkEnabled(errorString)) | 625 if (!checkEnabled(errorString)) |
| 626 return; | 626 return; |
| 627 if (!debugger().setScriptSource(scriptId, newContent, preview.fromMaybe(fals
e), errorString, optOutCompileError, &m_pausedCallFrames, stackChanged)) | 627 if (!debugger().setScriptSource(scriptId, newContent, preview.fromMaybe(fals
e), errorString, optOutCompileError, &m_pausedCallFrames, stackChanged)) |
| 628 return; | 628 return; |
| 629 | 629 |
| 630 OwnPtr<Array<CallFrame>> callFrames = currentCallFrames(errorString); | 630 OwnPtr<Array<CallFrame>> callFrames = currentCallFrames(errorString); |
| 631 if (!callFrames) | 631 if (!callFrames) |
| 632 return; | 632 return; |
| 633 *newCallFrames = callFrames.release(); | 633 *newCallFrames = std::move(callFrames); |
| 634 *asyncStackTrace = currentAsyncStackTrace(); | 634 *asyncStackTrace = currentAsyncStackTrace(); |
| 635 | 635 |
| 636 ScriptsMap::iterator it = m_scripts.find(scriptId); | 636 ScriptsMap::iterator it = m_scripts.find(scriptId); |
| 637 if (it == m_scripts.end()) | 637 if (it == m_scripts.end()) |
| 638 return; | 638 return; |
| 639 it->second->setSource(newContent); | 639 it->second->setSource(newContent); |
| 640 } | 640 } |
| 641 | 641 |
| 642 void V8DebuggerAgentImpl::restartFrame(ErrorString* errorString, | 642 void V8DebuggerAgentImpl::restartFrame(ErrorString* errorString, |
| 643 const String16& callFrameId, | 643 const String16& callFrameId, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 OwnPtr<FunctionDetails> functionDetails = FunctionDetails::create() | 704 OwnPtr<FunctionDetails> functionDetails = FunctionDetails::create() |
| 705 .setLocation(buildProtocolLocation(String16::number(function->ScriptId()
), function->GetScriptLineNumber(), function->GetScriptColumnNumber())) | 705 .setLocation(buildProtocolLocation(String16::number(function->ScriptId()
), function->GetScriptLineNumber(), function->GetScriptColumnNumber())) |
| 706 .setFunctionName(toProtocolStringWithTypeCheck(function->GetDebugName())
) | 706 .setFunctionName(toProtocolStringWithTypeCheck(function->GetDebugName())
) |
| 707 .setIsGenerator(function->IsGeneratorFunction()).build(); | 707 .setIsGenerator(function->IsGeneratorFunction()).build(); |
| 708 | 708 |
| 709 if (!scopes.IsEmpty()) { | 709 if (!scopes.IsEmpty()) { |
| 710 protocol::ErrorSupport errorSupport; | 710 protocol::ErrorSupport errorSupport; |
| 711 OwnPtr<protocol::Array<protocol::Debugger::Scope>> scopeChain = protocol
::Array<protocol::Debugger::Scope>::parse(toProtocolValue(scope.context(), scope
s).get(), &errorSupport); | 711 OwnPtr<protocol::Array<protocol::Debugger::Scope>> scopeChain = protocol
::Array<protocol::Debugger::Scope>::parse(toProtocolValue(scope.context(), scope
s).get(), &errorSupport); |
| 712 if (hasInternalError(errorString, errorSupport.hasErrors())) | 712 if (hasInternalError(errorString, errorSupport.hasErrors())) |
| 713 return; | 713 return; |
| 714 functionDetails->setScopeChain(scopeChain.release()); | 714 functionDetails->setScopeChain(std::move(scopeChain)); |
| 715 } | 715 } |
| 716 | 716 |
| 717 *details = functionDetails.release(); | 717 *details = std::move(functionDetails); |
| 718 } | 718 } |
| 719 | 719 |
| 720 void V8DebuggerAgentImpl::getGeneratorObjectDetails(ErrorString* errorString, co
nst String16& objectId, OwnPtr<GeneratorObjectDetails>* outDetails) | 720 void V8DebuggerAgentImpl::getGeneratorObjectDetails(ErrorString* errorString, co
nst String16& objectId, OwnPtr<GeneratorObjectDetails>* outDetails) |
| 721 { | 721 { |
| 722 if (!checkEnabled(errorString)) | 722 if (!checkEnabled(errorString)) |
| 723 return; | 723 return; |
| 724 InjectedScript::ObjectScope scope(errorString, m_debugger, m_session->contex
tGroupId(), objectId); | 724 InjectedScript::ObjectScope scope(errorString, m_debugger, m_session->contex
tGroupId(), objectId); |
| 725 if (!scope.initialize()) | 725 if (!scope.initialize()) |
| 726 return; | 726 return; |
| 727 if (!scope.object()->IsObject()) { | 727 if (!scope.object()->IsObject()) { |
| 728 *errorString = "Value with given id is not an Object"; | 728 *errorString = "Value with given id is not an Object"; |
| 729 return; | 729 return; |
| 730 } | 730 } |
| 731 v8::Local<v8::Object> object = scope.object().As<v8::Object>(); | 731 v8::Local<v8::Object> object = scope.object().As<v8::Object>(); |
| 732 | 732 |
| 733 v8::Local<v8::Object> detailsObject; | 733 v8::Local<v8::Object> detailsObject; |
| 734 v8::Local<v8::Value> detailsValue = debugger().generatorObjectDetails(object
); | 734 v8::Local<v8::Value> detailsValue = debugger().generatorObjectDetails(object
); |
| 735 if (hasInternalError(errorString, !detailsValue->IsObject() || !detailsValue
->ToObject(scope.context()).ToLocal(&detailsObject))) | 735 if (hasInternalError(errorString, !detailsValue->IsObject() || !detailsValue
->ToObject(scope.context()).ToLocal(&detailsObject))) |
| 736 return; | 736 return; |
| 737 | 737 |
| 738 if (!scope.injectedScript()->wrapObjectProperty(errorString, detailsObject,
toV8StringInternalized(m_isolate, "function"), scope.objectGroupName())) | 738 if (!scope.injectedScript()->wrapObjectProperty(errorString, detailsObject,
toV8StringInternalized(m_isolate, "function"), scope.objectGroupName())) |
| 739 return; | 739 return; |
| 740 | 740 |
| 741 protocol::ErrorSupport errors; | 741 protocol::ErrorSupport errors; |
| 742 OwnPtr<GeneratorObjectDetails> protocolDetails = GeneratorObjectDetails::par
se(toProtocolValue(scope.context(), detailsObject).get(), &errors); | 742 OwnPtr<GeneratorObjectDetails> protocolDetails = GeneratorObjectDetails::par
se(toProtocolValue(scope.context(), detailsObject).get(), &errors); |
| 743 if (hasInternalError(errorString, !protocolDetails)) | 743 if (hasInternalError(errorString, !protocolDetails)) |
| 744 return; | 744 return; |
| 745 *outDetails = protocolDetails.release(); | 745 *outDetails = std::move(protocolDetails); |
| 746 } | 746 } |
| 747 | 747 |
| 748 void V8DebuggerAgentImpl::getCollectionEntries(ErrorString* errorString, const S
tring16& objectId, OwnPtr<protocol::Array<CollectionEntry>>* outEntries) | 748 void V8DebuggerAgentImpl::getCollectionEntries(ErrorString* errorString, const S
tring16& objectId, OwnPtr<protocol::Array<CollectionEntry>>* outEntries) |
| 749 { | 749 { |
| 750 if (!checkEnabled(errorString)) | 750 if (!checkEnabled(errorString)) |
| 751 return; | 751 return; |
| 752 InjectedScript::ObjectScope scope(errorString, m_debugger, m_session->contex
tGroupId(), objectId); | 752 InjectedScript::ObjectScope scope(errorString, m_debugger, m_session->contex
tGroupId(), objectId); |
| 753 if (!scope.initialize()) | 753 if (!scope.initialize()) |
| 754 return; | 754 return; |
| 755 if (!scope.object()->IsObject()) { | 755 if (!scope.object()->IsObject()) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 769 return; | 769 return; |
| 770 v8::Local<v8::Array> entriesArray = entriesValue.As<v8::Array>(); | 770 v8::Local<v8::Array> entriesArray = entriesValue.As<v8::Array>(); |
| 771 if (!scope.injectedScript()->wrapPropertyInArray(errorString, entriesArray,
toV8StringInternalized(m_isolate, "key"), scope.objectGroupName())) | 771 if (!scope.injectedScript()->wrapPropertyInArray(errorString, entriesArray,
toV8StringInternalized(m_isolate, "key"), scope.objectGroupName())) |
| 772 return; | 772 return; |
| 773 if (!scope.injectedScript()->wrapPropertyInArray(errorString, entriesArray,
toV8StringInternalized(m_isolate, "value"), scope.objectGroupName())) | 773 if (!scope.injectedScript()->wrapPropertyInArray(errorString, entriesArray,
toV8StringInternalized(m_isolate, "value"), scope.objectGroupName())) |
| 774 return; | 774 return; |
| 775 protocol::ErrorSupport errors; | 775 protocol::ErrorSupport errors; |
| 776 OwnPtr<protocol::Array<CollectionEntry>> entries = protocol::Array<Collectio
nEntry>::parse(toProtocolValue(scope.context(), entriesArray).get(), &errors); | 776 OwnPtr<protocol::Array<CollectionEntry>> entries = protocol::Array<Collectio
nEntry>::parse(toProtocolValue(scope.context(), entriesArray).get(), &errors); |
| 777 if (hasInternalError(errorString, !entries)) | 777 if (hasInternalError(errorString, !entries)) |
| 778 return; | 778 return; |
| 779 *outEntries = entries.release(); | 779 *outEntries = std::move(entries); |
| 780 } | 780 } |
| 781 | 781 |
| 782 void V8DebuggerAgentImpl::schedulePauseOnNextStatement(const String16& breakReas
on, PassOwnPtr<protocol::DictionaryValue> data) | 782 void V8DebuggerAgentImpl::schedulePauseOnNextStatement(const String16& breakReas
on, PassOwnPtr<protocol::DictionaryValue> data) |
| 783 { | 783 { |
| 784 if (!enabled() || m_scheduledDebuggerStep == StepInto || m_javaScriptPauseSc
heduled || debugger().isPaused() || !debugger().breakpointsActivated()) | 784 if (!enabled() || m_scheduledDebuggerStep == StepInto || m_javaScriptPauseSc
heduled || debugger().isPaused() || !debugger().breakpointsActivated()) |
| 785 return; | 785 return; |
| 786 m_breakReason = breakReason; | 786 m_breakReason = breakReason; |
| 787 m_breakAuxData = std::move(data); | 787 m_breakAuxData = std::move(data); |
| 788 m_pausingOnNativeEvent = true; | 788 m_pausingOnNativeEvent = true; |
| 789 m_skipNextDebuggerStepOut = false; | 789 m_skipNextDebuggerStepOut = false; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 internalSetAsyncCallStackDepth(depth); | 1000 internalSetAsyncCallStackDepth(depth); |
| 1001 } | 1001 } |
| 1002 | 1002 |
| 1003 void V8DebuggerAgentImpl::asyncTaskScheduled(const String16& taskName, void* tas
k, bool recurring) | 1003 void V8DebuggerAgentImpl::asyncTaskScheduled(const String16& taskName, void* tas
k, bool recurring) |
| 1004 { | 1004 { |
| 1005 if (!m_maxAsyncCallStackDepth) | 1005 if (!m_maxAsyncCallStackDepth) |
| 1006 return; | 1006 return; |
| 1007 v8::HandleScope scope(m_isolate); | 1007 v8::HandleScope scope(m_isolate); |
| 1008 OwnPtr<V8StackTraceImpl> chain = V8StackTraceImpl::capture(this, V8StackTrac
e::maxCallStackSizeToCapture, taskName); | 1008 OwnPtr<V8StackTraceImpl> chain = V8StackTraceImpl::capture(this, V8StackTrac
e::maxCallStackSizeToCapture, taskName); |
| 1009 if (chain) { | 1009 if (chain) { |
| 1010 m_asyncTaskStacks.set(task, chain.release()); | 1010 m_asyncTaskStacks.set(task, std::move(chain)); |
| 1011 if (recurring) | 1011 if (recurring) |
| 1012 m_recurringTasks.add(task); | 1012 m_recurringTasks.add(task); |
| 1013 } | 1013 } |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 void V8DebuggerAgentImpl::asyncTaskCanceled(void* task) | 1016 void V8DebuggerAgentImpl::asyncTaskCanceled(void* task) |
| 1017 { | 1017 { |
| 1018 if (!m_maxAsyncCallStackDepth) | 1018 if (!m_maxAsyncCallStackDepth) |
| 1019 return; | 1019 return; |
| 1020 m_asyncTaskStacks.remove(task); | 1020 m_asyncTaskStacks.remove(task); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 m_state->setString(DebuggerAgentState::blackboxPattern, pattern); | 1090 m_state->setString(DebuggerAgentState::blackboxPattern, pattern); |
| 1091 } | 1091 } |
| 1092 | 1092 |
| 1093 bool V8DebuggerAgentImpl::setBlackboxPattern(ErrorString* errorString, const Str
ing16& pattern) | 1093 bool V8DebuggerAgentImpl::setBlackboxPattern(ErrorString* errorString, const Str
ing16& pattern) |
| 1094 { | 1094 { |
| 1095 OwnPtr<V8Regex> regex = adoptPtr(new V8Regex(m_debugger, pattern, true /** c
aseSensitive */, false /** multiline */)); | 1095 OwnPtr<V8Regex> regex = adoptPtr(new V8Regex(m_debugger, pattern, true /** c
aseSensitive */, false /** multiline */)); |
| 1096 if (!regex->isValid()) { | 1096 if (!regex->isValid()) { |
| 1097 *errorString = "Pattern parser error: " + regex->errorMessage(); | 1097 *errorString = "Pattern parser error: " + regex->errorMessage(); |
| 1098 return false; | 1098 return false; |
| 1099 } | 1099 } |
| 1100 m_blackboxPattern = regex.release(); | 1100 m_blackboxPattern = std::move(regex); |
| 1101 return true; | 1101 return true; |
| 1102 } | 1102 } |
| 1103 | 1103 |
| 1104 void V8DebuggerAgentImpl::setBlackboxedRanges(ErrorString* error, const String16
& scriptId, PassOwnPtr<protocol::Array<protocol::Debugger::ScriptPosition>> inPo
sitions) | 1104 void V8DebuggerAgentImpl::setBlackboxedRanges(ErrorString* error, const String16
& scriptId, PassOwnPtr<protocol::Array<protocol::Debugger::ScriptPosition>> inPo
sitions) |
| 1105 { | 1105 { |
| 1106 if (!m_scripts.contains(scriptId)) { | 1106 if (!m_scripts.contains(scriptId)) { |
| 1107 *error = "No script with passed id."; | 1107 *error = "No script with passed id."; |
| 1108 return; | 1108 return; |
| 1109 } | 1109 } |
| 1110 | 1110 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1237 } | 1237 } |
| 1238 | 1238 |
| 1239 if (hasInternalError(errorString, !objects->Set(context, frameOrdinal, d
etails).FromMaybe(false))) | 1239 if (hasInternalError(errorString, !objects->Set(context, frameOrdinal, d
etails).FromMaybe(false))) |
| 1240 return Array<CallFrame>::create(); | 1240 return Array<CallFrame>::create(); |
| 1241 } | 1241 } |
| 1242 | 1242 |
| 1243 protocol::ErrorSupport errorSupport; | 1243 protocol::ErrorSupport errorSupport; |
| 1244 OwnPtr<Array<CallFrame>> callFrames = Array<CallFrame>::parse(toProtocolValu
e(context, objects).get(), &errorSupport); | 1244 OwnPtr<Array<CallFrame>> callFrames = Array<CallFrame>::parse(toProtocolValu
e(context, objects).get(), &errorSupport); |
| 1245 if (hasInternalError(errorString, !callFrames)) | 1245 if (hasInternalError(errorString, !callFrames)) |
| 1246 return Array<CallFrame>::create(); | 1246 return Array<CallFrame>::create(); |
| 1247 return callFrames.release(); | 1247 return callFrames; |
| 1248 } | 1248 } |
| 1249 | 1249 |
| 1250 PassOwnPtr<StackTrace> V8DebuggerAgentImpl::currentAsyncStackTrace() | 1250 PassOwnPtr<StackTrace> V8DebuggerAgentImpl::currentAsyncStackTrace() |
| 1251 { | 1251 { |
| 1252 if (m_pausedContext.IsEmpty() || !m_maxAsyncCallStackDepth || !m_currentStac
ks.size() || !m_currentStacks.last()) | 1252 if (m_pausedContext.IsEmpty() || !m_maxAsyncCallStackDepth || !m_currentStac
ks.size() || !m_currentStacks.last()) |
| 1253 return nullptr; | 1253 return nullptr; |
| 1254 | 1254 |
| 1255 return m_currentStacks.last()->buildInspectorObjectForTail(this); | 1255 return m_currentStacks.last()->buildInspectorObjectForTail(this); |
| 1256 } | 1256 } |
| 1257 | 1257 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 String16 url; | 1317 String16 url; |
| 1318 breakpointObject->getString(DebuggerAgentState::url, &url); | 1318 breakpointObject->getString(DebuggerAgentState::url, &url); |
| 1319 if (!matches(m_debugger, scriptURL, url, isRegex)) | 1319 if (!matches(m_debugger, scriptURL, url, isRegex)) |
| 1320 continue; | 1320 continue; |
| 1321 ScriptBreakpoint breakpoint; | 1321 ScriptBreakpoint breakpoint; |
| 1322 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint.
lineNumber); | 1322 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint.
lineNumber); |
| 1323 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin
t.columnNumber); | 1323 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin
t.columnNumber); |
| 1324 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c
ondition); | 1324 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c
ondition); |
| 1325 OwnPtr<protocol::Debugger::Location> location = resolveBreakpoint(cookie
.first, parsedScript.scriptId, breakpoint, UserBreakpointSource); | 1325 OwnPtr<protocol::Debugger::Location> location = resolveBreakpoint(cookie
.first, parsedScript.scriptId, breakpoint, UserBreakpointSource); |
| 1326 if (location) | 1326 if (location) |
| 1327 m_frontend->breakpointResolved(cookie.first, location.release()); | 1327 m_frontend->breakpointResolved(cookie.first, std::move(location)); |
| 1328 } | 1328 } |
| 1329 } | 1329 } |
| 1330 | 1330 |
| 1331 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause(v8::Local<v8
::Context> context, v8::Local<v8::Value> exception, const protocol::Vector<Strin
g16>& hitBreakpoints, bool isPromiseRejection) | 1331 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause(v8::Local<v8
::Context> context, v8::Local<v8::Value> exception, const protocol::Vector<Strin
g16>& hitBreakpoints, bool isPromiseRejection) |
| 1332 { | 1332 { |
| 1333 JavaScriptCallFrames callFrames = debugger().currentCallFrames(1); | 1333 JavaScriptCallFrames callFrames = debugger().currentCallFrames(1); |
| 1334 JavaScriptCallFrame* topCallFrame = callFrames.size() > 0 ? callFrames[0].ge
t() : nullptr; | 1334 JavaScriptCallFrame* topCallFrame = callFrames.size() > 0 ? callFrames[0].ge
t() : nullptr; |
| 1335 | 1335 |
| 1336 V8DebuggerAgentImpl::SkipPauseRequest result; | 1336 V8DebuggerAgentImpl::SkipPauseRequest result; |
| 1337 if (m_skipAllPauses) | 1337 if (m_skipAllPauses) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1377 const String16& localId = breakpointIterator->second->first; | 1377 const String16& localId = breakpointIterator->second->first; |
| 1378 hitBreakpointIds->addItem(localId); | 1378 hitBreakpointIds->addItem(localId); |
| 1379 | 1379 |
| 1380 BreakpointSource source = breakpointIterator->second->second; | 1380 BreakpointSource source = breakpointIterator->second->second; |
| 1381 if (m_breakReason == protocol::Debugger::Paused::ReasonEnum::Other &
& source == DebugCommandBreakpointSource) | 1381 if (m_breakReason == protocol::Debugger::Paused::ReasonEnum::Other &
& source == DebugCommandBreakpointSource) |
| 1382 m_breakReason = protocol::Debugger::Paused::ReasonEnum::DebugCom
mand; | 1382 m_breakReason = protocol::Debugger::Paused::ReasonEnum::DebugCom
mand; |
| 1383 } | 1383 } |
| 1384 } | 1384 } |
| 1385 | 1385 |
| 1386 ErrorString errorString; | 1386 ErrorString errorString; |
| 1387 m_frontend->paused(currentCallFrames(&errorString), m_breakReason, m_breakAu
xData.release(), hitBreakpointIds.release(), currentAsyncStackTrace()); | 1387 m_frontend->paused(currentCallFrames(&errorString), m_breakReason, std::move
(m_breakAuxData), std::move(hitBreakpointIds), currentAsyncStackTrace()); |
| 1388 m_scheduledDebuggerStep = NoStep; | 1388 m_scheduledDebuggerStep = NoStep; |
| 1389 m_javaScriptPauseScheduled = false; | 1389 m_javaScriptPauseScheduled = false; |
| 1390 m_steppingFromFramework = false; | 1390 m_steppingFromFramework = false; |
| 1391 m_pausingOnNativeEvent = false; | 1391 m_pausingOnNativeEvent = false; |
| 1392 m_skippedStepFrameCount = 0; | 1392 m_skippedStepFrameCount = 0; |
| 1393 m_recursionLevelForStepFrame = 0; | 1393 m_recursionLevelForStepFrame = 0; |
| 1394 | 1394 |
| 1395 if (!m_continueToLocationBreakpointId.isEmpty()) { | 1395 if (!m_continueToLocationBreakpointId.isEmpty()) { |
| 1396 debugger().removeBreakpoint(m_continueToLocationBreakpointId); | 1396 debugger().removeBreakpoint(m_continueToLocationBreakpointId); |
| 1397 m_continueToLocationBreakpointId = ""; | 1397 m_continueToLocationBreakpointId = ""; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1459 if (!enabled()) | 1459 if (!enabled()) |
| 1460 return; | 1460 return; |
| 1461 m_scheduledDebuggerStep = NoStep; | 1461 m_scheduledDebuggerStep = NoStep; |
| 1462 m_scripts.clear(); | 1462 m_scripts.clear(); |
| 1463 m_blackboxedPositions.clear(); | 1463 m_blackboxedPositions.clear(); |
| 1464 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1464 m_breakpointIdToDebuggerBreakpointIds.clear(); |
| 1465 allAsyncTasksCanceled(); | 1465 allAsyncTasksCanceled(); |
| 1466 } | 1466 } |
| 1467 | 1467 |
| 1468 } // namespace blink | 1468 } // namespace blink |
| OLD | NEW |