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

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

Issue 2685483002: [debugger] expose side-effect free evaluate to inspector. (Closed)
Patch Set: add inspector test Created 3 years, 10 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
« no previous file with comments | « src/inspector/v8-debugger-agent-impl.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 void V8DebuggerAgentImpl::setPauseOnExceptionsImpl(int pauseState) { 696 void V8DebuggerAgentImpl::setPauseOnExceptionsImpl(int pauseState) {
697 m_debugger->setPauseOnExceptionsState( 697 m_debugger->setPauseOnExceptionsState(
698 static_cast<v8::debug::ExceptionBreakState>(pauseState)); 698 static_cast<v8::debug::ExceptionBreakState>(pauseState));
699 m_state->setInteger(DebuggerAgentState::pauseOnExceptionsState, pauseState); 699 m_state->setInteger(DebuggerAgentState::pauseOnExceptionsState, pauseState);
700 } 700 }
701 701
702 Response V8DebuggerAgentImpl::evaluateOnCallFrame( 702 Response V8DebuggerAgentImpl::evaluateOnCallFrame(
703 const String16& callFrameId, const String16& expression, 703 const String16& callFrameId, const String16& expression,
704 Maybe<String16> objectGroup, Maybe<bool> includeCommandLineAPI, 704 Maybe<String16> objectGroup, Maybe<bool> includeCommandLineAPI,
705 Maybe<bool> silent, Maybe<bool> returnByValue, Maybe<bool> generatePreview, 705 Maybe<bool> silent, Maybe<bool> returnByValue, Maybe<bool> generatePreview,
706 std::unique_ptr<RemoteObject>* result, 706 Maybe<bool> throwOnSideEffect, std::unique_ptr<RemoteObject>* result,
707 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) { 707 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) {
708 if (!isPaused()) return Response::Error(kDebuggerNotPaused); 708 if (!isPaused()) return Response::Error(kDebuggerNotPaused);
709 InjectedScript::CallFrameScope scope(m_inspector, m_session->contextGroupId(), 709 InjectedScript::CallFrameScope scope(m_inspector, m_session->contextGroupId(),
710 callFrameId); 710 callFrameId);
711 Response response = scope.initialize(); 711 Response response = scope.initialize();
712 if (!response.isSuccess()) return response; 712 if (!response.isSuccess()) return response;
713 if (scope.frameOrdinal() >= m_pausedCallFrames.size()) 713 if (scope.frameOrdinal() >= m_pausedCallFrames.size())
714 return Response::Error("Could not find call frame with given id"); 714 return Response::Error("Could not find call frame with given id");
715 715
716 if (includeCommandLineAPI.fromMaybe(false)) scope.installCommandLineAPI(); 716 if (includeCommandLineAPI.fromMaybe(false)) scope.installCommandLineAPI();
717 if (silent.fromMaybe(false)) scope.ignoreExceptionsAndMuteConsole(); 717 if (silent.fromMaybe(false)) scope.ignoreExceptionsAndMuteConsole();
718 718
719 v8::MaybeLocal<v8::Value> maybeResultValue = 719 v8::MaybeLocal<v8::Value> maybeResultValue =
720 m_pausedCallFrames[scope.frameOrdinal()]->evaluate( 720 m_pausedCallFrames[scope.frameOrdinal()]->evaluate(
721 toV8String(m_isolate, expression)); 721 toV8String(m_isolate, expression),
722 throwOnSideEffect.fromMaybe(false));
722 723
723 // Re-initialize after running client's code, as it could have destroyed 724 // Re-initialize after running client's code, as it could have destroyed
724 // context or session. 725 // context or session.
725 response = scope.initialize(); 726 response = scope.initialize();
726 if (!response.isSuccess()) return response; 727 if (!response.isSuccess()) return response;
727 return scope.injectedScript()->wrapEvaluateResult( 728 return scope.injectedScript()->wrapEvaluateResult(
728 maybeResultValue, scope.tryCatch(), objectGroup.fromMaybe(""), 729 maybeResultValue, scope.tryCatch(), objectGroup.fromMaybe(""),
729 returnByValue.fromMaybe(false), generatePreview.fromMaybe(false), result, 730 returnByValue.fromMaybe(false), generatePreview.fromMaybe(false), result,
730 exceptionDetails); 731 exceptionDetails);
731 } 732 }
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 void V8DebuggerAgentImpl::reset() { 1222 void V8DebuggerAgentImpl::reset() {
1222 if (!enabled()) return; 1223 if (!enabled()) return;
1223 m_scheduledDebuggerStep = NoStep; 1224 m_scheduledDebuggerStep = NoStep;
1224 m_blackboxedPositions.clear(); 1225 m_blackboxedPositions.clear();
1225 resetBlackboxedStateCache(); 1226 resetBlackboxedStateCache();
1226 m_scripts.clear(); 1227 m_scripts.clear();
1227 m_breakpointIdToDebuggerBreakpointIds.clear(); 1228 m_breakpointIdToDebuggerBreakpointIds.clear();
1228 } 1229 }
1229 1230
1230 } // namespace v8_inspector 1231 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/v8-debugger-agent-impl.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698