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