OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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.h" | 5 #include "src/inspector/v8-debugger.h" |
6 | 6 |
7 #include "src/inspector/debugger-script.h" | 7 #include "src/inspector/debugger-script.h" |
8 #include "src/inspector/protocol/Protocol.h" | 8 #include "src/inspector/protocol/Protocol.h" |
9 #include "src/inspector/script-breakpoint.h" | 9 #include "src/inspector/script-breakpoint.h" |
10 #include "src/inspector/string-util.h" | 10 #include "src/inspector/string-util.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 v8::PersistentValueVector<v8::DebugInterface::Script> scripts(m_isolate); | 123 v8::PersistentValueVector<v8::DebugInterface::Script> scripts(m_isolate); |
124 v8::DebugInterface::GetLoadedScripts(m_isolate, scripts); | 124 v8::DebugInterface::GetLoadedScripts(m_isolate, scripts); |
125 String16 contextPrefix = String16::fromInteger(contextGroupId) + ","; | 125 String16 contextPrefix = String16::fromInteger(contextGroupId) + ","; |
126 for (size_t i = 0; i < scripts.Size(); ++i) { | 126 for (size_t i = 0; i < scripts.Size(); ++i) { |
127 v8::Local<v8::DebugInterface::Script> script = scripts.Get(i); | 127 v8::Local<v8::DebugInterface::Script> script = scripts.Get(i); |
128 if (!script->WasCompiled()) continue; | 128 if (!script->WasCompiled()) continue; |
129 v8::Local<v8::String> v8ContextData; | 129 v8::Local<v8::String> v8ContextData; |
130 if (!script->ContextData().ToLocal(&v8ContextData)) continue; | 130 if (!script->ContextData().ToLocal(&v8ContextData)) continue; |
131 String16 contextData = toProtocolString(v8ContextData); | 131 String16 contextData = toProtocolString(v8ContextData); |
132 if (contextData.find(contextPrefix) != 0) continue; | 132 if (contextData.find(contextPrefix) != 0) continue; |
133 result.push_back(std::unique_ptr<V8DebuggerScript>( | 133 result.push_back(V8DebuggerScript::Create(m_isolate, script, false)); |
134 new V8DebuggerScript(m_isolate, script, false))); | |
135 } | 134 } |
136 } | 135 } |
137 | 136 |
138 String16 V8Debugger::setBreakpoint(const ScriptBreakpoint& breakpoint, | 137 String16 V8Debugger::setBreakpoint(const ScriptBreakpoint& breakpoint, |
139 int* actualLineNumber, | 138 int* actualLineNumber, |
140 int* actualColumnNumber) { | 139 int* actualColumnNumber) { |
141 v8::HandleScope scope(m_isolate); | 140 v8::HandleScope scope(m_isolate); |
142 v8::Local<v8::Context> context = debuggerContext(); | 141 v8::Local<v8::Context> context = debuggerContext(); |
143 v8::Context::Scope contextScope(context); | 142 v8::Context::Scope contextScope(context); |
144 | 143 |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 v8::Local<v8::DebugInterface::Script> script; | 588 v8::Local<v8::DebugInterface::Script> script; |
590 if (!v8::DebugInterface::Script::Wrap(m_isolate, | 589 if (!v8::DebugInterface::Script::Wrap(m_isolate, |
591 scriptWrapper.As<v8::Object>()) | 590 scriptWrapper.As<v8::Object>()) |
592 .ToLocal(&script)) { | 591 .ToLocal(&script)) { |
593 return; | 592 return; |
594 } | 593 } |
595 if (script->IsWasm()) { | 594 if (script->IsWasm()) { |
596 m_wasmTranslation.AddScript(scriptWrapper.As<v8::Object>()); | 595 m_wasmTranslation.AddScript(scriptWrapper.As<v8::Object>()); |
597 } else if (m_ignoreScriptParsedEventsCounter == 0) { | 596 } else if (m_ignoreScriptParsedEventsCounter == 0) { |
598 agent->didParseSource( | 597 agent->didParseSource( |
599 std::unique_ptr<V8DebuggerScript>( | 598 V8DebuggerScript::Create(m_isolate, script, inLiveEditScope), |
600 new V8DebuggerScript(m_isolate, script, inLiveEditScope)), | |
601 event == v8::AfterCompile); | 599 event == v8::AfterCompile); |
602 } | 600 } |
603 } else if (event == v8::Exception) { | 601 } else if (event == v8::Exception) { |
604 v8::Local<v8::Context> context = debuggerContext(); | 602 v8::Local<v8::Context> context = debuggerContext(); |
605 v8::Local<v8::Object> eventData = eventDetails.GetEventData(); | 603 v8::Local<v8::Object> eventData = eventDetails.GetEventData(); |
606 v8::Local<v8::Value> exception = | 604 v8::Local<v8::Value> exception = |
607 callInternalGetterFunction(eventData, "exception"); | 605 callInternalGetterFunction(eventData, "exception"); |
608 v8::Local<v8::Value> promise = | 606 v8::Local<v8::Value> promise = |
609 callInternalGetterFunction(eventData, "promise"); | 607 callInternalGetterFunction(eventData, "promise"); |
610 bool isPromiseRejection = !promise.IsEmpty() && promise->IsObject(); | 608 bool isPromiseRejection = !promise.IsEmpty() && promise->IsObject(); |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 | 1008 |
1011 size_t stackSize = | 1009 size_t stackSize = |
1012 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; | 1010 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; |
1013 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 1011 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
1014 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 1012 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
1015 | 1013 |
1016 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 1014 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
1017 } | 1015 } |
1018 | 1016 |
1019 } // namespace v8_inspector | 1017 } // namespace v8_inspector |
OLD | NEW |