OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 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 V8_DEBUG_INTERFACE_TYPES_H_ | 5 #ifndef V8_DEBUG_INTERFACE_TYPES_H_ |
6 #define V8_DEBUG_INTERFACE_TYPES_H_ | 6 #define V8_DEBUG_INTERFACE_TYPES_H_ |
7 | 7 |
8 #include <cstdint> | 8 #include <cstdint> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "include/v8.h" | |
13 #include "src/globals.h" | 12 #include "src/globals.h" |
14 | 13 |
15 namespace v8 { | 14 namespace v8 { |
16 | |
17 namespace internal { | |
18 class BuiltinArguments; | |
19 } // internal | |
20 | |
21 namespace debug { | 15 namespace debug { |
22 | 16 |
23 /** | 17 /** |
24 * Defines location inside script. | 18 * Defines location inside script. |
25 * Lines and columns are 0-based. | 19 * Lines and columns are 0-based. |
26 */ | 20 */ |
27 class V8_EXPORT_PRIVATE Location { | 21 class V8_EXPORT_PRIVATE Location { |
28 public: | 22 public: |
29 Location(int line_number, int column_number); | 23 Location(int line_number, int column_number); |
30 /** | 24 /** |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 public: | 83 public: |
90 BreakLocation(int line_number, int column_number, BreakLocationType type) | 84 BreakLocation(int line_number, int column_number, BreakLocationType type) |
91 : Location(line_number, column_number), type_(type) {} | 85 : Location(line_number, column_number), type_(type) {} |
92 | 86 |
93 BreakLocationType type() const { return type_; } | 87 BreakLocationType type() const { return type_; } |
94 | 88 |
95 private: | 89 private: |
96 BreakLocationType type_; | 90 BreakLocationType type_; |
97 }; | 91 }; |
98 | 92 |
99 class ConsoleCallArguments : private v8::FunctionCallbackInfo<v8::Value> { | |
100 public: | |
101 int Length() const { return v8::FunctionCallbackInfo<v8::Value>::Length(); } | |
102 V8_INLINE Local<Value> operator[](int i) const { | |
103 return v8::FunctionCallbackInfo<v8::Value>::operator[](i); | |
104 } | |
105 | |
106 explicit ConsoleCallArguments(const v8::FunctionCallbackInfo<v8::Value>&); | |
107 explicit ConsoleCallArguments(internal::BuiltinArguments&); | |
108 }; | |
109 | |
110 // v8::FunctionCallbackInfo could be used for getting arguments only. Calling | |
111 // of any other getter will produce a crash. | |
112 class ConsoleDelegate { | |
113 public: | |
114 virtual void Debug(const ConsoleCallArguments& args) {} | |
115 virtual void Error(const ConsoleCallArguments& args) {} | |
116 virtual void Info(const ConsoleCallArguments& args) {} | |
117 virtual void Log(const ConsoleCallArguments& args) {} | |
118 virtual void Warn(const ConsoleCallArguments& args) {} | |
119 virtual void Dir(const ConsoleCallArguments& args) {} | |
120 virtual void DirXml(const ConsoleCallArguments& args) {} | |
121 virtual void Table(const ConsoleCallArguments& args) {} | |
122 virtual void Trace(const ConsoleCallArguments& args) {} | |
123 virtual void Group(const ConsoleCallArguments& args) {} | |
124 virtual void GroupCollapsed(const ConsoleCallArguments& args) {} | |
125 virtual void GroupEnd(const ConsoleCallArguments& args) {} | |
126 virtual void Clear(const ConsoleCallArguments& args) {} | |
127 virtual void Count(const ConsoleCallArguments& args) {} | |
128 virtual void Assert(const ConsoleCallArguments& args) {} | |
129 virtual void MarkTimeline(const ConsoleCallArguments& args) {} | |
130 virtual void Profile(const ConsoleCallArguments& args) {} | |
131 virtual void ProfileEnd(const ConsoleCallArguments& args) {} | |
132 virtual void Timeline(const ConsoleCallArguments& args) {} | |
133 virtual void TimelineEnd(const ConsoleCallArguments& args) {} | |
134 virtual void Time(const ConsoleCallArguments& args) {} | |
135 virtual void TimeEnd(const ConsoleCallArguments& args) {} | |
136 virtual void TimeStamp(const ConsoleCallArguments& args) {} | |
137 virtual ~ConsoleDelegate() = default; | |
138 }; | |
139 | |
140 } // namespace debug | 93 } // namespace debug |
141 } // namespace v8 | 94 } // namespace v8 |
142 | 95 |
143 #endif // V8_DEBUG_INTERFACE_TYPES_H_ | 96 #endif // V8_DEBUG_INTERFACE_TYPES_H_ |
OLD | NEW |