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

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

Issue 2668763003: [inspector] V8DebuggerAgent cleanup (Closed)
Patch Set: addressed comments 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..88290bb8699fc1ed45649373d78ea3b4da7c9413 100644
--- a/src/inspector/v8-debugger.cc
+++ b/src/inspector/v8-debugger.cc
@@ -250,7 +250,7 @@ void V8Debugger::setPauseOnExceptionsState(
}
void V8Debugger::setPauseOnNextStatement(bool pause) {
- if (m_runningNestedMessageLoop) return;
+ if (isPaused()) return;
if (pause)
v8::debug::DebugBreak(m_isolate);
else
@@ -471,11 +471,11 @@ void V8Debugger::handleProgramBreak(v8::Local<v8::Context> pausedContext,
v8::Local<v8::Array> hitBreakpointNumbers,
bool isPromiseRejection, bool isUncaught) {
// Don't allow nested breaks.
- if (m_runningNestedMessageLoop) return;
+ if (isPaused()) return;
V8DebuggerAgentImpl* agent = m_inspector->enabledDebuggerAgentForGroup(
m_inspector->contextGroupId(pausedContext));
- if (!agent) return;
+ if (!agent || (agent->skipAllPauses() && !m_scheduledOOMBreak)) return;
std::vector<String16> breakpointIds;
if (!hitBreakpointNumbers.IsEmpty()) {
@@ -491,24 +491,23 @@ 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);
+ m_runningNestedMessageLoop = true;
+ agent->didPause(InspectedContext::contextId(pausedContext), exception,
+ breakpointIds, isPromiseRejection, isUncaught,
+ m_scheduledOOMBreak);
+ int groupId = m_inspector->contextGroupId(pausedContext);
+ DCHECK(groupId);
+ {
v8::Context::Scope scope(pausedContext);
v8::Local<v8::Context> context = m_isolate->GetCurrentContext();
CHECK(!context.IsEmpty() &&
context != v8::debug::GetDebugContext(m_isolate));
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(groupId);
+ if (agent) agent->didContinue();
if (m_scheduledOOMBreak) m_isolate->RestoreOriginalHeapLimit();
m_scheduledOOMBreak = false;
m_pausedContext.Clear();
@@ -833,8 +832,6 @@ v8::Local<v8::Value> V8Debugger::functionLocation(
return location;
}
-bool V8Debugger::isPaused() { return !m_pausedContext.IsEmpty(); }
-
std::unique_ptr<V8StackTraceImpl> V8Debugger::createStackTrace(
v8::Local<v8::StackTrace> stackTrace) {
int contextGroupId =

Powered by Google App Engine
This is Rietveld 408576698