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

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

Issue 2816043006: [inspector] avoid cloning of async call chains (Closed)
Patch Set: lines and columns in stack string should be 1-based Created 3 years, 8 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/inspector/v8-stack-trace-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 16 matching lines...) Expand all
27 #include "include/v8-inspector.h" 27 #include "include/v8-inspector.h"
28 28
29 namespace v8_inspector { 29 namespace v8_inspector {
30 30
31 using protocol::Array; 31 using protocol::Array;
32 using protocol::Maybe; 32 using protocol::Maybe;
33 using protocol::Debugger::BreakpointId; 33 using protocol::Debugger::BreakpointId;
34 using protocol::Debugger::CallFrame; 34 using protocol::Debugger::CallFrame;
35 using protocol::Runtime::ExceptionDetails; 35 using protocol::Runtime::ExceptionDetails;
36 using protocol::Runtime::ScriptId; 36 using protocol::Runtime::ScriptId;
37 using protocol::Runtime::StackTrace;
38 using protocol::Runtime::RemoteObject; 37 using protocol::Runtime::RemoteObject;
39 38
40 namespace DebuggerAgentState { 39 namespace DebuggerAgentState {
41 static const char javaScriptBreakpoints[] = "javaScriptBreakopints"; 40 static const char javaScriptBreakpoints[] = "javaScriptBreakopints";
42 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState"; 41 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState";
43 static const char asyncCallStackDepth[] = "asyncCallStackDepth"; 42 static const char asyncCallStackDepth[] = "asyncCallStackDepth";
44 static const char blackboxPattern[] = "blackboxPattern"; 43 static const char blackboxPattern[] = "blackboxPattern";
45 static const char debuggerEnabled[] = "debuggerEnabled"; 44 static const char debuggerEnabled[] = "debuggerEnabled";
46 static const char skipAllPauses[] = "skipAllPauses"; 45 static const char skipAllPauses[] = "skipAllPauses";
47 46
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 optionalIsRegex.fromMaybe(false)); 590 optionalIsRegex.fromMaybe(false));
592 *results = protocol::Array<protocol::Debugger::SearchMatch>::create(); 591 *results = protocol::Array<protocol::Debugger::SearchMatch>::create();
593 for (size_t i = 0; i < matches.size(); ++i) 592 for (size_t i = 0; i < matches.size(); ++i)
594 (*results)->addItem(std::move(matches[i])); 593 (*results)->addItem(std::move(matches[i]));
595 return Response::OK(); 594 return Response::OK();
596 } 595 }
597 596
598 Response V8DebuggerAgentImpl::setScriptSource( 597 Response V8DebuggerAgentImpl::setScriptSource(
599 const String16& scriptId, const String16& newContent, Maybe<bool> dryRun, 598 const String16& scriptId, const String16& newContent, Maybe<bool> dryRun,
600 Maybe<protocol::Array<protocol::Debugger::CallFrame>>* newCallFrames, 599 Maybe<protocol::Array<protocol::Debugger::CallFrame>>* newCallFrames,
601 Maybe<bool>* stackChanged, Maybe<StackTrace>* asyncStackTrace, 600 Maybe<bool>* stackChanged,
601 Maybe<protocol::Runtime::StackTrace>* asyncStackTrace,
602 Maybe<protocol::Runtime::ExceptionDetails>* optOutCompileError) { 602 Maybe<protocol::Runtime::ExceptionDetails>* optOutCompileError) {
603 if (!enabled()) return Response::Error(kDebuggerNotEnabled); 603 if (!enabled()) return Response::Error(kDebuggerNotEnabled);
604 604
605 ScriptsMap::iterator it = m_scripts.find(scriptId); 605 ScriptsMap::iterator it = m_scripts.find(scriptId);
606 if (it == m_scripts.end()) { 606 if (it == m_scripts.end()) {
607 return Response::Error("No script with given id found"); 607 return Response::Error("No script with given id found");
608 } 608 }
609 if (it->second->isModule()) { 609 if (it->second->isModule()) {
610 // TODO(kozyatinskiy): LiveEdit should support ES6 module 610 // TODO(kozyatinskiy): LiveEdit should support ES6 module
611 return Response::Error("Editing module's script is not supported."); 611 return Response::Error("Editing module's script is not supported.");
(...skipping 12 matching lines...) Expand all
624 response = currentCallFrames(&callFrames); 624 response = currentCallFrames(&callFrames);
625 if (!response.isSuccess()) return response; 625 if (!response.isSuccess()) return response;
626 *newCallFrames = std::move(callFrames); 626 *newCallFrames = std::move(callFrames);
627 *asyncStackTrace = currentAsyncStackTrace(); 627 *asyncStackTrace = currentAsyncStackTrace();
628 return Response::OK(); 628 return Response::OK();
629 } 629 }
630 630
631 Response V8DebuggerAgentImpl::restartFrame( 631 Response V8DebuggerAgentImpl::restartFrame(
632 const String16& callFrameId, 632 const String16& callFrameId,
633 std::unique_ptr<Array<CallFrame>>* newCallFrames, 633 std::unique_ptr<Array<CallFrame>>* newCallFrames,
634 Maybe<StackTrace>* asyncStackTrace) { 634 Maybe<protocol::Runtime::StackTrace>* asyncStackTrace) {
635 if (!isPaused()) return Response::Error(kDebuggerNotPaused); 635 if (!isPaused()) return Response::Error(kDebuggerNotPaused);
636 InjectedScript::CallFrameScope scope(m_inspector, m_session->contextGroupId(), 636 InjectedScript::CallFrameScope scope(m_inspector, m_session->contextGroupId(),
637 callFrameId); 637 callFrameId);
638 Response response = scope.initialize(); 638 Response response = scope.initialize();
639 if (!response.isSuccess()) return response; 639 if (!response.isSuccess()) return response;
640 if (scope.frameOrdinal() >= m_pausedCallFrames.size()) 640 if (scope.frameOrdinal() >= m_pausedCallFrames.size())
641 return Response::Error("Could not find call frame with given id"); 641 return Response::Error("Could not find call frame with given id");
642 642
643 v8::Local<v8::Value> resultValue; 643 v8::Local<v8::Value> resultValue;
644 v8::Local<v8::Boolean> result; 644 v8::Local<v8::Boolean> result;
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 Response response = toProtocolValue(debuggerContext, objects, &protocolValue); 1021 Response response = toProtocolValue(debuggerContext, objects, &protocolValue);
1022 if (!response.isSuccess()) return response; 1022 if (!response.isSuccess()) return response;
1023 protocol::ErrorSupport errorSupport; 1023 protocol::ErrorSupport errorSupport;
1024 *result = Array<CallFrame>::fromValue(protocolValue.get(), &errorSupport); 1024 *result = Array<CallFrame>::fromValue(protocolValue.get(), &errorSupport);
1025 if (!*result) return Response::Error(errorSupport.errors()); 1025 if (!*result) return Response::Error(errorSupport.errors());
1026 TranslateWasmStackTraceLocations(result->get(), 1026 TranslateWasmStackTraceLocations(result->get(),
1027 m_debugger->wasmTranslation()); 1027 m_debugger->wasmTranslation());
1028 return Response::OK(); 1028 return Response::OK();
1029 } 1029 }
1030 1030
1031 std::unique_ptr<StackTrace> V8DebuggerAgentImpl::currentAsyncStackTrace() { 1031 std::unique_ptr<protocol::Runtime::StackTrace>
1032 if (!isPaused()) return nullptr; 1032 V8DebuggerAgentImpl::currentAsyncStackTrace() {
1033 return V8StackTraceImpl::buildInspectorObjectForTail(m_debugger); 1033 std::shared_ptr<AsyncStackTrace> asyncParent =
1034 m_debugger->currentAsyncParent();
1035 if (!asyncParent) return nullptr;
1036 return asyncParent->buildInspectorObject(
1037 m_debugger->currentAsyncCreation().get(),
1038 m_debugger->maxAsyncCallChainDepth() - 1);
1034 } 1039 }
1035 1040
1036 bool V8DebuggerAgentImpl::isPaused() const { return m_debugger->isPaused(); } 1041 bool V8DebuggerAgentImpl::isPaused() const { return m_debugger->isPaused(); }
1037 1042
1038 void V8DebuggerAgentImpl::didParseSource( 1043 void V8DebuggerAgentImpl::didParseSource(
1039 std::unique_ptr<V8DebuggerScript> script, bool success) { 1044 std::unique_ptr<V8DebuggerScript> script, bool success) {
1040 v8::HandleScope handles(m_isolate); 1045 v8::HandleScope handles(m_isolate);
1041 String16 scriptSource = script->source(); 1046 String16 scriptSource = script->source();
1042 if (!success) script->setSourceURL(findSourceURL(scriptSource, false)); 1047 if (!success) script->setSourceURL(findSourceURL(scriptSource, false));
1043 if (!success) 1048 if (!success)
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 1286
1282 void V8DebuggerAgentImpl::reset() { 1287 void V8DebuggerAgentImpl::reset() {
1283 if (!enabled()) return; 1288 if (!enabled()) return;
1284 m_blackboxedPositions.clear(); 1289 m_blackboxedPositions.clear();
1285 resetBlackboxedStateCache(); 1290 resetBlackboxedStateCache();
1286 m_scripts.clear(); 1291 m_scripts.clear();
1287 m_breakpointIdToDebuggerBreakpointIds.clear(); 1292 m_breakpointIdToDebuggerBreakpointIds.clear();
1288 } 1293 }
1289 1294
1290 } // namespace v8_inspector 1295 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/v8-debugger-agent-impl.h ('k') | src/inspector/v8-stack-trace-impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698