Chromium Code Reviews| Index: src/inspector/v8-debugger.cc |
| diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc |
| index 1d8c31f866074f966270343d614eafd0885d5a8a..2015c682eee052d475d1981821ba5eb6bd4abd72 100644 |
| --- a/src/inspector/v8-debugger.cc |
| +++ b/src/inspector/v8-debugger.cc |
| @@ -71,6 +71,8 @@ void V8Debugger::enable() { |
| v8::debug::SetDebugEventListener(m_isolate, this); |
| v8::debug::SetOutOfMemoryCallback(m_isolate, &V8Debugger::v8OOMCallback, |
| this); |
| + v8::debug::SetIsBlackboxedCallback(m_isolate, |
| + &V8Debugger::v8IsBlackboxedCallback, this); |
| m_debuggerContext.Reset(m_isolate, v8::debug::GetDebugContext(m_isolate)); |
| v8::debug::ChangeBreakOnException(m_isolate, v8::debug::NoBreakOnException); |
| m_pauseOnExceptionsState = v8::debug::NoBreakOnException; |
| @@ -86,6 +88,7 @@ void V8Debugger::disable() { |
| allAsyncTasksCanceled(); |
| m_wasmTranslation.Clear(); |
| v8::debug::SetDebugEventListener(m_isolate, nullptr); |
| + v8::debug::SetIsBlackboxedCallback(m_isolate, nullptr, nullptr); |
| v8::debug::SetOutOfMemoryCallback(m_isolate, nullptr, nullptr); |
| m_isolate->RestoreOriginalHeapLimit(); |
| } |
| @@ -243,7 +246,11 @@ void V8Debugger::setPauseOnNextStatement(bool pause) { |
| bool V8Debugger::canBreakProgram() { |
| if (!m_breakpointsActivated) return false; |
| - return m_isolate->InContext(); |
| + return v8::debug::HasUserFrameOnStack(m_isolate); |
| +} |
| + |
| +bool V8Debugger::hasUserFrameOnStack() { |
| + return v8::debug::HasUserFrameOnStack(m_isolate); |
| } |
| void V8Debugger::breakProgram() { |
| @@ -296,11 +303,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 +482,10 @@ void V8Debugger::handleProgramBreak(v8::Local<v8::Context> pausedContext, |
| m_pausedContext = pausedContext; |
| m_executionState = executionState; |
| - V8DebuggerAgentImpl::SkipPauseRequest result = |
| + bool result = |
|
dgozman
2017/01/19 21:49:14
result -> shouldPause
kozy
2017/01/20 02:32:37
Done.
|
| agent->didPause(pausedContext, exception, breakpointIds, |
| isPromiseRejection, isUncaught, m_scheduledOOMBreak); |
| - if (result == V8DebuggerAgentImpl::RequestNoSkip) { |
| + if (result) { |
| m_runningNestedMessageLoop = true; |
| int groupId = m_inspector->contextGroupId(pausedContext); |
| DCHECK(groupId); |
| @@ -502,14 +504,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) { |
| @@ -594,6 +588,21 @@ void V8Debugger::PromiseEventOccurred(v8::debug::PromiseDebugActionType type, |
| } |
| } |
| +bool V8Debugger::v8IsBlackboxedCallback(v8::Local<v8::debug::Script> script, |
| + const v8::debug::Location& start, |
| + const v8::debug::Location& end, |
| + void* data) { |
| + V8Debugger* debugger = static_cast<V8Debugger*>(data); |
| + v8::Local<v8::Value> contextData; |
| + if (!script->ContextData().ToLocal(&contextData) || !contextData->IsInt32()) |
| + return false; |
| + int contextId = static_cast<int>(contextData.As<v8::Int32>()->Value()); |
| + V8DebuggerAgentImpl* agent = |
| + debugger->m_inspector->enabledDebuggerAgentForGroup(contextId); |
|
dgozman
2017/01/19 21:49:15
again?
kozy
2017/01/20 02:32:37
extracted to not repeat again.
|
| + if (!agent) return false; |
| + return agent->isBlackboxed(String16::fromInteger(script->Id()), start, end); |
|
dgozman
2017/01/19 21:49:15
Converting to string here is unfortunate.
kozy
2017/01/20 02:32:37
Acknowledged.
|
| +} |
| + |
| V8StackTraceImpl* V8Debugger::currentAsyncCallChain() { |
| if (!m_currentStacks.size()) return nullptr; |
| return m_currentStacks.back().get(); |