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

Unified Diff: src/inspector/v8-stack-trace-impl.cc

Issue 2844753002: [inspector] better stacks for promises (Closed)
Patch Set: ac Created 3 years, 8 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-stack-trace-impl.cc
diff --git a/src/inspector/v8-stack-trace-impl.cc b/src/inspector/v8-stack-trace-impl.cc
index 663b0706ead7a80918f7a04c652aececf6ffadbe..cb509bd8e9d67614aa3a8429f2b1500eff407ed5 100644
--- a/src/inspector/v8-stack-trace-impl.cc
+++ b/src/inspector/v8-stack-trace-impl.cc
@@ -63,8 +63,14 @@ void calculateAsyncChain(V8Debugger* debugger, int contextGroupId,
std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectCommon(
const std::vector<std::shared_ptr<StackFrame>>& frames,
+ const String16& description,
const std::shared_ptr<AsyncStackTrace>& asyncParent,
const std::shared_ptr<AsyncStackTrace>& asyncCreation, int maxAsyncDepth) {
+ if (asyncParent && frames.empty() &&
+ description == asyncParent->description() && !asyncCreation) {
+ return asyncParent->buildInspectorObject(nullptr, maxAsyncDepth);
+ }
+
std::unique_ptr<protocol::Array<protocol::Runtime::CallFrame>>
inspectorFrames = protocol::Array<protocol::Runtime::CallFrame>::create();
for (size_t i = 0; i < frames.size(); i++) {
@@ -74,6 +80,7 @@ std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectCommon(
protocol::Runtime::StackTrace::create()
.setCallFrames(std::move(inspectorFrames))
.build();
+ if (!description.isEmpty()) stackTrace->setDescription(description);
if (asyncParent && maxAsyncDepth > 0) {
stackTrace->setParent(asyncParent->buildInspectorObject(asyncCreation.get(),
maxAsyncDepth - 1));
@@ -206,7 +213,7 @@ StringView V8StackTraceImpl::topFunctionName() const {
std::unique_ptr<protocol::Runtime::StackTrace>
V8StackTraceImpl::buildInspectorObjectImpl() const {
- return buildInspectorObjectCommon(m_frames, m_asyncParent.lock(),
+ return buildInspectorObjectCommon(m_frames, String16(), m_asyncParent.lock(),
m_asyncCreation.lock(), m_maxAsyncDepth);
}
@@ -292,9 +299,8 @@ std::unique_ptr<protocol::Runtime::StackTrace>
AsyncStackTrace::buildInspectorObject(AsyncStackTrace* asyncCreation,
int maxAsyncDepth) const {
std::unique_ptr<protocol::Runtime::StackTrace> stackTrace =
- buildInspectorObjectCommon(m_frames, m_asyncParent.lock(),
+ buildInspectorObjectCommon(m_frames, m_description, m_asyncParent.lock(),
m_asyncCreation.lock(), maxAsyncDepth);
- if (!m_description.isEmpty()) stackTrace->setDescription(m_description);
if (asyncCreation && !asyncCreation->isEmpty()) {
stackTrace->setPromiseCreationFrame(
asyncCreation->m_frames[0]->buildInspectorObject());
@@ -304,6 +310,8 @@ AsyncStackTrace::buildInspectorObject(AsyncStackTrace* asyncCreation,
int AsyncStackTrace::contextGroupId() const { return m_contextGroupId; }
+const String16& AsyncStackTrace::description() const { return m_description; }
+
std::weak_ptr<AsyncStackTrace> AsyncStackTrace::parent() const {
return m_asyncParent;
}
« no previous file with comments | « src/inspector/v8-stack-trace-impl.h ('k') | test/inspector/debugger/collect-old-async-call-chains-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698