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" |
12 #include "src/globals.h" | 13 #include "src/globals.h" |
13 | 14 |
14 namespace v8 { | 15 namespace v8 { |
| 16 |
| 17 namespace internal { |
| 18 class BuiltinArguments; |
| 19 } // internal |
| 20 |
15 namespace debug { | 21 namespace debug { |
16 | 22 |
17 /** | 23 /** |
18 * Defines location inside script. | 24 * Defines location inside script. |
19 * Lines and columns are 0-based. | 25 * Lines and columns are 0-based. |
20 */ | 26 */ |
21 class V8_EXPORT_PRIVATE Location { | 27 class V8_EXPORT_PRIVATE Location { |
22 public: | 28 public: |
23 Location(int line_number, int column_number); | 29 Location(int line_number, int column_number); |
24 /** | 30 /** |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 public: | 89 public: |
84 BreakLocation(int line_number, int column_number, BreakLocationType type) | 90 BreakLocation(int line_number, int column_number, BreakLocationType type) |
85 : Location(line_number, column_number), type_(type) {} | 91 : Location(line_number, column_number), type_(type) {} |
86 | 92 |
87 BreakLocationType type() const { return type_; } | 93 BreakLocationType type() const { return type_; } |
88 | 94 |
89 private: | 95 private: |
90 BreakLocationType type_; | 96 BreakLocationType type_; |
91 }; | 97 }; |
92 | 98 |
| 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 |
93 } // namespace debug | 140 } // namespace debug |
94 } // namespace v8 | 141 } // namespace v8 |
95 | 142 |
96 #endif // V8_DEBUG_INTERFACE_TYPES_H_ | 143 #endif // V8_DEBUG_INTERFACE_TYPES_H_ |
OLD | NEW |