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

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

Issue 2685483002: [debugger] expose side-effect free evaluate to inspector. (Closed)
Patch Set: tag as experimental 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
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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 void V8DebuggerAgentImpl::setPauseOnExceptionsImpl(int pauseState) { 684 void V8DebuggerAgentImpl::setPauseOnExceptionsImpl(int pauseState) {
685 m_debugger->setPauseOnExceptionsState( 685 m_debugger->setPauseOnExceptionsState(
686 static_cast<v8::debug::ExceptionBreakState>(pauseState)); 686 static_cast<v8::debug::ExceptionBreakState>(pauseState));
687 m_state->setInteger(DebuggerAgentState::pauseOnExceptionsState, pauseState); 687 m_state->setInteger(DebuggerAgentState::pauseOnExceptionsState, pauseState);
688 } 688 }
689 689
690 Response V8DebuggerAgentImpl::evaluateOnCallFrame( 690 Response V8DebuggerAgentImpl::evaluateOnCallFrame(
691 const String16& callFrameId, const String16& expression, 691 const String16& callFrameId, const String16& expression,
692 Maybe<String16> objectGroup, Maybe<bool> includeCommandLineAPI, 692 Maybe<String16> objectGroup, Maybe<bool> includeCommandLineAPI,
693 Maybe<bool> silent, Maybe<bool> returnByValue, Maybe<bool> generatePreview, 693 Maybe<bool> silent, Maybe<bool> returnByValue, Maybe<bool> generatePreview,
694 std::unique_ptr<RemoteObject>* result, 694 Maybe<bool> throwOnSideEffect, std::unique_ptr<RemoteObject>* result,
695 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) { 695 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) {
696 if (!isPaused()) return Response::Error(kDebuggerNotPaused); 696 if (!isPaused()) return Response::Error(kDebuggerNotPaused);
697 InjectedScript::CallFrameScope scope(m_inspector, m_session->contextGroupId(), 697 InjectedScript::CallFrameScope scope(m_inspector, m_session->contextGroupId(),
698 callFrameId); 698 callFrameId);
699 Response response = scope.initialize(); 699 Response response = scope.initialize();
700 if (!response.isSuccess()) return response; 700 if (!response.isSuccess()) return response;
701 if (scope.frameOrdinal() >= m_pausedCallFrames.size()) 701 if (scope.frameOrdinal() >= m_pausedCallFrames.size())
702 return Response::Error("Could not find call frame with given id"); 702 return Response::Error("Could not find call frame with given id");
703 703
704 if (includeCommandLineAPI.fromMaybe(false)) scope.installCommandLineAPI(); 704 if (includeCommandLineAPI.fromMaybe(false)) scope.installCommandLineAPI();
705 if (silent.fromMaybe(false)) scope.ignoreExceptionsAndMuteConsole(); 705 if (silent.fromMaybe(false)) scope.ignoreExceptionsAndMuteConsole();
706 706
707 v8::MaybeLocal<v8::Value> maybeResultValue = 707 v8::MaybeLocal<v8::Value> maybeResultValue =
708 m_pausedCallFrames[scope.frameOrdinal()]->evaluate( 708 m_pausedCallFrames[scope.frameOrdinal()]->evaluate(
709 toV8String(m_isolate, expression)); 709 toV8String(m_isolate, expression),
710 throwOnSideEffect.fromMaybe(false));
710 711
711 // Re-initialize after running client's code, as it could have destroyed 712 // Re-initialize after running client's code, as it could have destroyed
712 // context or session. 713 // context or session.
713 response = scope.initialize(); 714 response = scope.initialize();
714 if (!response.isSuccess()) return response; 715 if (!response.isSuccess()) return response;
715 return scope.injectedScript()->wrapEvaluateResult( 716 return scope.injectedScript()->wrapEvaluateResult(
716 maybeResultValue, scope.tryCatch(), objectGroup.fromMaybe(""), 717 maybeResultValue, scope.tryCatch(), objectGroup.fromMaybe(""),
717 returnByValue.fromMaybe(false), generatePreview.fromMaybe(false), result, 718 returnByValue.fromMaybe(false), generatePreview.fromMaybe(false), result,
718 exceptionDetails); 719 exceptionDetails);
719 } 720 }
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 void V8DebuggerAgentImpl::reset() { 1178 void V8DebuggerAgentImpl::reset() {
1178 if (!enabled()) return; 1179 if (!enabled()) return;
1179 m_scheduledDebuggerStep = NoStep; 1180 m_scheduledDebuggerStep = NoStep;
1180 m_blackboxedPositions.clear(); 1181 m_blackboxedPositions.clear();
1181 resetBlackboxedStateCache(); 1182 resetBlackboxedStateCache();
1182 m_scripts.clear(); 1183 m_scripts.clear();
1183 m_breakpointIdToDebuggerBreakpointIds.clear(); 1184 m_breakpointIdToDebuggerBreakpointIds.clear();
1184 } 1185 }
1185 1186
1186 } // namespace v8_inspector 1187 } // namespace v8_inspector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698