| 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/Collections.h" | 8 #include "platform/inspector_protocol/Collections.h" |
| 9 #include "platform/inspector_protocol/Platform.h" | 9 #include "platform/inspector_protocol/Platform.h" |
| 10 #include "platform/v8_inspector/public/V8StackTrace.h" | 10 #include "platform/v8_inspector/public/V8StackTrace.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class TracedValue; | 14 class TracedValue; |
| 15 class V8DebuggerAgentImpl; | 15 class V8DebuggerAgentImpl; |
| 16 | 16 |
| 17 // Note: async stack trace may have empty top stack with non-empty tail to indic
ate | 17 // Note: async stack trace may have empty top stack with non-empty tail to indic
ate |
| 18 // that current native-only state had some async story. | 18 // that current native-only state had some async story. |
| 19 // On the other hand, any non-top async stack is guaranteed to be non-empty. | 19 // On the other hand, any non-top async stack is guaranteed to be non-empty. |
| 20 class V8StackTraceImpl final : public V8StackTrace { | 20 class V8StackTraceImpl final : public V8StackTrace { |
| 21 PROTOCOL_DISALLOW_COPY(V8StackTraceImpl); | 21 PROTOCOL_DISALLOW_COPY(V8StackTraceImpl); |
| 22 public: | 22 public: |
| 23 static const size_t maxCallStackSizeToCapture = 200; |
| 24 |
| 23 class Frame { | 25 class Frame { |
| 24 public: | 26 public: |
| 25 Frame(); | 27 Frame(); |
| 26 Frame(const String16& functionName, const String16& scriptId, const Stri
ng16& scriptName, int lineNumber, int column = 0); | 28 Frame(const String16& functionName, const String16& scriptId, const Stri
ng16& scriptName, int lineNumber, int column = 0); |
| 27 ~Frame(); | 29 ~Frame(); |
| 28 | 30 |
| 29 const String16& functionName() const { return m_functionName; } | 31 const String16& functionName() const { return m_functionName; } |
| 30 const String16& scriptId() const { return m_scriptId; } | 32 const String16& scriptId() const { return m_scriptId; } |
| 31 const String16& sourceURL() const { return m_scriptName; } | 33 const String16& sourceURL() const { return m_scriptName; } |
| 32 int lineNumber() const { return m_lineNumber; } | 34 int lineNumber() const { return m_lineNumber; } |
| 33 int columnNumber() const { return m_columnNumber; } | 35 int columnNumber() const { return m_columnNumber; } |
| 34 Frame isolatedCopy() const; | 36 Frame isolatedCopy() const; |
| 35 | 37 |
| 36 private: | 38 private: |
| 37 friend class V8StackTraceImpl; | 39 friend class V8StackTraceImpl; |
| 38 std::unique_ptr<protocol::Runtime::CallFrame> buildInspectorObject() con
st; | 40 std::unique_ptr<protocol::Runtime::CallFrame> buildInspectorObject() con
st; |
| 39 void toTracedValue(TracedValue*) const; | 41 void toTracedValue(TracedValue*) const; |
| 40 | 42 |
| 41 String16 m_functionName; | 43 String16 m_functionName; |
| 42 String16 m_scriptId; | 44 String16 m_scriptId; |
| 43 String16 m_scriptName; | 45 String16 m_scriptName; |
| 44 int m_lineNumber; | 46 int m_lineNumber; |
| 45 int m_columnNumber; | 47 int m_columnNumber; |
| 46 }; | 48 }; |
| 47 | 49 |
| 50 static void setCaptureStackTraceForUncaughtExceptions(v8::Isolate*, bool cap
ture); |
| 48 static std::unique_ptr<V8StackTraceImpl> create(V8DebuggerAgentImpl*, v8::Lo
cal<v8::StackTrace>, size_t maxStackSize, const String16& description = String16
()); | 51 static std::unique_ptr<V8StackTraceImpl> create(V8DebuggerAgentImpl*, v8::Lo
cal<v8::StackTrace>, size_t maxStackSize, const String16& description = String16
()); |
| 49 static std::unique_ptr<V8StackTraceImpl> capture(V8DebuggerAgentImpl*, size_
t maxStackSize, const String16& description = String16()); | 52 static std::unique_ptr<V8StackTraceImpl> capture(V8DebuggerAgentImpl*, size_
t maxStackSize, const String16& description = String16()); |
| 50 | 53 |
| 51 std::unique_ptr<V8StackTrace> clone() override; | 54 std::unique_ptr<V8StackTrace> clone() override; |
| 52 std::unique_ptr<V8StackTraceImpl> cloneImpl(); | 55 std::unique_ptr<V8StackTraceImpl> cloneImpl(); |
| 53 std::unique_ptr<V8StackTrace> isolatedCopy() override; | 56 std::unique_ptr<V8StackTrace> isolatedCopy() override; |
| 54 std::unique_ptr<V8StackTraceImpl> isolatedCopyImpl(); | 57 std::unique_ptr<V8StackTraceImpl> isolatedCopyImpl(); |
| 55 std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectForTail(V
8DebuggerAgentImpl*) const; | 58 std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectForTail(V
8DebuggerAgentImpl*) const; |
| 56 ~V8StackTraceImpl() override; | 59 ~V8StackTraceImpl() override; |
| 57 | 60 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 69 V8StackTraceImpl(const String16& description, protocol::Vector<Frame>& frame
s, std::unique_ptr<V8StackTraceImpl> parent); | 72 V8StackTraceImpl(const String16& description, protocol::Vector<Frame>& frame
s, std::unique_ptr<V8StackTraceImpl> parent); |
| 70 | 73 |
| 71 String16 m_description; | 74 String16 m_description; |
| 72 protocol::Vector<Frame> m_frames; | 75 protocol::Vector<Frame> m_frames; |
| 73 std::unique_ptr<V8StackTraceImpl> m_parent; | 76 std::unique_ptr<V8StackTraceImpl> m_parent; |
| 74 }; | 77 }; |
| 75 | 78 |
| 76 } // namespace blink | 79 } // namespace blink |
| 77 | 80 |
| 78 #endif // V8StackTraceImpl_h | 81 #endif // V8StackTraceImpl_h |
| OLD | NEW |