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

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

Issue 2357423002: Improve stack traces for async functions (Closed)
Patch Set: Format Created 4 years, 3 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 e9997126eba10b98348a85b85c74d46ef7d2ad40..abfce7e08a46baf9f7c18177a7b370c6d1edc82d 100644
--- a/src/inspector/v8-debugger.cc
+++ b/src/inspector/v8-debugger.cc
@@ -20,8 +20,10 @@ namespace {
const char stepIntoV8MethodName[] = "stepIntoStatement";
const char stepOutV8MethodName[] = "stepOutOfFunction";
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);
@@ -653,10 +655,14 @@ void V8Debugger::handleV8AsyncTaskEvent(v8::Local<v8::Context> context,
void* ptr = reinterpret_cast<void*>(id * 2 + 1);
if (type == v8AsyncTaskEventEnqueue)
asyncTaskScheduled(name, ptr, false);
+ else if (type == v8AsyncTaskEventEnqueueRecurring)
+ asyncTaskScheduled(name, ptr, true, true);
kozy 2016/09/23 21:49:45 Based on offline discussion on DevTools side: Let'
Dan Ehrenberg 2016/09/23 21:51:25 If you look at patchset 12, you will find skipping
else if (type == v8AsyncTaskEventWillHandle)
asyncTaskStarted(ptr);
else if (type == v8AsyncTaskEventDidHandle)
asyncTaskFinished(ptr);
+ else if (type == v8AsyncTaskEventCancel)
+ asyncTaskCanceled(ptr);
else
UNREACHABLE();
}
@@ -898,13 +904,18 @@ void V8Debugger::asyncTaskScheduled(const StringView& taskName, void* task,
void V8Debugger::asyncTaskScheduled(const String16& taskName, void* task,
bool recurring) {
+ asyncTaskScheduled(taskName, task, recurring, false);
+}
+
+void V8Debugger::asyncTaskScheduled(const String16& taskName, void* task,
+ bool recurring, bool skipInitialFrame) {
if (!m_maxAsyncCallStackDepth) return;
v8::HandleScope scope(m_isolate);
int contextGroupId =
m_isolate->InContext() ? getGroupId(m_isolate->GetCurrentContext()) : 0;
std::unique_ptr<V8StackTraceImpl> chain = V8StackTraceImpl::capture(
this, contextGroupId, V8StackTraceImpl::maxCallStackSizeToCapture,
- taskName);
+ taskName, skipInitialFrame);
if (chain) {
m_asyncTaskStacks[task] = std::move(chain);
if (recurring) m_recurringTasks.insert(task);

Powered by Google App Engine
This is Rietveld 408576698