Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: src/inspector/V8StackTraceImpl.h

Issue 2292573002: [inspector] Initial import of v8_inspector. (Closed)
Patch Set: format the code, disable cpplint Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/inspector/V8SchemaAgentImpl.cpp ('k') | src/inspector/V8StackTraceImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project 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 V8_INSPECTOR_V8STACKTRACEIMPL_H_
6 #define V8_INSPECTOR_V8STACKTRACEIMPL_H_
7
8 #include "src/inspector/Allocator.h"
9 #include "src/inspector/protocol/Forward.h"
10 #include "src/inspector/protocol/Runtime.h"
11 #include "src/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
21 // indicate
22 // that current native-only state had some async story.
23 // On the other hand, any non-top async stack is guaranteed to be non-empty.
24 class V8StackTraceImpl final : public V8StackTrace {
25 V8_INSPECTOR_DISALLOW_COPY(V8StackTraceImpl);
26
27 public:
28 static const size_t maxCallStackSizeToCapture = 200;
29
30 class Frame {
31 public:
32 Frame();
33 Frame(const String16& functionName, const String16& scriptId,
34 const String16& scriptName, int lineNumber, int column = 0);
35 ~Frame();
36
37 const String16& functionName() const { return m_functionName; }
38 const String16& scriptId() const { return m_scriptId; }
39 const String16& sourceURL() const { return m_scriptName; }
40 int lineNumber() const { return m_lineNumber; }
41 int columnNumber() const { return m_columnNumber; }
42 Frame clone() const;
43
44 private:
45 friend class V8StackTraceImpl;
46 std::unique_ptr<protocol::Runtime::CallFrame> buildInspectorObject() const;
47 void toTracedValue(TracedValue*) const;
48
49 String16 m_functionName;
50 String16 m_scriptId;
51 String16 m_scriptName;
52 int m_lineNumber;
53 int m_columnNumber;
54 };
55
56 static void setCaptureStackTraceForUncaughtExceptions(v8::Isolate*,
57 bool capture);
58 static std::unique_ptr<V8StackTraceImpl> create(
59 V8Debugger*, int contextGroupId, v8::Local<v8::StackTrace>,
60 size_t maxStackSize, const String16& description = String16());
61 static std::unique_ptr<V8StackTraceImpl> capture(
62 V8Debugger*, int contextGroupId, size_t maxStackSize,
63 const String16& description = String16());
64
65 // This method drops the async chain. Use cloneImpl() instead.
66 std::unique_ptr<V8StackTrace> clone() override;
67 std::unique_ptr<V8StackTraceImpl> cloneImpl();
68 std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectForTail(
69 V8Debugger*) const;
70 std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectImpl()
71 const;
72 ~V8StackTraceImpl() override;
73
74 // V8StackTrace implementation.
75 bool isEmpty() const override { return !m_frames.size(); };
76 StringView topSourceURL() const override;
77 int topLineNumber() const override;
78 int topColumnNumber() const override;
79 StringView topScriptId() const override;
80 StringView topFunctionName() const override;
81 std::unique_ptr<protocol::Runtime::API::StackTrace> buildInspectorObject()
82 const override;
83 std::unique_ptr<StringBuffer> toString() const override;
84
85 private:
86 V8StackTraceImpl(int contextGroupId, const String16& description,
87 std::vector<Frame>& frames,
88 std::unique_ptr<V8StackTraceImpl> parent);
89
90 int m_contextGroupId;
91 String16 m_description;
92 std::vector<Frame> m_frames;
93 std::unique_ptr<V8StackTraceImpl> m_parent;
94 };
95
96 } // namespace v8_inspector
97
98 #endif // V8_INSPECTOR_V8STACKTRACEIMPL_H_
OLDNEW
« no previous file with comments | « src/inspector/V8SchemaAgentImpl.cpp ('k') | src/inspector/V8StackTraceImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698