Chromium Code Reviews| 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..705a9de93d962d9ab2a676990424add1b2138b68 100644 |
| --- a/src/inspector/v8-stack-trace-impl.cc |
| +++ b/src/inspector/v8-stack-trace-impl.cc |
| @@ -63,6 +63,7 @@ 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) { |
| std::unique_ptr<protocol::Array<protocol::Runtime::CallFrame>> |
| @@ -74,7 +75,10 @@ std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectCommon( |
| protocol::Runtime::StackTrace::create() |
| .setCallFrames(std::move(inspectorFrames)) |
| .build(); |
| - if (asyncParent && maxAsyncDepth > 0) { |
| + if (!description.isEmpty()) stackTrace->setDescription(description); |
| + if (asyncParent && maxAsyncDepth > 0 && |
| + (asyncParent->description() != description || !asyncParent->isEmpty() || |
|
dgozman
2017/04/27 22:37:22
We should not return here, but just skip the paren
kozy
2017/04/28 16:13:30
Done.
|
| + asyncCreation.get())) { |
| stackTrace->setParent(asyncParent->buildInspectorObject(asyncCreation.get(), |
| maxAsyncDepth - 1)); |
| } |
| @@ -206,7 +210,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 +296,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 +307,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; |
| } |