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 2905543004: [inspector] Prepare some methods in V8InspectorImpl to multiple sessions (Closed)
Patch Set: rebased Created 3 years, 6 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.cc ('k') | src/inspector/v8-inspector-impl.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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 *newCallFrames = std::move(callFrames); 622 *newCallFrames = std::move(callFrames);
623 *asyncStackTrace = currentAsyncStackTrace(); 623 *asyncStackTrace = currentAsyncStackTrace();
624 return Response::OK(); 624 return Response::OK();
625 } 625 }
626 626
627 Response V8DebuggerAgentImpl::restartFrame( 627 Response V8DebuggerAgentImpl::restartFrame(
628 const String16& callFrameId, 628 const String16& callFrameId,
629 std::unique_ptr<Array<CallFrame>>* newCallFrames, 629 std::unique_ptr<Array<CallFrame>>* newCallFrames,
630 Maybe<protocol::Runtime::StackTrace>* asyncStackTrace) { 630 Maybe<protocol::Runtime::StackTrace>* asyncStackTrace) {
631 if (!isPaused()) return Response::Error(kDebuggerNotPaused); 631 if (!isPaused()) return Response::Error(kDebuggerNotPaused);
632 InjectedScript::CallFrameScope scope(m_inspector, m_session->contextGroupId(), 632 InjectedScript::CallFrameScope scope(m_session, callFrameId);
633 callFrameId);
634 Response response = scope.initialize(); 633 Response response = scope.initialize();
635 if (!response.isSuccess()) return response; 634 if (!response.isSuccess()) return response;
636 if (scope.frameOrdinal() >= m_pausedCallFrames.size()) 635 if (scope.frameOrdinal() >= m_pausedCallFrames.size())
637 return Response::Error("Could not find call frame with given id"); 636 return Response::Error("Could not find call frame with given id");
638 637
639 v8::Local<v8::Value> resultValue; 638 v8::Local<v8::Value> resultValue;
640 v8::Local<v8::Boolean> result; 639 v8::Local<v8::Boolean> result;
641 if (!m_pausedCallFrames[scope.frameOrdinal()]->restart().ToLocal( 640 if (!m_pausedCallFrames[scope.frameOrdinal()]->restart().ToLocal(
642 &resultValue) || 641 &resultValue) ||
643 scope.tryCatch().HasCaught() || 642 scope.tryCatch().HasCaught() ||
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 m_state->setInteger(DebuggerAgentState::pauseOnExceptionsState, pauseState); 769 m_state->setInteger(DebuggerAgentState::pauseOnExceptionsState, pauseState);
771 } 770 }
772 771
773 Response V8DebuggerAgentImpl::evaluateOnCallFrame( 772 Response V8DebuggerAgentImpl::evaluateOnCallFrame(
774 const String16& callFrameId, const String16& expression, 773 const String16& callFrameId, const String16& expression,
775 Maybe<String16> objectGroup, Maybe<bool> includeCommandLineAPI, 774 Maybe<String16> objectGroup, Maybe<bool> includeCommandLineAPI,
776 Maybe<bool> silent, Maybe<bool> returnByValue, Maybe<bool> generatePreview, 775 Maybe<bool> silent, Maybe<bool> returnByValue, Maybe<bool> generatePreview,
777 Maybe<bool> throwOnSideEffect, std::unique_ptr<RemoteObject>* result, 776 Maybe<bool> throwOnSideEffect, std::unique_ptr<RemoteObject>* result,
778 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) { 777 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) {
779 if (!isPaused()) return Response::Error(kDebuggerNotPaused); 778 if (!isPaused()) return Response::Error(kDebuggerNotPaused);
780 InjectedScript::CallFrameScope scope(m_inspector, m_session->contextGroupId(), 779 InjectedScript::CallFrameScope scope(m_session, callFrameId);
781 callFrameId);
782 Response response = scope.initialize(); 780 Response response = scope.initialize();
783 if (!response.isSuccess()) return response; 781 if (!response.isSuccess()) return response;
784 if (scope.frameOrdinal() >= m_pausedCallFrames.size()) 782 if (scope.frameOrdinal() >= m_pausedCallFrames.size())
785 return Response::Error("Could not find call frame with given id"); 783 return Response::Error("Could not find call frame with given id");
786 784
787 if (includeCommandLineAPI.fromMaybe(false)) scope.installCommandLineAPI(); 785 if (includeCommandLineAPI.fromMaybe(false)) scope.installCommandLineAPI();
788 if (silent.fromMaybe(false)) scope.ignoreExceptionsAndMuteConsole(); 786 if (silent.fromMaybe(false)) scope.ignoreExceptionsAndMuteConsole();
789 787
790 v8::MaybeLocal<v8::Value> maybeResultValue = 788 v8::MaybeLocal<v8::Value> maybeResultValue =
791 m_pausedCallFrames[scope.frameOrdinal()]->evaluate( 789 m_pausedCallFrames[scope.frameOrdinal()]->evaluate(
792 toV8String(m_isolate, expression), 790 toV8String(m_isolate, expression),
793 throwOnSideEffect.fromMaybe(false)); 791 throwOnSideEffect.fromMaybe(false));
794 792
795 // Re-initialize after running client's code, as it could have destroyed 793 // Re-initialize after running client's code, as it could have destroyed
796 // context or session. 794 // context or session.
797 response = scope.initialize(); 795 response = scope.initialize();
798 if (!response.isSuccess()) return response; 796 if (!response.isSuccess()) return response;
799 return scope.injectedScript()->wrapEvaluateResult( 797 return scope.injectedScript()->wrapEvaluateResult(
800 maybeResultValue, scope.tryCatch(), objectGroup.fromMaybe(""), 798 maybeResultValue, scope.tryCatch(), objectGroup.fromMaybe(""),
801 returnByValue.fromMaybe(false), generatePreview.fromMaybe(false), result, 799 returnByValue.fromMaybe(false), generatePreview.fromMaybe(false), result,
802 exceptionDetails); 800 exceptionDetails);
803 } 801 }
804 802
805 Response V8DebuggerAgentImpl::setVariableValue( 803 Response V8DebuggerAgentImpl::setVariableValue(
806 int scopeNumber, const String16& variableName, 804 int scopeNumber, const String16& variableName,
807 std::unique_ptr<protocol::Runtime::CallArgument> newValueArgument, 805 std::unique_ptr<protocol::Runtime::CallArgument> newValueArgument,
808 const String16& callFrameId) { 806 const String16& callFrameId) {
809 if (!enabled()) return Response::Error(kDebuggerNotEnabled); 807 if (!enabled()) return Response::Error(kDebuggerNotEnabled);
810 if (!isPaused()) return Response::Error(kDebuggerNotPaused); 808 if (!isPaused()) return Response::Error(kDebuggerNotPaused);
811 InjectedScript::CallFrameScope scope(m_inspector, m_session->contextGroupId(), 809 InjectedScript::CallFrameScope scope(m_session, callFrameId);
812 callFrameId);
813 Response response = scope.initialize(); 810 Response response = scope.initialize();
814 if (!response.isSuccess()) return response; 811 if (!response.isSuccess()) return response;
815 v8::Local<v8::Value> newValue; 812 v8::Local<v8::Value> newValue;
816 response = scope.injectedScript()->resolveCallArgument(newValueArgument.get(), 813 response = scope.injectedScript()->resolveCallArgument(newValueArgument.get(),
817 &newValue); 814 &newValue);
818 if (!response.isSuccess()) return response; 815 if (!response.isSuccess()) return response;
819 816
820 if (scope.frameOrdinal() >= m_pausedCallFrames.size()) 817 if (scope.frameOrdinal() >= m_pausedCallFrames.size())
821 return Response::Error("Could not find call frame with given id"); 818 return Response::Error("Could not find call frame with given id");
822 v8::MaybeLocal<v8::Value> result = 819 v8::MaybeLocal<v8::Value> result =
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 1274
1278 void V8DebuggerAgentImpl::reset() { 1275 void V8DebuggerAgentImpl::reset() {
1279 if (!enabled()) return; 1276 if (!enabled()) return;
1280 m_blackboxedPositions.clear(); 1277 m_blackboxedPositions.clear();
1281 resetBlackboxedStateCache(); 1278 resetBlackboxedStateCache();
1282 m_scripts.clear(); 1279 m_scripts.clear();
1283 m_breakpointIdToDebuggerBreakpointIds.clear(); 1280 m_breakpointIdToDebuggerBreakpointIds.clear();
1284 } 1281 }
1285 1282
1286 } // namespace v8_inspector 1283 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/v8-debugger.cc ('k') | src/inspector/v8-inspector-impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698