Commit 00e389d2 authored by Johannes Henkel's avatar Johannes Henkel Committed by Commit Bot

[DevTools] V8StackTrace: Add the ability to limit the max async depth...

... when building inspector objects.

This is useful in Chromium, when recording the initiator information
for navigations.

See https://chromium-review.googlesource.com/c/chromium/src/+/1674885

Change-Id: Ib9ddcaf05586ca1f48a31921a20ab11a703ec7b0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1677381Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarAlexei Filippov <alph@chromium.org>
Commit-Queue: Johannes Henkel <johannes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62389}
parent e3793ef5
......@@ -109,6 +109,8 @@ class V8_EXPORT V8StackTrace {
virtual ~V8StackTrace() = default;
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
buildInspectorObject() const = 0;
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
buildInspectorObject(int maxAsyncDepth) const = 0;
virtual std::unique_ptr<StringBuffer> toString() const = 0;
// Safe to pass between threads, drops async chain.
......
......@@ -285,6 +285,12 @@ V8StackTraceImpl::buildInspectorObject() const {
return buildInspectorObjectImpl(nullptr);
}
std::unique_ptr<protocol::Runtime::API::StackTrace>
V8StackTraceImpl::buildInspectorObject(int maxAsyncDepth) const {
return buildInspectorObjectImpl(nullptr,
std::min(maxAsyncDepth, m_maxAsyncDepth));
}
std::unique_ptr<StringBuffer> V8StackTraceImpl::toString() const {
String16Builder stackTrace;
for (size_t i = 0; i < m_frames.size(); ++i) {
......
......@@ -78,6 +78,8 @@ class V8StackTraceImpl : public V8StackTrace {
StringView topFunctionName() const override;
std::unique_ptr<protocol::Runtime::API::StackTrace> buildInspectorObject()
const override;
std::unique_ptr<protocol::Runtime::API::StackTrace> buildInspectorObject(
int maxAsyncDepth) const override;
std::unique_ptr<StringBuffer> toString() const override;
bool isEqualIgnoringTopFrame(V8StackTraceImpl* stackTrace) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment