Index: src/inspector/v8-debugger.cc |
diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc |
index 3d3f18189440609a561c57157cae8a681db0db1c..12af81fa20969e8ef18a04a2cfbd953085ae582a 100644 |
--- a/src/inspector/v8-debugger.cc |
+++ b/src/inspector/v8-debugger.cc |
@@ -20,11 +20,6 @@ |
namespace v8_inspector { |
namespace { |
-static const char v8AsyncTaskEventEnqueue[] = "enqueue"; |
-static const char v8AsyncTaskEventEnqueueRecurring[] = "enqueueRecurring"; |
-static const char v8AsyncTaskEventWillHandle[] = "willHandle"; |
-static const char v8AsyncTaskEventDidHandle[] = "didHandle"; |
-static const char v8AsyncTaskEventCancel[] = "cancel"; |
inline v8::Local<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) { |
return value ? v8::True(isolate) : v8::False(isolate); |
@@ -523,27 +518,24 @@ v8::Local<v8::Value> V8Debugger::callInternalGetterFunction( |
void V8Debugger::handleV8DebugEvent( |
const v8::debug::EventDetails& eventDetails) { |
if (!enabled()) return; |
+ v8::HandleScope scope(m_isolate); |
v8::DebugEvent event = eventDetails.GetEvent(); |
if (event != v8::AsyncTaskEvent && event != v8::Break && |
event != v8::Exception && event != v8::AfterCompile && |
event != v8::CompileError) |
return; |
- v8::Local<v8::Context> eventContext = eventDetails.GetEventContext(); |
- DCHECK(!eventContext.IsEmpty()); |
- |
if (event == v8::AsyncTaskEvent) { |
- v8::HandleScope scope(m_isolate); |
- handleV8AsyncTaskEvent(eventContext, eventDetails.GetExecutionState(), |
- eventDetails.GetEventData()); |
+ handleV8AsyncTaskEvent(eventDetails.GetEventData()); |
return; |
} |
+ v8::Local<v8::Context> eventContext = eventDetails.GetEventContext(); |
+ DCHECK(!eventContext.IsEmpty()); |
V8DebuggerAgentImpl* agent = m_inspector->enabledDebuggerAgentForGroup( |
m_inspector->contextGroupId(eventContext)); |
if (!agent) return; |
- v8::HandleScope scope(m_isolate); |
if (event == v8::AfterCompile || event == v8::CompileError) { |
v8::Context::Scope contextScope(debuggerContext()); |
// Determine if the script is a wasm script. |
@@ -589,32 +581,32 @@ void V8Debugger::handleV8DebugEvent( |
} |
} |
-void V8Debugger::handleV8AsyncTaskEvent(v8::Local<v8::Context> context, |
- v8::Local<v8::Object> executionState, |
- v8::Local<v8::Object> eventData) { |
+void V8Debugger::handleV8AsyncTaskEvent(v8::Local<v8::Object> eventData) { |
if (!m_maxAsyncCallStackDepth) return; |
- String16 type = toProtocolStringWithTypeCheck( |
- callInternalGetterFunction(eventData, "type")); |
+ v8::debug::AsyncTaskEventType type = |
+ static_cast<v8::debug::AsyncTaskEventType>( |
+ callInternalGetterFunction(eventData, "type") |
+ ->ToInteger(m_isolate->GetCurrentContext()) |
+ .ToLocalChecked() |
+ ->Value()); |
String16 name = toProtocolStringWithTypeCheck( |
callInternalGetterFunction(eventData, "name")); |
int id = static_cast<int>(callInternalGetterFunction(eventData, "id") |
- ->ToInteger(context) |
+ ->ToInteger(m_isolate->GetCurrentContext()) |
.ToLocalChecked() |
->Value()); |
// Async task events from Promises are given misaligned pointers to prevent |
// from overlapping with other Blink task identifiers. There is a single |
// namespace of such ids, managed by src/js/promise.js. |
void* ptr = reinterpret_cast<void*>(id * 2 + 1); |
- if (type == v8AsyncTaskEventEnqueue) |
- asyncTaskScheduled(name, ptr, false); |
- else if (type == v8AsyncTaskEventEnqueueRecurring) |
+ if (type == v8::debug::EnqueueRecurring) |
asyncTaskScheduled(name, ptr, true); |
- else if (type == v8AsyncTaskEventWillHandle) |
+ else if (type == v8::debug::WillHandle) |
asyncTaskStarted(ptr); |
- else if (type == v8AsyncTaskEventDidHandle) |
+ else if (type == v8::debug::DidHandle) |
asyncTaskFinished(ptr); |
- else if (type == v8AsyncTaskEventCancel) |
+ else if (type == v8::debug::Cancel) |
asyncTaskCanceled(ptr); |
else |
UNREACHABLE(); |