OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SourceLocation_h | 5 #ifndef SourceLocation_h |
6 #define SourceLocation_h | 6 #define SourceLocation_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "platform/CrossThreadCopier.h" | 9 #include "platform/CrossThreadCopier.h" |
10 #include "wtf/Forward.h" | 10 #include "wtf/Forward.h" |
11 #include "wtf/text/WTFString.h" | 11 #include "wtf/text/WTFString.h" |
12 #include <memory> | 12 #include <memory> |
13 #include <v8-inspector-protocol.h> | 13 #include <v8-inspector-protocol.h> |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class ExecutionContext; | 17 class ExecutionContext; |
18 class TracedValue; | 18 class TracedValue; |
19 | 19 |
20 class CORE_EXPORT SourceLocation { | 20 class CORE_EXPORT SourceLocation { |
21 public: | 21 public: |
22 // Zero lineNumber and columnNumber mean unknown. Captures current stack trace
. | 22 // Zero lineNumber and columnNumber mean unknown. Captures current stack |
| 23 // trace. |
23 static std::unique_ptr<SourceLocation> capture(const String& url, | 24 static std::unique_ptr<SourceLocation> capture(const String& url, |
24 unsigned lineNumber, | 25 unsigned lineNumber, |
25 unsigned columnNumber); | 26 unsigned columnNumber); |
26 | 27 |
27 // Shortcut when location is unknown. Tries to capture call stack or parsing l
ocation if available. | 28 // Shortcut when location is unknown. Tries to capture call stack or parsing |
| 29 // location if available. |
28 static std::unique_ptr<SourceLocation> capture(ExecutionContext* = nullptr); | 30 static std::unique_ptr<SourceLocation> capture(ExecutionContext* = nullptr); |
29 | 31 |
30 static std::unique_ptr<SourceLocation> fromMessage(v8::Isolate*, | 32 static std::unique_ptr<SourceLocation> fromMessage(v8::Isolate*, |
31 v8::Local<v8::Message>, | 33 v8::Local<v8::Message>, |
32 ExecutionContext*); | 34 ExecutionContext*); |
33 | 35 |
34 static std::unique_ptr<SourceLocation> fromFunction(v8::Local<v8::Function>); | 36 static std::unique_ptr<SourceLocation> fromFunction(v8::Local<v8::Function>); |
35 | 37 |
36 // Forces full stack trace. | 38 // Forces full stack trace. |
37 static std::unique_ptr<SourceLocation> captureWithFullStackTrace(); | 39 static std::unique_ptr<SourceLocation> captureWithFullStackTrace(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 String m_url; | 83 String m_url; |
82 unsigned m_lineNumber; | 84 unsigned m_lineNumber; |
83 unsigned m_columnNumber; | 85 unsigned m_columnNumber; |
84 std::unique_ptr<v8_inspector::V8StackTrace> m_stackTrace; | 86 std::unique_ptr<v8_inspector::V8StackTrace> m_stackTrace; |
85 int m_scriptId; | 87 int m_scriptId; |
86 }; | 88 }; |
87 | 89 |
88 } // namespace blink | 90 } // namespace blink |
89 | 91 |
90 #endif // SourceLocation_h | 92 #endif // SourceLocation_h |
OLD | NEW |