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

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

Issue 2668763003: [inspector] V8DebuggerAgent cleanup (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « src/inspector/v8-debugger.h ('k') | src/inspector/v8-debugger-agent-impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/v8-debugger.cc
diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc
index aa77769d9db0609ea14698c27619fb4fbc87da6c..9e0c9b4526d973c3bd3d65f9b3056f395116fc57 100644
--- a/src/inspector/v8-debugger.cc
+++ b/src/inspector/v8-debugger.cc
@@ -253,7 +253,7 @@ void V8Debugger::setPauseOnExceptionsState(
}
void V8Debugger::setPauseOnNextStatement(bool pause) {
- if (m_runningNestedMessageLoop) return;
+ if (isPaused()) return;
if (pause)
v8::debug::DebugBreak(m_isolate);
else
@@ -474,11 +474,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()) {
@@ -494,24 +494,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;
}
+ // 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();
@@ -836,8 +835,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 =
« no previous file with comments | « src/inspector/v8-debugger.h ('k') | src/inspector/v8-debugger-agent-impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698