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 V8StackTraceImpl_h | 5 #ifndef V8StackTraceImpl_h |
6 #define V8StackTraceImpl_h | 6 #define V8StackTraceImpl_h |
7 | 7 |
8 #include "platform/inspector_protocol/Allocator.h" | 8 #include "platform/inspector_protocol/Allocator.h" |
9 #include "platform/inspector_protocol/Platform.h" | 9 #include "platform/inspector_protocol/Platform.h" |
10 #include "platform/v8_inspector/protocol/Runtime.h" | 10 #include "platform/v8_inspector/protocol/Runtime.h" |
11 #include "platform/v8_inspector/public/V8StackTrace.h" | 11 #include "platform/v8_inspector/public/V8StackTrace.h" |
12 | 12 |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class TracedValue; | 17 class TracedValue; |
18 class V8DebuggerImpl; | 18 class V8InspectorImpl; |
19 | 19 |
20 // Note: async stack trace may have empty top stack with non-empty tail to indic
ate | 20 // Note: async stack trace may have empty top stack with non-empty tail to indic
ate |
21 // that current native-only state had some async story. | 21 // that current native-only state had some async story. |
22 // On the other hand, any non-top async stack is guaranteed to be non-empty. | 22 // On the other hand, any non-top async stack is guaranteed to be non-empty. |
23 class V8StackTraceImpl final : public V8StackTrace { | 23 class V8StackTraceImpl final : public V8StackTrace { |
24 PROTOCOL_DISALLOW_COPY(V8StackTraceImpl); | 24 PROTOCOL_DISALLOW_COPY(V8StackTraceImpl); |
25 public: | 25 public: |
26 static const size_t maxCallStackSizeToCapture = 200; | 26 static const size_t maxCallStackSizeToCapture = 200; |
27 | 27 |
28 class Frame { | 28 class Frame { |
(...skipping 15 matching lines...) Expand all Loading... |
44 void toTracedValue(TracedValue*) const; | 44 void toTracedValue(TracedValue*) const; |
45 | 45 |
46 String16 m_functionName; | 46 String16 m_functionName; |
47 String16 m_scriptId; | 47 String16 m_scriptId; |
48 String16 m_scriptName; | 48 String16 m_scriptName; |
49 int m_lineNumber; | 49 int m_lineNumber; |
50 int m_columnNumber; | 50 int m_columnNumber; |
51 }; | 51 }; |
52 | 52 |
53 static void setCaptureStackTraceForUncaughtExceptions(v8::Isolate*, bool cap
ture); | 53 static void setCaptureStackTraceForUncaughtExceptions(v8::Isolate*, bool cap
ture); |
54 static std::unique_ptr<V8StackTraceImpl> create(V8DebuggerImpl*, int context
GroupId, v8::Local<v8::StackTrace>, size_t maxStackSize, const String16& descrip
tion = String16()); | 54 static std::unique_ptr<V8StackTraceImpl> create(V8InspectorImpl*, int contex
tGroupId, v8::Local<v8::StackTrace>, size_t maxStackSize, const String16& descri
ption = String16()); |
55 static std::unique_ptr<V8StackTraceImpl> capture(V8DebuggerImpl*, int contex
tGroupId, size_t maxStackSize, const String16& description = String16()); | 55 static std::unique_ptr<V8StackTraceImpl> capture(V8InspectorImpl*, int conte
xtGroupId, size_t maxStackSize, const String16& description = String16()); |
56 | 56 |
57 std::unique_ptr<V8StackTrace> clone() override; | 57 std::unique_ptr<V8StackTrace> clone() override; |
58 std::unique_ptr<V8StackTraceImpl> cloneImpl(); | 58 std::unique_ptr<V8StackTraceImpl> cloneImpl(); |
59 std::unique_ptr<V8StackTrace> isolatedCopy() override; | 59 std::unique_ptr<V8StackTrace> isolatedCopy() override; |
60 std::unique_ptr<V8StackTraceImpl> isolatedCopyImpl(); | 60 std::unique_ptr<V8StackTraceImpl> isolatedCopyImpl(); |
61 std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectForTail(V
8DebuggerImpl*) const; | 61 std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectForTail(V
8InspectorImpl*) const; |
62 std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectImpl() co
nst; | 62 std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectImpl() co
nst; |
63 ~V8StackTraceImpl() override; | 63 ~V8StackTraceImpl() override; |
64 | 64 |
65 // V8StackTrace implementation. | 65 // V8StackTrace implementation. |
66 bool isEmpty() const override { return !m_frames.size(); }; | 66 bool isEmpty() const override { return !m_frames.size(); }; |
67 String16 topSourceURL() const override; | 67 String16 topSourceURL() const override; |
68 int topLineNumber() const override; | 68 int topLineNumber() const override; |
69 int topColumnNumber() const override; | 69 int topColumnNumber() const override; |
70 String16 topScriptId() const override; | 70 String16 topScriptId() const override; |
71 String16 topFunctionName() const override; | 71 String16 topFunctionName() const override; |
72 std::unique_ptr<protocol::Runtime::API::StackTrace> buildInspectorObject() c
onst override; | 72 std::unique_ptr<protocol::Runtime::API::StackTrace> buildInspectorObject() c
onst override; |
73 String16 toString() const override; | 73 String16 toString() const override; |
74 | 74 |
75 private: | 75 private: |
76 V8StackTraceImpl(int contextGroupId, const String16& description, std::vecto
r<Frame>& frames, std::unique_ptr<V8StackTraceImpl> parent); | 76 V8StackTraceImpl(int contextGroupId, const String16& description, std::vecto
r<Frame>& frames, std::unique_ptr<V8StackTraceImpl> parent); |
77 | 77 |
78 int m_contextGroupId; | 78 int m_contextGroupId; |
79 String16 m_description; | 79 String16 m_description; |
80 std::vector<Frame> m_frames; | 80 std::vector<Frame> m_frames; |
81 std::unique_ptr<V8StackTraceImpl> m_parent; | 81 std::unique_ptr<V8StackTraceImpl> m_parent; |
82 }; | 82 }; |
83 | 83 |
84 } // namespace blink | 84 } // namespace blink |
85 | 85 |
86 #endif // V8StackTraceImpl_h | 86 #endif // V8StackTraceImpl_h |
OLD | NEW |