| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef V8StackTraceImpl_h | |
| 6 #define V8StackTraceImpl_h | |
| 7 | |
| 8 #include "platform/v8_inspector/Allocator.h" | |
| 9 #include "platform/v8_inspector/protocol/Forward.h" | |
| 10 #include "platform/v8_inspector/protocol/Runtime.h" | |
| 11 #include "platform/v8_inspector/public/V8StackTrace.h" | |
| 12 | |
| 13 #include <vector> | |
| 14 | |
| 15 namespace v8_inspector { | |
| 16 | |
| 17 class TracedValue; | |
| 18 class V8Debugger; | |
| 19 | |
| 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. | |
| 22 // On the other hand, any non-top async stack is guaranteed to be non-empty. | |
| 23 class V8StackTraceImpl final : public V8StackTrace { | |
| 24 V8_INSPECTOR_DISALLOW_COPY(V8StackTraceImpl); | |
| 25 public: | |
| 26 static const size_t maxCallStackSizeToCapture = 200; | |
| 27 | |
| 28 class Frame { | |
| 29 public: | |
| 30 Frame(); | |
| 31 Frame(const String16& functionName, const String16& scriptId, const Stri
ng16& scriptName, int lineNumber, int column = 0); | |
| 32 ~Frame(); | |
| 33 | |
| 34 const String16& functionName() const { return m_functionName; } | |
| 35 const String16& scriptId() const { return m_scriptId; } | |
| 36 const String16& sourceURL() const { return m_scriptName; } | |
| 37 int lineNumber() const { return m_lineNumber; } | |
| 38 int columnNumber() const { return m_columnNumber; } | |
| 39 Frame clone() const; | |
| 40 | |
| 41 private: | |
| 42 friend class V8StackTraceImpl; | |
| 43 std::unique_ptr<protocol::Runtime::CallFrame> buildInspectorObject() con
st; | |
| 44 void toTracedValue(TracedValue*) const; | |
| 45 | |
| 46 String16 m_functionName; | |
| 47 String16 m_scriptId; | |
| 48 String16 m_scriptName; | |
| 49 int m_lineNumber; | |
| 50 int m_columnNumber; | |
| 51 }; | |
| 52 | |
| 53 static void setCaptureStackTraceForUncaughtExceptions(v8::Isolate*, bool cap
ture); | |
| 54 static std::unique_ptr<V8StackTraceImpl> create(V8Debugger*, int contextGrou
pId, v8::Local<v8::StackTrace>, size_t maxStackSize, const String16& description
= String16()); | |
| 55 static std::unique_ptr<V8StackTraceImpl> capture(V8Debugger*, int contextGro
upId, size_t maxStackSize, const String16& description = String16()); | |
| 56 | |
| 57 // This method drops the async chain. Use cloneImpl() instead. | |
| 58 std::unique_ptr<V8StackTrace> clone() override; | |
| 59 std::unique_ptr<V8StackTraceImpl> cloneImpl(); | |
| 60 std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectForTail(V
8Debugger*) const; | |
| 61 std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectImpl() co
nst; | |
| 62 ~V8StackTraceImpl() override; | |
| 63 | |
| 64 // V8StackTrace implementation. | |
| 65 bool isEmpty() const override { return !m_frames.size(); }; | |
| 66 StringView topSourceURL() const override; | |
| 67 int topLineNumber() const override; | |
| 68 int topColumnNumber() const override; | |
| 69 StringView topScriptId() const override; | |
| 70 StringView topFunctionName() const override; | |
| 71 std::unique_ptr<protocol::Runtime::API::StackTrace> buildInspectorObject() c
onst override; | |
| 72 std::unique_ptr<StringBuffer> toString() const override; | |
| 73 | |
| 74 private: | |
| 75 V8StackTraceImpl(int contextGroupId, const String16& description, std::vecto
r<Frame>& frames, std::unique_ptr<V8StackTraceImpl> parent); | |
| 76 | |
| 77 int m_contextGroupId; | |
| 78 String16 m_description; | |
| 79 std::vector<Frame> m_frames; | |
| 80 std::unique_ptr<V8StackTraceImpl> m_parent; | |
| 81 }; | |
| 82 | |
| 83 } // namespace v8_inspector | |
| 84 | |
| 85 #endif // V8StackTraceImpl_h | |
| OLD | NEW |