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

Side by Side Diff: src/inspector/v8-debugger-agent-impl.cc

Issue 2723273002: [inspector] introduced Debugger.scheduleStepIntoAsync (Closed)
Patch Set: override current scheduled step into async if presented Created 3 years, 9 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 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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 744
745 Response V8DebuggerAgentImpl::stepOut() { 745 Response V8DebuggerAgentImpl::stepOut() {
746 if (!isPaused()) return Response::Error(kDebuggerNotPaused); 746 if (!isPaused()) return Response::Error(kDebuggerNotPaused);
747 m_scheduledDebuggerStep = StepOut; 747 m_scheduledDebuggerStep = StepOut;
748 m_recursionLevelForStepOut = 1; 748 m_recursionLevelForStepOut = 1;
749 m_session->releaseObjectGroup(kBacktraceObjectGroup); 749 m_session->releaseObjectGroup(kBacktraceObjectGroup);
750 m_debugger->stepOutOfFunction(); 750 m_debugger->stepOutOfFunction();
751 return Response::OK(); 751 return Response::OK();
752 } 752 }
753 753
754 void V8DebuggerAgentImpl::scheduleStepIntoAsync(
755 std::unique_ptr<ScheduleStepIntoAsyncCallback> callback) {
756 if (!isPaused()) {
757 callback->sendFailure(Response::Error(kDebuggerNotPaused));
758 return;
759 }
760 if (m_stepIntoAsyncCallback) {
761 m_stepIntoAsyncCallback->sendFailure(Response::Error(
762 "Current scheduled step into async was overriden with new one."));
763 }
764 m_stepIntoAsyncCallback = std::move(callback);
765 return;
dgozman 2017/03/01 23:03:57 return; return; just to be sure ;-)
kozy 2017/03/02 00:53:03 Done.
766 }
767
768 void V8DebuggerAgentImpl::stepIntoAsyncWasScheduled() {
769 DCHECK(m_stepIntoAsyncCallback);
770 m_stepIntoAsyncCallback->sendSuccess();
771 m_stepIntoAsyncCallback.reset();
772
773 m_scheduledDebuggerStep = NoStep;
774 v8::debug::ClearStepping(m_isolate);
775 }
776
754 Response V8DebuggerAgentImpl::setPauseOnExceptions( 777 Response V8DebuggerAgentImpl::setPauseOnExceptions(
755 const String16& stringPauseState) { 778 const String16& stringPauseState) {
756 if (!enabled()) return Response::Error(kDebuggerNotEnabled); 779 if (!enabled()) return Response::Error(kDebuggerNotEnabled);
757 v8::debug::ExceptionBreakState pauseState; 780 v8::debug::ExceptionBreakState pauseState;
758 if (stringPauseState == "none") { 781 if (stringPauseState == "none") {
759 pauseState = v8::debug::NoBreakOnException; 782 pauseState = v8::debug::NoBreakOnException;
760 } else if (stringPauseState == "all") { 783 } else if (stringPauseState == "all") {
761 pauseState = v8::debug::BreakOnAnyException; 784 pauseState = v8::debug::BreakOnAnyException;
762 } else if (stringPauseState == "uncaught") { 785 } else if (stringPauseState == "uncaught") {
763 pauseState = v8::debug::BreakOnUncaughtException; 786 pauseState = v8::debug::BreakOnUncaughtException;
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 protocol::DictionaryValue::create(); 1257 protocol::DictionaryValue::create();
1235 reason->setString("reason", hitReasons[i].first); 1258 reason->setString("reason", hitReasons[i].first);
1236 if (hitReasons[i].second) 1259 if (hitReasons[i].second)
1237 reason->setObject("auxData", std::move(hitReasons[i].second)); 1260 reason->setObject("auxData", std::move(hitReasons[i].second));
1238 reasons->pushValue(std::move(reason)); 1261 reasons->pushValue(std::move(reason));
1239 } 1262 }
1240 breakAuxData = protocol::DictionaryValue::create(); 1263 breakAuxData = protocol::DictionaryValue::create();
1241 breakAuxData->setArray("reasons", std::move(reasons)); 1264 breakAuxData->setArray("reasons", std::move(reasons));
1242 } 1265 }
1243 1266
1267 if (m_stepIntoAsyncCallback) {
1268 m_stepIntoAsyncCallback->sendFailure(
1269 Response::Error("No async task was scheduled."));
1270 m_stepIntoAsyncCallback.reset();
1271 }
1272
1244 std::unique_ptr<Array<CallFrame>> protocolCallFrames; 1273 std::unique_ptr<Array<CallFrame>> protocolCallFrames;
1245 Response response = currentCallFrames(&protocolCallFrames); 1274 Response response = currentCallFrames(&protocolCallFrames);
1246 if (!response.isSuccess()) protocolCallFrames = Array<CallFrame>::create(); 1275 if (!response.isSuccess()) protocolCallFrames = Array<CallFrame>::create();
1247 m_frontend.paused(std::move(protocolCallFrames), breakReason, 1276 m_frontend.paused(std::move(protocolCallFrames), breakReason,
1248 std::move(breakAuxData), std::move(hitBreakpointIds), 1277 std::move(breakAuxData), std::move(hitBreakpointIds),
1249 currentAsyncStackTrace()); 1278 currentAsyncStackTrace());
1250 m_scheduledDebuggerStep = NoStep; 1279 m_scheduledDebuggerStep = NoStep;
1251 m_javaScriptPauseScheduled = false; 1280 m_javaScriptPauseScheduled = false;
1252 1281
1253 if (!m_continueToLocationBreakpointId.isEmpty()) { 1282 if (!m_continueToLocationBreakpointId.isEmpty()) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 void V8DebuggerAgentImpl::reset() { 1334 void V8DebuggerAgentImpl::reset() {
1306 if (!enabled()) return; 1335 if (!enabled()) return;
1307 m_scheduledDebuggerStep = NoStep; 1336 m_scheduledDebuggerStep = NoStep;
1308 m_blackboxedPositions.clear(); 1337 m_blackboxedPositions.clear();
1309 resetBlackboxedStateCache(); 1338 resetBlackboxedStateCache();
1310 m_scripts.clear(); 1339 m_scripts.clear();
1311 m_breakpointIdToDebuggerBreakpointIds.clear(); 1340 m_breakpointIdToDebuggerBreakpointIds.clear();
1312 } 1341 }
1313 1342
1314 } // namespace v8_inspector 1343 } // namespace v8_inspector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698