OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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_V8_DEBUG_H_ | 5 #ifndef V8_V8_DEBUG_H_ |
6 #define V8_V8_DEBUG_H_ | 6 #define V8_V8_DEBUG_H_ |
7 | 7 |
8 #include "v8.h" // NOLINT(build/include) | 8 #include "v8.h" // NOLINT(build/include) |
9 | 9 |
10 /** | 10 /** |
11 * Debugger support for the V8 JavaScript engine. | 11 * Debugger support for the V8 JavaScript engine. |
12 */ | 12 */ |
13 namespace v8 { | 13 namespace v8 { |
14 | 14 |
15 // Debug events which can occur in the V8 JavaScript engine. | 15 // Debug events which can occur in the V8 JavaScript engine. |
16 enum DebugEvent { | 16 enum DebugEvent { |
17 Break = 1, | 17 Break = 1, |
18 Exception = 2, | 18 Exception = 2, |
19 NewFunction = 3, | 19 AfterCompile = 3, |
20 BeforeCompile = 4, | 20 CompileError = 4, |
21 AfterCompile = 5, | 21 AsyncTaskEvent = 5, |
22 CompileError = 6, | |
23 AsyncTaskEvent = 7, | |
24 }; | 22 }; |
25 | 23 |
26 class V8_EXPORT Debug { | 24 class V8_EXPORT Debug { |
27 public: | 25 public: |
28 /** | 26 /** |
29 * A client object passed to the v8 debugger whose ownership will be taken by | 27 * A client object passed to the v8 debugger whose ownership will be taken by |
30 * it. v8 is always responsible for deleting the object. | 28 * it. v8 is always responsible for deleting the object. |
31 */ | 29 */ |
32 class ClientData { | 30 class ClientData { |
33 public: | 31 public: |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 * A EventCallback2 does not take possession of the event data, | 135 * A EventCallback2 does not take possession of the event data, |
138 * and must not rely on the data persisting after the handler returns. | 136 * and must not rely on the data persisting after the handler returns. |
139 */ | 137 */ |
140 typedef void (*EventCallback)(const EventDetails& event_details); | 138 typedef void (*EventCallback)(const EventDetails& event_details); |
141 | 139 |
142 /** | 140 /** |
143 * Debug message callback function. | 141 * Debug message callback function. |
144 * | 142 * |
145 * \param message the debug message handler message object | 143 * \param message the debug message handler message object |
146 * | 144 * |
147 * A MessageHandler2 does not take possession of the message data, | 145 * A MessageHandler does not take possession of the message data, |
148 * and must not rely on the data persisting after the handler returns. | 146 * and must not rely on the data persisting after the handler returns. |
149 */ | 147 */ |
150 typedef void (*MessageHandler)(const Message& message); | 148 typedef void (*MessageHandler)(const Message& message); |
151 | 149 |
152 /** | 150 /** |
153 * Callback function for the host to ensure debug messages are processed. | 151 * Callback function for the host to ensure debug messages are processed. |
154 */ | 152 */ |
155 typedef void (*DebugMessageDispatchHandler)(); | 153 typedef void (*DebugMessageDispatchHandler)(); |
156 | 154 |
157 static bool SetDebugEventListener(Isolate* isolate, EventCallback that, | 155 static bool SetDebugEventListener(Isolate* isolate, EventCallback that, |
158 Local<Value> data = Local<Value>()); | 156 Local<Value> data = Local<Value>()); |
159 | 157 |
160 // Schedule a debugger break to happen when JavaScript code is run | 158 // Schedule a debugger break to happen when JavaScript code is run |
161 // in the given isolate. | 159 // in the given isolate. |
162 static void DebugBreak(Isolate* isolate); | 160 static void DebugBreak(Isolate* isolate); |
163 | 161 |
164 // Remove scheduled debugger break in given isolate if it has not | 162 // Remove scheduled debugger break in given isolate if it has not |
165 // happened yet. | 163 // happened yet. |
166 static void CancelDebugBreak(Isolate* isolate); | 164 static void CancelDebugBreak(Isolate* isolate); |
167 | 165 |
168 // Check if a debugger break is scheduled in the given isolate. | 166 // Check if a debugger break is scheduled in the given isolate. |
169 static bool CheckDebugBreak(Isolate* isolate); | 167 V8_DEPRECATED("No longer supported", |
| 168 static bool CheckDebugBreak(Isolate* isolate)); |
170 | 169 |
171 // Message based interface. The message protocol is JSON. | 170 // Message based interface. The message protocol is JSON. |
172 V8_DEPRECATED("No longer supported", | 171 V8_DEPRECATED("No longer supported", |
173 static void SetMessageHandler(Isolate* isolate, | 172 static void SetMessageHandler(Isolate* isolate, |
174 MessageHandler handler)); | 173 MessageHandler handler)); |
175 | 174 |
176 V8_DEPRECATED("No longer supported", | 175 V8_DEPRECATED("No longer supported", |
177 static void SendCommand(Isolate* isolate, | 176 static void SendCommand(Isolate* isolate, |
178 const uint16_t* command, int length, | 177 const uint16_t* command, int length, |
179 ClientData* client_data = NULL)); | 178 ClientData* client_data = NULL)); |
(...skipping 17 matching lines...) Expand all Loading... |
197 * \endcode | 196 * \endcode |
198 */ | 197 */ |
199 // TODO(dcarney): data arg should be a MaybeLocal | 198 // TODO(dcarney): data arg should be a MaybeLocal |
200 static MaybeLocal<Value> Call(Local<Context> context, | 199 static MaybeLocal<Value> Call(Local<Context> context, |
201 v8::Local<v8::Function> fun, | 200 v8::Local<v8::Function> fun, |
202 Local<Value> data = Local<Value>()); | 201 Local<Value> data = Local<Value>()); |
203 | 202 |
204 /** | 203 /** |
205 * Returns a mirror object for the given object. | 204 * Returns a mirror object for the given object. |
206 */ | 205 */ |
207 static MaybeLocal<Value> GetMirror(Local<Context> context, | 206 V8_DEPRECATED("No longer supported", |
208 v8::Local<v8::Value> obj); | 207 static MaybeLocal<Value> GetMirror(Local<Context> context, |
| 208 v8::Local<v8::Value> obj)); |
209 | 209 |
210 /** | 210 /** |
211 * Makes V8 process all pending debug messages. | 211 * Makes V8 process all pending debug messages. |
212 * | 212 * |
213 * From V8 point of view all debug messages come asynchronously (e.g. from | 213 * From V8 point of view all debug messages come asynchronously (e.g. from |
214 * remote debugger) but they all must be handled synchronously: V8 cannot | 214 * remote debugger) but they all must be handled synchronously: V8 cannot |
215 * do 2 things at one time so normal script execution must be interrupted | 215 * do 2 things at one time so normal script execution must be interrupted |
216 * for a while. | 216 * for a while. |
217 * | 217 * |
218 * Generally when message arrives V8 may be in one of 3 states: | 218 * Generally when message arrives V8 may be in one of 3 states: |
(...skipping 28 matching lines...) Expand all Loading... |
247 * debugger context. Note that the content of the debugger context is subject | 247 * debugger context. Note that the content of the debugger context is subject |
248 * to change. The Context exists only when the debugger is active, i.e. at | 248 * to change. The Context exists only when the debugger is active, i.e. at |
249 * least one DebugEventListener or MessageHandler is set. | 249 * least one DebugEventListener or MessageHandler is set. |
250 */ | 250 */ |
251 static Local<Context> GetDebugContext(Isolate* isolate); | 251 static Local<Context> GetDebugContext(Isolate* isolate); |
252 | 252 |
253 /** | 253 /** |
254 * While in the debug context, this method returns the top-most non-debug | 254 * While in the debug context, this method returns the top-most non-debug |
255 * context, if it exists. | 255 * context, if it exists. |
256 */ | 256 */ |
257 static MaybeLocal<Context> GetDebuggedContext(Isolate* isolate); | 257 V8_DEPRECATED( |
| 258 "No longer supported", |
| 259 static MaybeLocal<Context> GetDebuggedContext(Isolate* isolate)); |
258 | 260 |
259 /** | 261 /** |
260 * Enable/disable LiveEdit functionality for the given Isolate | 262 * Enable/disable LiveEdit functionality for the given Isolate |
261 * (default Isolate if not provided). V8 will abort if LiveEdit is | 263 * (default Isolate if not provided). V8 will abort if LiveEdit is |
262 * unexpectedly used. LiveEdit is enabled by default. | 264 * unexpectedly used. LiveEdit is enabled by default. |
263 */ | 265 */ |
264 static void SetLiveEditEnabled(Isolate* isolate, bool enable); | 266 static void SetLiveEditEnabled(Isolate* isolate, bool enable); |
265 | 267 |
266 /** | 268 /** |
267 * Returns array of internal properties specific to the value type. Result has | 269 * Returns array of internal properties specific to the value type. Result has |
(...skipping 13 matching lines...) Expand all Loading... |
281 }; | 283 }; |
282 | 284 |
283 | 285 |
284 } // namespace v8 | 286 } // namespace v8 |
285 | 287 |
286 | 288 |
287 #undef EXPORT | 289 #undef EXPORT |
288 | 290 |
289 | 291 |
290 #endif // V8_V8_DEBUG_H_ | 292 #endif // V8_V8_DEBUG_H_ |
OLD | NEW |