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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 v8::PersistentValueVector<v8::debug::Script> scripts(m_isolate); | 120 v8::PersistentValueVector<v8::debug::Script> scripts(m_isolate); |
121 v8::debug::GetLoadedScripts(m_isolate, scripts); | 121 v8::debug::GetLoadedScripts(m_isolate, scripts); |
122 String16 contextPrefix = String16::fromInteger(contextGroupId) + ","; | 122 String16 contextPrefix = String16::fromInteger(contextGroupId) + ","; |
123 for (size_t i = 0; i < scripts.Size(); ++i) { | 123 for (size_t i = 0; i < scripts.Size(); ++i) { |
124 v8::Local<v8::debug::Script> script = scripts.Get(i); | 124 v8::Local<v8::debug::Script> script = scripts.Get(i); |
125 if (!script->WasCompiled()) continue; | 125 if (!script->WasCompiled()) continue; |
126 v8::Local<v8::String> v8ContextData; | 126 v8::Local<v8::String> v8ContextData; |
127 if (!script->ContextData().ToLocal(&v8ContextData)) continue; | 127 if (!script->ContextData().ToLocal(&v8ContextData)) continue; |
128 String16 contextData = toProtocolString(v8ContextData); | 128 String16 contextData = toProtocolString(v8ContextData); |
129 if (contextData.find(contextPrefix) != 0) continue; | 129 if (contextData.find(contextPrefix) != 0) continue; |
130 result.push_back(std::unique_ptr<V8DebuggerScript>( | 130 result.push_back(V8DebuggerScript::Create(m_isolate, script, false)); |
131 new V8DebuggerScript(m_isolate, script, false))); | |
132 } | 131 } |
133 } | 132 } |
134 | 133 |
135 String16 V8Debugger::setBreakpoint(const ScriptBreakpoint& breakpoint, | 134 String16 V8Debugger::setBreakpoint(const ScriptBreakpoint& breakpoint, |
136 int* actualLineNumber, | 135 int* actualLineNumber, |
137 int* actualColumnNumber) { | 136 int* actualColumnNumber) { |
138 v8::HandleScope scope(m_isolate); | 137 v8::HandleScope scope(m_isolate); |
139 v8::Local<v8::Context> context = debuggerContext(); | 138 v8::Local<v8::Context> context = debuggerContext(); |
140 v8::Context::Scope contextScope(context); | 139 v8::Context::Scope contextScope(context); |
141 | 140 |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 DCHECK(scriptWrapper->IsObject()); | 582 DCHECK(scriptWrapper->IsObject()); |
584 v8::Local<v8::debug::Script> script; | 583 v8::Local<v8::debug::Script> script; |
585 if (!v8::debug::Script::Wrap(m_isolate, scriptWrapper.As<v8::Object>()) | 584 if (!v8::debug::Script::Wrap(m_isolate, scriptWrapper.As<v8::Object>()) |
586 .ToLocal(&script)) { | 585 .ToLocal(&script)) { |
587 return; | 586 return; |
588 } | 587 } |
589 if (script->IsWasm()) { | 588 if (script->IsWasm()) { |
590 m_wasmTranslation.AddScript(script.As<v8::debug::WasmScript>(), agent); | 589 m_wasmTranslation.AddScript(script.As<v8::debug::WasmScript>(), agent); |
591 } else if (m_ignoreScriptParsedEventsCounter == 0) { | 590 } else if (m_ignoreScriptParsedEventsCounter == 0) { |
592 agent->didParseSource( | 591 agent->didParseSource( |
593 std::unique_ptr<V8DebuggerScript>( | 592 V8DebuggerScript::Create(m_isolate, script, inLiveEditScope), |
594 new V8DebuggerScript(m_isolate, script, inLiveEditScope)), | |
595 event == v8::AfterCompile); | 593 event == v8::AfterCompile); |
596 } | 594 } |
597 } else if (event == v8::Exception) { | 595 } else if (event == v8::Exception) { |
598 v8::Local<v8::Context> context = debuggerContext(); | 596 v8::Local<v8::Context> context = debuggerContext(); |
599 v8::Local<v8::Object> eventData = eventDetails.GetEventData(); | 597 v8::Local<v8::Object> eventData = eventDetails.GetEventData(); |
600 v8::Local<v8::Value> exception = | 598 v8::Local<v8::Value> exception = |
601 callInternalGetterFunction(eventData, "exception"); | 599 callInternalGetterFunction(eventData, "exception"); |
602 v8::Local<v8::Value> promise = | 600 v8::Local<v8::Value> promise = |
603 callInternalGetterFunction(eventData, "promise"); | 601 callInternalGetterFunction(eventData, "promise"); |
604 bool isPromiseRejection = !promise.IsEmpty() && promise->IsObject(); | 602 bool isPromiseRejection = !promise.IsEmpty() && promise->IsObject(); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 | 1001 |
1004 size_t stackSize = | 1002 size_t stackSize = |
1005 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; | 1003 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; |
1006 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 1004 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
1007 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 1005 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
1008 | 1006 |
1009 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 1007 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
1010 } | 1008 } |
1011 | 1009 |
1012 } // namespace v8_inspector | 1010 } // namespace v8_inspector |
OLD | NEW |