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

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

Issue 2633803002: [inspector] implemented blackboxing inside v8 (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
« 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 1d8c31f866074f966270343d614eafd0885d5a8a..9b2936240bdffd79677ec81d7fcb29e5986e0388 100644
--- a/src/inspector/v8-debugger.cc
+++ b/src/inspector/v8-debugger.cc
@@ -30,6 +30,18 @@ inline v8::Local<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) {
return value ? v8::True(isolate) : v8::False(isolate);
}
+V8DebuggerAgentImpl* agentForScript(V8InspectorImpl* inspector,
+ v8::Local<v8::debug::Script> script) {
+ v8::Local<v8::Value> contextData;
+ if (!script->ContextData().ToLocal(&contextData) || !contextData->IsInt32()) {
+ return nullptr;
+ }
+ int contextId = static_cast<int>(contextData.As<v8::Int32>()->Value());
+ int contextGroupId = inspector->contextGroupId(contextId);
+ if (!contextGroupId) return nullptr;
+ return inspector->enabledDebuggerAgentForGroup(contextGroupId);
+}
+
} // namespace
static bool inLiveEditScope = false;
@@ -68,7 +80,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 +97,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 +255,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 +308,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 +487,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 +509,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) {
@@ -521,15 +520,7 @@ void V8Debugger::v8OOMCallback(void* data) {
void V8Debugger::ScriptCompiled(v8::Local<v8::debug::Script> script,
bool has_compile_error) {
- v8::Local<v8::Value> contextData;
- if (!script->ContextData().ToLocal(&contextData) || !contextData->IsInt32()) {
- return;
- }
- 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);
+ V8DebuggerAgentImpl* agent = agentForScript(m_inspector, script);
if (!agent) return;
if (script->IsWasm()) {
m_wasmTranslation.AddScript(script.As<v8::debug::WasmScript>(), agent);
@@ -562,6 +553,15 @@ void V8Debugger::ExceptionThrown(v8::Local<v8::Context> pausedContext,
v8::Local<v8::Array>(), isPromiseRejection, isUncaught);
}
+bool V8Debugger::IsFunctionBlackboxed(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->isFunctionBlackboxed(String16::fromInteger(script->Id()), start,
+ end);
+}
+
void V8Debugger::PromiseEventOccurred(v8::debug::PromiseDebugActionType type,
int id) {
if (!m_maxAsyncCallStackDepth) return;
« 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