| Index: src/inspector/v8-debugger.cc
|
| diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc
|
| index 1d8c31f866074f966270343d614eafd0885d5a8a..0f8eaf640f32582219e7a98f5aa4eb393c3d9216 100644
|
| --- a/src/inspector/v8-debugger.cc
|
| +++ b/src/inspector/v8-debugger.cc
|
| @@ -68,7 +68,7 @@ void V8Debugger::enable() {
|
| if (m_enableCount++) return;
|
| DCHECK(!enabled());
|
| v8::HandleScope scope(m_isolate);
|
| - v8::debug::SetDebugEventListener(m_isolate, this);
|
| + v8::debug::SetDebugDelegate(m_isolate, this);
|
| v8::debug::SetOutOfMemoryCallback(m_isolate, &V8Debugger::v8OOMCallback,
|
| this);
|
| m_debuggerContext.Reset(m_isolate, v8::debug::GetDebugContext(m_isolate));
|
| @@ -85,7 +85,7 @@ void V8Debugger::disable() {
|
| m_debuggerContext.Reset();
|
| allAsyncTasksCanceled();
|
| m_wasmTranslation.Clear();
|
| - v8::debug::SetDebugEventListener(m_isolate, nullptr);
|
| + v8::debug::SetDebugDelegate(m_isolate, nullptr);
|
| v8::debug::SetOutOfMemoryCallback(m_isolate, nullptr, nullptr);
|
| m_isolate->RestoreOriginalHeapLimit();
|
| }
|
| @@ -243,7 +243,7 @@ void V8Debugger::setPauseOnNextStatement(bool pause) {
|
|
|
| bool V8Debugger::canBreakProgram() {
|
| if (!m_breakpointsActivated) return false;
|
| - return m_isolate->InContext();
|
| + return v8::debug::HasNonBlackboxedFrameOnStack(m_isolate);
|
| }
|
|
|
| void V8Debugger::breakProgram() {
|
| @@ -296,11 +296,6 @@ void V8Debugger::stepOutOfFunction() {
|
| continueProgram();
|
| }
|
|
|
| -void V8Debugger::clearStepping() {
|
| - DCHECK(enabled());
|
| - v8::debug::ClearStepping(m_isolate);
|
| -}
|
| -
|
| Response V8Debugger::setScriptSource(
|
| const String16& sourceID, v8::Local<v8::String> newSource, bool dryRun,
|
| Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails,
|
| @@ -480,10 +475,10 @@ void V8Debugger::handleProgramBreak(v8::Local<v8::Context> pausedContext,
|
|
|
| m_pausedContext = pausedContext;
|
| m_executionState = executionState;
|
| - V8DebuggerAgentImpl::SkipPauseRequest result =
|
| + bool shouldPause =
|
| agent->didPause(pausedContext, exception, breakpointIds,
|
| isPromiseRejection, isUncaught, m_scheduledOOMBreak);
|
| - if (result == V8DebuggerAgentImpl::RequestNoSkip) {
|
| + if (shouldPause) {
|
| m_runningNestedMessageLoop = true;
|
| int groupId = m_inspector->contextGroupId(pausedContext);
|
| DCHECK(groupId);
|
| @@ -502,14 +497,6 @@ void V8Debugger::handleProgramBreak(v8::Local<v8::Context> pausedContext,
|
| m_scheduledOOMBreak = false;
|
| m_pausedContext.Clear();
|
| m_executionState.Clear();
|
| -
|
| - if (result == V8DebuggerAgentImpl::RequestStepFrame) {
|
| - v8::debug::PrepareStep(m_isolate, v8::debug::StepFrame);
|
| - } else if (result == V8DebuggerAgentImpl::RequestStepInto) {
|
| - v8::debug::PrepareStep(m_isolate, v8::debug::StepIn);
|
| - } else if (result == V8DebuggerAgentImpl::RequestStepOut) {
|
| - v8::debug::PrepareStep(m_isolate, v8::debug::StepOut);
|
| - }
|
| }
|
|
|
| void V8Debugger::v8OOMCallback(void* data) {
|
| @@ -519,17 +506,23 @@ void V8Debugger::v8OOMCallback(void* data) {
|
| thisPtr->setPauseOnNextStatement(true);
|
| }
|
|
|
| -void V8Debugger::ScriptCompiled(v8::Local<v8::debug::Script> script,
|
| - bool has_compile_error) {
|
| +namespace {
|
| +V8DebuggerAgentImpl* agentForScript(V8InspectorImpl* inspector,
|
| + v8::Local<v8::debug::Script> script) {
|
| v8::Local<v8::Value> contextData;
|
| if (!script->ContextData().ToLocal(&contextData) || !contextData->IsInt32()) {
|
| - return;
|
| + return nullptr;
|
| }
|
| int contextId = static_cast<int>(contextData.As<v8::Int32>()->Value());
|
| - int contextGroupId = m_inspector->contextGroupId(contextId);
|
| - if (!contextGroupId) return;
|
| - V8DebuggerAgentImpl* agent =
|
| - m_inspector->enabledDebuggerAgentForGroup(contextGroupId);
|
| + int contextGroupId = inspector->contextGroupId(contextId);
|
| + if (!contextGroupId) return nullptr;
|
| + return inspector->enabledDebuggerAgentForGroup(contextGroupId);
|
| +}
|
| +} // namespace
|
| +
|
| +void V8Debugger::ScriptCompiled(v8::Local<v8::debug::Script> script,
|
| + bool has_compile_error) {
|
| + V8DebuggerAgentImpl* agent = agentForScript(m_inspector, script);
|
| if (!agent) return;
|
| if (script->IsWasm()) {
|
| m_wasmTranslation.AddScript(script.As<v8::debug::WasmScript>(), agent);
|
| @@ -562,6 +555,14 @@ void V8Debugger::ExceptionThrown(v8::Local<v8::Context> pausedContext,
|
| v8::Local<v8::Array>(), isPromiseRejection, isUncaught);
|
| }
|
|
|
| +bool V8Debugger::IsBlackboxed(v8::Local<v8::debug::Script> script,
|
| + const v8::debug::Location& start,
|
| + const v8::debug::Location& end) {
|
| + V8DebuggerAgentImpl* agent = agentForScript(m_inspector, script);
|
| + if (!agent) return false;
|
| + return agent->isBlackboxed(String16::fromInteger(script->Id()), start, end);
|
| +}
|
| +
|
| void V8Debugger::PromiseEventOccurred(v8::debug::PromiseDebugActionType type,
|
| int id) {
|
| if (!m_maxAsyncCallStackDepth) return;
|
|
|