Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Unified Diff: src/inspector/v8-debugger.cc

Issue 2668763003: [inspector] V8DebuggerAgent cleanup (Closed)
Patch Set: reverted semantic change - only cleanup Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/inspector/v8-debugger.cc
diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc
index f4980e2f87e1de3d4916b2c526dd7c2c0d107b3b..214026cff2ee155b380673ac0e92dc20a2c7b4ed 100644
--- a/src/inspector/v8-debugger.cc
+++ b/src/inspector/v8-debugger.cc
@@ -104,6 +104,7 @@ void V8Debugger::disable() {
v8::debug::SetDebugDelegate(m_isolate, nullptr);
v8::debug::SetOutOfMemoryCallback(m_isolate, nullptr, nullptr);
m_isolate->RestoreOriginalHeapLimit();
+ m_skipAllPauses = false;
dgozman 2017/02/02 17:18:29 This should be per-agent. Similar to asyncStackDep
kozy 2017/02/02 18:31:56 Done.
}
bool V8Debugger::enabled() const { return !m_debuggerScript.IsEmpty(); }
@@ -251,6 +252,7 @@ void V8Debugger::setPauseOnExceptionsState(
void V8Debugger::setPauseOnNextStatement(bool pause) {
if (m_runningNestedMessageLoop) return;
+ if (m_skipAllPauses) return;
if (pause)
v8::debug::DebugBreak(m_isolate);
else
@@ -472,6 +474,7 @@ void V8Debugger::handleProgramBreak(v8::Local<v8::Context> pausedContext,
bool isPromiseRejection, bool isUncaught) {
// Don't allow nested breaks.
if (m_runningNestedMessageLoop) return;
+ if (m_skipAllPauses && !m_scheduledOOMBreak) return;
V8DebuggerAgentImpl* agent = m_inspector->enabledDebuggerAgentForGroup(
m_inspector->contextGroupId(pausedContext));
@@ -491,24 +494,24 @@ void V8Debugger::handleProgramBreak(v8::Local<v8::Context> pausedContext,
m_pausedContext = pausedContext;
m_executionState = executionState;
- bool shouldPause =
- agent->didPause(pausedContext, exception, breakpointIds,
- isPromiseRejection, isUncaught, m_scheduledOOMBreak);
- if (shouldPause) {
- m_runningNestedMessageLoop = true;
- int groupId = m_inspector->contextGroupId(pausedContext);
- DCHECK(groupId);
+ agent->didPause(InspectedContext::contextId(pausedContext), exception,
+ breakpointIds, isPromiseRejection, isUncaught,
+ m_scheduledOOMBreak);
+ m_runningNestedMessageLoop = true;
+ {
v8::Context::Scope scope(pausedContext);
v8::Local<v8::Context> context = m_isolate->GetCurrentContext();
CHECK(!context.IsEmpty() &&
context != v8::debug::GetDebugContext(m_isolate));
+ int groupId = m_inspector->contextGroupId(pausedContext);
+ DCHECK(groupId);
m_inspector->client()->runMessageLoopOnPause(groupId);
- // The agent may have been removed in the nested loop.
- agent = m_inspector->enabledDebuggerAgentForGroup(
- m_inspector->contextGroupId(pausedContext));
- if (agent) agent->didContinue();
- m_runningNestedMessageLoop = false;
}
+ m_runningNestedMessageLoop = false;
+ // The agent may have been removed in the nested loop.
+ agent = m_inspector->enabledDebuggerAgentForGroup(
dgozman 2017/02/02 17:18:30 Let's reuse groupId from above.
kozy 2017/02/02 18:31:56 Done.
+ m_inspector->contextGroupId(pausedContext));
+ if (agent) agent->didContinue();
if (m_scheduledOOMBreak) m_isolate->RestoreOriginalHeapLimit();
m_scheduledOOMBreak = false;
m_pausedContext.Clear();

Powered by Google App Engine
This is Rietveld 408576698