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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 m_debugger->stepOutOfFunction(m_session->contextGroupId()); | 739 m_debugger->stepOutOfFunction(m_session->contextGroupId()); |
740 return Response::OK(); | 740 return Response::OK(); |
741 } | 741 } |
742 | 742 |
743 void V8DebuggerAgentImpl::scheduleStepIntoAsync( | 743 void V8DebuggerAgentImpl::scheduleStepIntoAsync( |
744 std::unique_ptr<ScheduleStepIntoAsyncCallback> callback) { | 744 std::unique_ptr<ScheduleStepIntoAsyncCallback> callback) { |
745 if (!isPaused()) { | 745 if (!isPaused()) { |
746 callback->sendFailure(Response::Error(kDebuggerNotPaused)); | 746 callback->sendFailure(Response::Error(kDebuggerNotPaused)); |
747 return; | 747 return; |
748 } | 748 } |
749 if (m_stepIntoAsyncCallback) { | 749 m_debugger->scheduleStepIntoAsync(std::move(callback), |
750 m_stepIntoAsyncCallback->sendFailure(Response::Error( | 750 m_session->contextGroupId()); |
751 "Current scheduled step into async was overriden with new one.")); | |
752 } | |
753 m_stepIntoAsyncCallback = std::move(callback); | |
754 } | |
755 | |
756 bool V8DebuggerAgentImpl::shouldBreakInScheduledAsyncTask() { | |
757 if (!m_stepIntoAsyncCallback) return false; | |
758 m_stepIntoAsyncCallback->sendSuccess(); | |
759 m_stepIntoAsyncCallback.reset(); | |
760 return true; | |
761 } | 751 } |
762 | 752 |
763 Response V8DebuggerAgentImpl::setPauseOnExceptions( | 753 Response V8DebuggerAgentImpl::setPauseOnExceptions( |
764 const String16& stringPauseState) { | 754 const String16& stringPauseState) { |
765 if (!enabled()) return Response::Error(kDebuggerNotEnabled); | 755 if (!enabled()) return Response::Error(kDebuggerNotEnabled); |
766 v8::debug::ExceptionBreakState pauseState; | 756 v8::debug::ExceptionBreakState pauseState; |
767 if (stringPauseState == "none") { | 757 if (stringPauseState == "none") { |
768 pauseState = v8::debug::NoBreakOnException; | 758 pauseState = v8::debug::NoBreakOnException; |
769 } else if (stringPauseState == "all") { | 759 } else if (stringPauseState == "all") { |
770 pauseState = v8::debug::BreakOnAnyException; | 760 pauseState = v8::debug::BreakOnAnyException; |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 protocol::DictionaryValue::create(); | 1213 protocol::DictionaryValue::create(); |
1224 reason->setString("reason", hitReasons[i].first); | 1214 reason->setString("reason", hitReasons[i].first); |
1225 if (hitReasons[i].second) | 1215 if (hitReasons[i].second) |
1226 reason->setObject("auxData", std::move(hitReasons[i].second)); | 1216 reason->setObject("auxData", std::move(hitReasons[i].second)); |
1227 reasons->pushValue(std::move(reason)); | 1217 reasons->pushValue(std::move(reason)); |
1228 } | 1218 } |
1229 breakAuxData = protocol::DictionaryValue::create(); | 1219 breakAuxData = protocol::DictionaryValue::create(); |
1230 breakAuxData->setArray("reasons", std::move(reasons)); | 1220 breakAuxData->setArray("reasons", std::move(reasons)); |
1231 } | 1221 } |
1232 | 1222 |
1233 if (m_stepIntoAsyncCallback) { | |
1234 m_stepIntoAsyncCallback->sendFailure( | |
1235 Response::Error("No async tasks were scheduled before pause.")); | |
1236 m_stepIntoAsyncCallback.reset(); | |
1237 } | |
1238 | |
1239 std::unique_ptr<Array<CallFrame>> protocolCallFrames; | 1223 std::unique_ptr<Array<CallFrame>> protocolCallFrames; |
1240 Response response = currentCallFrames(&protocolCallFrames); | 1224 Response response = currentCallFrames(&protocolCallFrames); |
1241 if (!response.isSuccess()) protocolCallFrames = Array<CallFrame>::create(); | 1225 if (!response.isSuccess()) protocolCallFrames = Array<CallFrame>::create(); |
1242 m_frontend.paused(std::move(protocolCallFrames), breakReason, | 1226 m_frontend.paused(std::move(protocolCallFrames), breakReason, |
1243 std::move(breakAuxData), std::move(hitBreakpointIds), | 1227 std::move(breakAuxData), std::move(hitBreakpointIds), |
1244 currentAsyncStackTrace()); | 1228 currentAsyncStackTrace()); |
1245 | 1229 |
1246 if (!m_continueToLocationBreakpointId.isEmpty()) { | 1230 if (!m_continueToLocationBreakpointId.isEmpty()) { |
1247 m_debugger->removeBreakpoint(m_continueToLocationBreakpointId); | 1231 m_debugger->removeBreakpoint(m_continueToLocationBreakpointId); |
1248 m_continueToLocationBreakpointId = ""; | 1232 m_continueToLocationBreakpointId = ""; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 | 1283 |
1300 void V8DebuggerAgentImpl::reset() { | 1284 void V8DebuggerAgentImpl::reset() { |
1301 if (!enabled()) return; | 1285 if (!enabled()) return; |
1302 m_blackboxedPositions.clear(); | 1286 m_blackboxedPositions.clear(); |
1303 resetBlackboxedStateCache(); | 1287 resetBlackboxedStateCache(); |
1304 m_scripts.clear(); | 1288 m_scripts.clear(); |
1305 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1289 m_breakpointIdToDebuggerBreakpointIds.clear(); |
1306 } | 1290 } |
1307 | 1291 |
1308 } // namespace v8_inspector | 1292 } // namespace v8_inspector |
OLD | NEW |