| 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::debug::NoBreakOnException), | 59 m_pauseOnExceptionsState(v8::debug::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::debug::SetDebugEventListener(m_isolate, &V8Debugger::v8DebugEventCallback, | 68 v8::debug::SetDebugEventListener(m_isolate, &V8Debugger::v8DebugEventCallback, |
| 69 v8::External::New(m_isolate, this)); | 69 v8::External::New(m_isolate, this)); |
| 70 m_debuggerContext.Reset(m_isolate, v8::debug::GetDebugContext(m_isolate)); | 70 m_debuggerContext.Reset(m_isolate, v8::debug::GetDebugContext(m_isolate)); |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 DCHECK(scriptMirror->IsObject()); | 580 DCHECK(scriptMirror->IsObject()); |
| 581 v8::Local<v8::Value> scriptWrapper = | 581 v8::Local<v8::Value> scriptWrapper = |
| 582 callInternalGetterFunction(scriptMirror.As<v8::Object>(), "value"); | 582 callInternalGetterFunction(scriptMirror.As<v8::Object>(), "value"); |
| 583 DCHECK(scriptWrapper->IsObject()); | 583 DCHECK(scriptWrapper->IsObject()); |
| 584 v8::Local<v8::debug::Script> script; | 584 v8::Local<v8::debug::Script> script; |
| 585 if (!v8::debug::Script::Wrap(m_isolate, scriptWrapper.As<v8::Object>()) | 585 if (!v8::debug::Script::Wrap(m_isolate, scriptWrapper.As<v8::Object>()) |
| 586 .ToLocal(&script)) { | 586 .ToLocal(&script)) { |
| 587 return; | 587 return; |
| 588 } | 588 } |
| 589 if (script->IsWasm()) { | 589 if (script->IsWasm()) { |
| 590 m_wasmTranslation.AddScript(scriptWrapper.As<v8::Object>()); | 590 m_wasmTranslation.AddScript(script.As<v8::debug::WasmScript>(), agent); |
| 591 } else if (m_ignoreScriptParsedEventsCounter == 0) { | 591 } else if (m_ignoreScriptParsedEventsCounter == 0) { |
| 592 agent->didParseSource( | 592 agent->didParseSource( |
| 593 std::unique_ptr<V8DebuggerScript>( | 593 std::unique_ptr<V8DebuggerScript>( |
| 594 new V8DebuggerScript(m_isolate, script, inLiveEditScope)), | 594 new V8DebuggerScript(m_isolate, script, inLiveEditScope)), |
| 595 event == v8::AfterCompile); | 595 event == v8::AfterCompile); |
| 596 } | 596 } |
| 597 } else if (event == v8::Exception) { | 597 } else if (event == v8::Exception) { |
| 598 v8::Local<v8::Context> context = debuggerContext(); | 598 v8::Local<v8::Context> context = debuggerContext(); |
| 599 v8::Local<v8::Object> eventData = eventDetails.GetEventData(); | 599 v8::Local<v8::Object> eventData = eventDetails.GetEventData(); |
| 600 v8::Local<v8::Value> exception = | 600 v8::Local<v8::Value> exception = |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 | 1003 |
| 1004 size_t stackSize = | 1004 size_t stackSize = |
| 1005 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; | 1005 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; |
| 1006 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 1006 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
| 1007 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 1007 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
| 1008 | 1008 |
| 1009 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 1009 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
| 1010 } | 1010 } |
| 1011 | 1011 |
| 1012 } // namespace v8_inspector | 1012 } // namespace v8_inspector |
| OLD | NEW |