Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project 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 "src/inspector/v8-debugger-agent-impl.h" | 5 #include "src/inspector/v8-debugger-agent-impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "src/debug/debug-interface.h" | 9 #include "src/debug/debug-interface.h" |
| 10 #include "src/inspector/injected-script.h" | 10 #include "src/inspector/injected-script.h" |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 741 | 741 |
| 742 Response V8DebuggerAgentImpl::stepOut() { | 742 Response V8DebuggerAgentImpl::stepOut() { |
| 743 if (!isPaused()) return Response::Error(kDebuggerNotPaused); | 743 if (!isPaused()) return Response::Error(kDebuggerNotPaused); |
| 744 m_scheduledDebuggerStep = StepOut; | 744 m_scheduledDebuggerStep = StepOut; |
| 745 m_recursionLevelForStepOut = 1; | 745 m_recursionLevelForStepOut = 1; |
| 746 m_session->releaseObjectGroup(kBacktraceObjectGroup); | 746 m_session->releaseObjectGroup(kBacktraceObjectGroup); |
| 747 m_debugger->stepOutOfFunction(); | 747 m_debugger->stepOutOfFunction(); |
| 748 return Response::OK(); | 748 return Response::OK(); |
| 749 } | 749 } |
| 750 | 750 |
| 751 void V8DebuggerAgentImpl::scheduleStepIntoAsync( | |
| 752 std::unique_ptr<ScheduleStepIntoAsyncCallback> callback) { | |
| 753 if (!isPaused()) { | |
| 754 callback->sendFailure(Response::Error(kDebuggerNotPaused)); | |
| 755 return; | |
| 756 } | |
| 757 if (m_stepIntoAsyncCallback) { | |
| 758 m_stepIntoAsyncCallback->sendFailure(Response::Error( | |
| 759 "Current scheduled step into async was overriden with new one.")); | |
| 760 } | |
| 761 m_stepIntoAsyncCallback = std::move(callback); | |
| 762 } | |
| 763 | |
| 764 bool V8DebuggerAgentImpl::shouldBreakInScheduledAsyncTask() { | |
| 765 if (!m_stepIntoAsyncCallback) return false; | |
| 766 m_stepIntoAsyncCallback->sendSuccess(); | |
| 767 m_stepIntoAsyncCallback.reset(); | |
| 768 m_scheduledDebuggerStep = NoStep; | |
| 769 v8::debug::ClearStepping(m_isolate); | |
| 770 return true; | |
| 771 } | |
| 772 | |
| 751 Response V8DebuggerAgentImpl::setPauseOnExceptions( | 773 Response V8DebuggerAgentImpl::setPauseOnExceptions( |
| 752 const String16& stringPauseState) { | 774 const String16& stringPauseState) { |
| 753 if (!enabled()) return Response::Error(kDebuggerNotEnabled); | 775 if (!enabled()) return Response::Error(kDebuggerNotEnabled); |
| 754 v8::debug::ExceptionBreakState pauseState; | 776 v8::debug::ExceptionBreakState pauseState; |
| 755 if (stringPauseState == "none") { | 777 if (stringPauseState == "none") { |
| 756 pauseState = v8::debug::NoBreakOnException; | 778 pauseState = v8::debug::NoBreakOnException; |
| 757 } else if (stringPauseState == "all") { | 779 } else if (stringPauseState == "all") { |
| 758 pauseState = v8::debug::BreakOnAnyException; | 780 pauseState = v8::debug::BreakOnAnyException; |
| 759 } else if (stringPauseState == "uncaught") { | 781 } else if (stringPauseState == "uncaught") { |
| 760 pauseState = v8::debug::BreakOnUncaughtException; | 782 pauseState = v8::debug::BreakOnUncaughtException; |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1231 protocol::DictionaryValue::create(); | 1253 protocol::DictionaryValue::create(); |
| 1232 reason->setString("reason", hitReasons[i].first); | 1254 reason->setString("reason", hitReasons[i].first); |
| 1233 if (hitReasons[i].second) | 1255 if (hitReasons[i].second) |
| 1234 reason->setObject("auxData", std::move(hitReasons[i].second)); | 1256 reason->setObject("auxData", std::move(hitReasons[i].second)); |
| 1235 reasons->pushValue(std::move(reason)); | 1257 reasons->pushValue(std::move(reason)); |
| 1236 } | 1258 } |
| 1237 breakAuxData = protocol::DictionaryValue::create(); | 1259 breakAuxData = protocol::DictionaryValue::create(); |
| 1238 breakAuxData->setArray("reasons", std::move(reasons)); | 1260 breakAuxData->setArray("reasons", std::move(reasons)); |
| 1239 } | 1261 } |
| 1240 | 1262 |
| 1263 if (m_stepIntoAsyncCallback) { | |
| 1264 m_stepIntoAsyncCallback->sendFailure( | |
| 1265 Response::Error("No async task was scheduled.")); | |
|
dgozman
2017/03/03 19:47:06
No async tasks were scheduled before pause.
kozy
2017/03/03 23:14:02
Done.
| |
| 1266 m_stepIntoAsyncCallback.reset(); | |
| 1267 } | |
| 1268 | |
| 1241 std::unique_ptr<Array<CallFrame>> protocolCallFrames; | 1269 std::unique_ptr<Array<CallFrame>> protocolCallFrames; |
| 1242 Response response = currentCallFrames(&protocolCallFrames); | 1270 Response response = currentCallFrames(&protocolCallFrames); |
| 1243 if (!response.isSuccess()) protocolCallFrames = Array<CallFrame>::create(); | 1271 if (!response.isSuccess()) protocolCallFrames = Array<CallFrame>::create(); |
| 1244 m_frontend.paused(std::move(protocolCallFrames), breakReason, | 1272 m_frontend.paused(std::move(protocolCallFrames), breakReason, |
| 1245 std::move(breakAuxData), std::move(hitBreakpointIds), | 1273 std::move(breakAuxData), std::move(hitBreakpointIds), |
| 1246 currentAsyncStackTrace()); | 1274 currentAsyncStackTrace()); |
| 1247 m_scheduledDebuggerStep = NoStep; | 1275 m_scheduledDebuggerStep = NoStep; |
| 1248 m_javaScriptPauseScheduled = false; | 1276 m_javaScriptPauseScheduled = false; |
| 1249 | 1277 |
| 1250 if (!m_continueToLocationBreakpointId.isEmpty()) { | 1278 if (!m_continueToLocationBreakpointId.isEmpty()) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1302 void V8DebuggerAgentImpl::reset() { | 1330 void V8DebuggerAgentImpl::reset() { |
| 1303 if (!enabled()) return; | 1331 if (!enabled()) return; |
| 1304 m_scheduledDebuggerStep = NoStep; | 1332 m_scheduledDebuggerStep = NoStep; |
| 1305 m_blackboxedPositions.clear(); | 1333 m_blackboxedPositions.clear(); |
| 1306 resetBlackboxedStateCache(); | 1334 resetBlackboxedStateCache(); |
| 1307 m_scripts.clear(); | 1335 m_scripts.clear(); |
| 1308 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1336 m_breakpointIdToDebuggerBreakpointIds.clear(); |
| 1309 } | 1337 } |
| 1310 | 1338 |
| 1311 } // namespace v8_inspector | 1339 } // namespace v8_inspector |
| OLD | NEW |