Commit 9a49396c authored by Hidy Han's avatar Hidy Han Committed by Commit Bot

Provide API to expose non-empty top source url.

Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I6390806935ada277db965718a804ab090b3be5dd
Reviewed-on: https://chromium-review.googlesource.com/1041157Reviewed-by: 's avatarPavel Feldman <pfeldman@chromium.org>
Reviewed-by: 's avatarAleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Commit-Queue: Hidy Han <hidyhan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53047}
parent bce97fd2
...@@ -99,6 +99,7 @@ class V8_EXPORT V8ContextInfo { ...@@ -99,6 +99,7 @@ class V8_EXPORT V8ContextInfo {
class V8_EXPORT V8StackTrace { class V8_EXPORT V8StackTrace {
public: public:
virtual StringView firstNonEmptySourceURL() const = 0;
virtual bool isEmpty() const = 0; virtual bool isEmpty() const = 0;
virtual StringView topSourceURL() const = 0; virtual StringView topSourceURL() const = 0;
virtual int topLineNumber() const = 0; virtual int topLineNumber() const = 0;
......
...@@ -215,6 +215,15 @@ std::unique_ptr<V8StackTrace> V8StackTraceImpl::clone() { ...@@ -215,6 +215,15 @@ std::unique_ptr<V8StackTrace> V8StackTraceImpl::clone() {
m_frames, 0, std::shared_ptr<AsyncStackTrace>(), V8StackTraceId())); m_frames, 0, std::shared_ptr<AsyncStackTrace>(), V8StackTraceId()));
} }
StringView V8StackTraceImpl::firstNonEmptySourceURL() const {
for (size_t i = 0; i < m_frames.size(); ++i) {
if (m_frames[i]->sourceURL().length()) {
return toStringView(m_frames[i]->sourceURL());
}
}
return StringView();
}
bool V8StackTraceImpl::isEmpty() const { return m_frames.empty(); } bool V8StackTraceImpl::isEmpty() const { return m_frames.empty(); }
StringView V8StackTraceImpl::topSourceURL() const { StringView V8StackTraceImpl::topSourceURL() const {
......
...@@ -64,6 +64,7 @@ class V8StackTraceImpl : public V8StackTrace { ...@@ -64,6 +64,7 @@ class V8StackTraceImpl : public V8StackTrace {
// V8StackTrace implementation. // V8StackTrace implementation.
// This method drops the async stack trace. // This method drops the async stack trace.
std::unique_ptr<V8StackTrace> clone() override; std::unique_ptr<V8StackTrace> clone() override;
StringView firstNonEmptySourceURL() const override;
bool isEmpty() const override; bool isEmpty() const override;
StringView topSourceURL() const override; StringView topSourceURL() const override;
int topLineNumber() const override; // 1-based. int topLineNumber() const override; // 1-based.
......
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