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/v8_inspector/public/V8StackTrace.h" | 9 #include "platform/v8_inspector/public/V8StackTrace.h" |
10 #include "wtf/PassOwnPtr.h" | 10 #include "wtf/PassOwnPtr.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 class V8StackTraceImpl final : public V8StackTrace { | 17 class V8StackTraceImpl final : public V8StackTrace { |
18 PROTOCOL_DISALLOW_COPY(V8StackTraceImpl); | 18 PROTOCOL_DISALLOW_COPY(V8StackTraceImpl); |
19 public: | 19 public: |
20 class Frame { | 20 class Frame { |
21 public: | 21 public: |
22 Frame(); | 22 Frame(); |
23 Frame(const String& functionName, const String& scriptId, const String&
scriptName, int lineNumber, int column = 0); | 23 Frame(const String16& functionName, const String16& scriptId, const Stri
ng16& scriptName, int lineNumber, int column = 0); |
24 ~Frame(); | 24 ~Frame(); |
25 | 25 |
26 const String& functionName() const { return m_functionName; } | 26 const String16& functionName() const { return m_functionName; } |
27 const String& scriptId() const { return m_scriptId; } | 27 const String16& scriptId() const { return m_scriptId; } |
28 const String& sourceURL() const { return m_scriptName; } | 28 const String16& sourceURL() const { return m_scriptName; } |
29 int lineNumber() const { return m_lineNumber; } | 29 int lineNumber() const { return m_lineNumber; } |
30 int columnNumber() const { return m_columnNumber; } | 30 int columnNumber() const { return m_columnNumber; } |
31 | 31 |
32 private: | 32 private: |
33 friend class V8StackTraceImpl; | 33 friend class V8StackTraceImpl; |
34 PassOwnPtr<protocol::Runtime::CallFrame> buildInspectorObject() const; | 34 PassOwnPtr<protocol::Runtime::CallFrame> buildInspectorObject() const; |
35 void toTracedValue(TracedValue*) const; | 35 void toTracedValue(TracedValue*) const; |
36 | 36 |
37 String m_functionName; | 37 String16 m_functionName; |
38 String m_scriptId; | 38 String16 m_scriptId; |
39 String m_scriptName; | 39 String16 m_scriptName; |
40 int m_lineNumber; | 40 int m_lineNumber; |
41 int m_columnNumber; | 41 int m_columnNumber; |
42 }; | 42 }; |
43 | 43 |
44 static PassOwnPtr<V8StackTraceImpl> create(const String& description, protoc
ol::Vector<Frame>&, PassOwnPtr<V8StackTraceImpl>); | 44 static PassOwnPtr<V8StackTraceImpl> create(const String16& description, prot
ocol::Vector<Frame>&, PassOwnPtr<V8StackTraceImpl>); |
45 static PassOwnPtr<V8StackTraceImpl> create(V8DebuggerAgentImpl*, v8::Local<v
8::StackTrace>, size_t maxStackSize, const String& description = String()); | 45 static PassOwnPtr<V8StackTraceImpl> create(V8DebuggerAgentImpl*, v8::Local<v
8::StackTrace>, size_t maxStackSize, const String16& description = String16()); |
46 static PassOwnPtr<V8StackTraceImpl> capture(V8DebuggerAgentImpl*, size_t max
StackSize, const String& description = String()); | 46 static PassOwnPtr<V8StackTraceImpl> capture(V8DebuggerAgentImpl*, size_t max
StackSize, const String16& description = String16()); |
47 static PassOwnPtr<V8StackTraceImpl> clone(V8StackTraceImpl*, size_t maxAsync
StackSize); | 47 static PassOwnPtr<V8StackTraceImpl> clone(V8StackTraceImpl*, size_t maxAsync
StackSize); |
48 | 48 |
49 ~V8StackTraceImpl() override; | 49 ~V8StackTraceImpl() override; |
50 | 50 |
51 // V8StackTrace implementation. | 51 // V8StackTrace implementation. |
52 bool isEmpty() const override { return !m_frames.size(); }; | 52 bool isEmpty() const override { return !m_frames.size(); }; |
53 String topSourceURL() const override; | 53 String16 topSourceURL() const override; |
54 int topLineNumber() const override; | 54 int topLineNumber() const override; |
55 int topColumnNumber() const override; | 55 int topColumnNumber() const override; |
56 String topScriptId() const override; | 56 String16 topScriptId() const override; |
57 String topFunctionName() const override; | 57 String16 topFunctionName() const override; |
58 PassOwnPtr<protocol::Runtime::StackTrace> buildInspectorObject() const overr
ide; | 58 PassOwnPtr<protocol::Runtime::StackTrace> buildInspectorObject() const overr
ide; |
59 String toString() const override; | 59 String16 toString() const override; |
60 | 60 |
61 private: | 61 private: |
62 V8StackTraceImpl(const String& description, protocol::Vector<Frame>& frames,
PassOwnPtr<V8StackTraceImpl> parent); | 62 V8StackTraceImpl(const String16& description, protocol::Vector<Frame>& frame
s, PassOwnPtr<V8StackTraceImpl> parent); |
63 | 63 |
64 String m_description; | 64 String16 m_description; |
65 protocol::Vector<Frame> m_frames; | 65 protocol::Vector<Frame> m_frames; |
66 OwnPtr<V8StackTraceImpl> m_parent; | 66 OwnPtr<V8StackTraceImpl> m_parent; |
67 }; | 67 }; |
68 | 68 |
69 } // namespace blink | 69 } // namespace blink |
70 | 70 |
71 #endif // V8StackTraceImpl_h | 71 #endif // V8StackTraceImpl_h |
OLD | NEW |