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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 V8Debugger::V8Debugger(v8::Isolate* isolate, V8InspectorImpl* inspector) | 50 V8Debugger::V8Debugger(v8::Isolate* isolate, V8InspectorImpl* inspector) |
51 : m_isolate(isolate), | 51 : m_isolate(isolate), |
52 m_inspector(inspector), | 52 m_inspector(inspector), |
53 m_lastContextId(0), | 53 m_lastContextId(0), |
54 m_enableCount(0), | 54 m_enableCount(0), |
55 m_breakpointsActivated(true), | 55 m_breakpointsActivated(true), |
56 m_runningNestedMessageLoop(false), | 56 m_runningNestedMessageLoop(false), |
57 m_ignoreScriptParsedEventsCounter(0), | 57 m_ignoreScriptParsedEventsCounter(0), |
58 m_maxAsyncCallStackDepth(0), | 58 m_maxAsyncCallStackDepth(0), |
59 m_pauseOnExceptionsState(v8::DebugInterface::NoBreakOnException), | 59 m_pauseOnExceptionsState(v8::DebugInterface::NoBreakOnException), |
60 m_wasmTranslation(isolate, this) {} | 60 m_wasmTranslation(isolate) {} |
61 | 61 |
62 V8Debugger::~V8Debugger() {} | 62 V8Debugger::~V8Debugger() {} |
63 | 63 |
64 void V8Debugger::enable() { | 64 void V8Debugger::enable() { |
65 if (m_enableCount++) return; | 65 if (m_enableCount++) return; |
66 DCHECK(!enabled()); | 66 DCHECK(!enabled()); |
67 v8::HandleScope scope(m_isolate); | 67 v8::HandleScope scope(m_isolate); |
68 v8::DebugInterface::SetDebugEventListener(m_isolate, | 68 v8::DebugInterface::SetDebugEventListener(m_isolate, |
69 &V8Debugger::v8DebugEventCallback, | 69 &V8Debugger::v8DebugEventCallback, |
70 v8::External::New(m_isolate, this)); | 70 v8::External::New(m_isolate, this)); |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 v8::Local<v8::Value> scriptWrapper = | 586 v8::Local<v8::Value> scriptWrapper = |
587 callInternalGetterFunction(scriptMirror.As<v8::Object>(), "value"); | 587 callInternalGetterFunction(scriptMirror.As<v8::Object>(), "value"); |
588 DCHECK(scriptWrapper->IsObject()); | 588 DCHECK(scriptWrapper->IsObject()); |
589 v8::Local<v8::DebugInterface::Script> script; | 589 v8::Local<v8::DebugInterface::Script> script; |
590 if (!v8::DebugInterface::Script::Wrap(m_isolate, | 590 if (!v8::DebugInterface::Script::Wrap(m_isolate, |
591 scriptWrapper.As<v8::Object>()) | 591 scriptWrapper.As<v8::Object>()) |
592 .ToLocal(&script)) { | 592 .ToLocal(&script)) { |
593 return; | 593 return; |
594 } | 594 } |
595 if (script->IsWasm()) { | 595 if (script->IsWasm()) { |
596 m_wasmTranslation.AddScript(scriptWrapper.As<v8::Object>()); | 596 m_wasmTranslation.AddScript(script.As<v8::DebugInterface::WasmScript>(), |
| 597 agent); |
597 } else if (m_ignoreScriptParsedEventsCounter == 0) { | 598 } else if (m_ignoreScriptParsedEventsCounter == 0) { |
598 agent->didParseSource( | 599 agent->didParseSource( |
599 std::unique_ptr<V8DebuggerScript>( | 600 std::unique_ptr<V8DebuggerScript>( |
600 new V8DebuggerScript(m_isolate, script, inLiveEditScope)), | 601 new V8DebuggerScript(m_isolate, script, inLiveEditScope)), |
601 event == v8::AfterCompile); | 602 event == v8::AfterCompile); |
602 } | 603 } |
603 } else if (event == v8::Exception) { | 604 } else if (event == v8::Exception) { |
604 v8::Local<v8::Context> context = debuggerContext(); | 605 v8::Local<v8::Context> context = debuggerContext(); |
605 v8::Local<v8::Object> eventData = eventDetails.GetEventData(); | 606 v8::Local<v8::Object> eventData = eventDetails.GetEventData(); |
606 v8::Local<v8::Value> exception = | 607 v8::Local<v8::Value> exception = |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 | 1011 |
1011 size_t stackSize = | 1012 size_t stackSize = |
1012 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; | 1013 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; |
1013 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 1014 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
1014 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 1015 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
1015 | 1016 |
1016 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 1017 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
1017 } | 1018 } |
1018 | 1019 |
1019 } // namespace v8_inspector | 1020 } // namespace v8_inspector |
OLD | NEW |