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/1041157 Reviewed-by: Pavel Feldman <pfeldman@chromium.org> Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org> Commit-Queue: Hidy Han <hidyhan@chromium.org> Cr-Commit-Position: refs/heads/master@{#53047}
This commit is contained in:
parent
bce97fd2ef
commit
9a49396c7c
@ -99,6 +99,7 @@ class V8_EXPORT V8ContextInfo {
|
||||
|
||||
class V8_EXPORT V8StackTrace {
|
||||
public:
|
||||
virtual StringView firstNonEmptySourceURL() const = 0;
|
||||
virtual bool isEmpty() const = 0;
|
||||
virtual StringView topSourceURL() const = 0;
|
||||
virtual int topLineNumber() const = 0;
|
||||
|
@ -215,6 +215,15 @@ std::unique_ptr<V8StackTrace> V8StackTraceImpl::clone() {
|
||||
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(); }
|
||||
|
||||
StringView V8StackTraceImpl::topSourceURL() const {
|
||||
|
@ -64,6 +64,7 @@ class V8StackTraceImpl : public V8StackTrace {
|
||||
// V8StackTrace implementation.
|
||||
// This method drops the async stack trace.
|
||||
std::unique_ptr<V8StackTrace> clone() override;
|
||||
StringView firstNonEmptySourceURL() const override;
|
||||
bool isEmpty() const override;
|
||||
StringView topSourceURL() const override;
|
||||
int topLineNumber() const override; // 1-based.
|
||||
|
Loading…
Reference in New Issue
Block a user