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 /** |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 * A MessageHandler2 does not take possession of the message data, | 148 * A MessageHandler2 does not take possession of the message data, |
149 * and must not rely on the data persisting after the handler returns. | 149 * and must not rely on the data persisting after the handler returns. |
150 */ | 150 */ |
151 typedef void (*MessageHandler)(const Message& message); | 151 typedef void (*MessageHandler)(const Message& message); |
152 | 152 |
153 /** | 153 /** |
154 * Callback function for the host to ensure debug messages are processed. | 154 * Callback function for the host to ensure debug messages are processed. |
155 */ | 155 */ |
156 typedef void (*DebugMessageDispatchHandler)(); | 156 typedef void (*DebugMessageDispatchHandler)(); |
157 | 157 |
158 static bool SetDebugEventListener(EventCallback that, | 158 static bool SetDebugEventListener(Isolate* isolate, EventCallback that, |
159 Local<Value> data = Local<Value>()); | 159 Local<Value> data = Local<Value>()); |
| 160 V8_DEPRECATE_SOON( |
| 161 "Use version with an Isolate", |
| 162 static bool SetDebugEventListener(EventCallback that, |
| 163 Local<Value> data = Local<Value>())); |
160 | 164 |
161 // Schedule a debugger break to happen when JavaScript code is run | 165 // Schedule a debugger break to happen when JavaScript code is run |
162 // in the given isolate. | 166 // in the given isolate. |
163 static void DebugBreak(Isolate* isolate); | 167 static void DebugBreak(Isolate* isolate); |
164 | 168 |
165 // Remove scheduled debugger break in given isolate if it has not | 169 // Remove scheduled debugger break in given isolate if it has not |
166 // happened yet. | 170 // happened yet. |
167 static void CancelDebugBreak(Isolate* isolate); | 171 static void CancelDebugBreak(Isolate* isolate); |
168 | 172 |
169 // Check if a debugger break is scheduled in the given isolate. | 173 // Check if a debugger break is scheduled in the given isolate. |
170 static bool CheckDebugBreak(Isolate* isolate); | 174 static bool CheckDebugBreak(Isolate* isolate); |
171 | 175 |
172 // Message based interface. The message protocol is JSON. | 176 // Message based interface. The message protocol is JSON. |
173 static void SetMessageHandler(MessageHandler handler); | 177 static void SetMessageHandler(Isolate* isolate, MessageHandler handler); |
| 178 V8_DEPRECATE_SOON("Use version with an Isolate", |
| 179 static void SetMessageHandler(MessageHandler handler)); |
174 | 180 |
175 static void SendCommand(Isolate* isolate, | 181 static void SendCommand(Isolate* isolate, |
176 const uint16_t* command, int length, | 182 const uint16_t* command, int length, |
177 ClientData* client_data = NULL); | 183 ClientData* client_data = NULL); |
178 | 184 |
179 /** | 185 /** |
180 * Run a JavaScript function in the debugger. | 186 * Run a JavaScript function in the debugger. |
181 * \param fun the function to call | 187 * \param fun the function to call |
182 * \param data passed as second argument to the function | 188 * \param data passed as second argument to the function |
183 * With this call the debugger is entered and the function specified is called | 189 * With this call the debugger is entered and the function specified is called |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 * 2. It should be invoked with the same precautions and from the same context | 241 * 2. It should be invoked with the same precautions and from the same context |
236 * as V8 script would be invoked from, because: | 242 * as V8 script would be invoked from, because: |
237 * a. with "evaluate" command it can do whatever normal script can do, | 243 * a. with "evaluate" command it can do whatever normal script can do, |
238 * including all native calls; | 244 * including all native calls; |
239 * b. no other thread should call V8 while this method is running | 245 * b. no other thread should call V8 while this method is running |
240 * (v8::Locker may be used here). | 246 * (v8::Locker may be used here). |
241 * | 247 * |
242 * "Evaluate" debug command behavior currently is not specified in scope | 248 * "Evaluate" debug command behavior currently is not specified in scope |
243 * of this method. | 249 * of this method. |
244 */ | 250 */ |
245 static void ProcessDebugMessages(); | 251 static void ProcessDebugMessages(Isolate* isolate); |
| 252 V8_DEPRECATE_SOON("Use version with an Isolate", |
| 253 static void ProcessDebugMessages()); |
246 | 254 |
247 /** | 255 /** |
248 * Debugger is running in its own context which is entered while debugger | 256 * Debugger is running in its own context which is entered while debugger |
249 * messages are being dispatched. This is an explicit getter for this | 257 * messages are being dispatched. This is an explicit getter for this |
250 * debugger context. Note that the content of the debugger context is subject | 258 * debugger context. Note that the content of the debugger context is subject |
251 * to change. The Context exists only when the debugger is active, i.e. at | 259 * to change. The Context exists only when the debugger is active, i.e. at |
252 * least one DebugEventListener or MessageHandler is set. | 260 * least one DebugEventListener or MessageHandler is set. |
253 */ | 261 */ |
254 static Local<Context> GetDebugContext(); | 262 static Local<Context> GetDebugContext(Isolate* isolate); |
| 263 V8_DEPRECATE_SOON("Use version with an Isolate", |
| 264 static Local<Context> GetDebugContext()); |
255 | 265 |
256 | 266 |
257 /** | 267 /** |
258 * Enable/disable LiveEdit functionality for the given Isolate | 268 * Enable/disable LiveEdit functionality for the given Isolate |
259 * (default Isolate if not provided). V8 will abort if LiveEdit is | 269 * (default Isolate if not provided). V8 will abort if LiveEdit is |
260 * unexpectedly used. LiveEdit is enabled by default. | 270 * unexpectedly used. LiveEdit is enabled by default. |
261 */ | 271 */ |
262 static void SetLiveEditEnabled(Isolate* isolate, bool enable); | 272 static void SetLiveEditEnabled(Isolate* isolate, bool enable); |
263 | 273 |
264 /** | 274 /** |
265 * Returns array of internal properties specific to the value type. Result has | 275 * Returns array of internal properties specific to the value type. Result has |
266 * the following format: [<name>, <value>,...,<name>, <value>]. Result array | 276 * the following format: [<name>, <value>,...,<name>, <value>]. Result array |
267 * will be allocated in the current context. | 277 * will be allocated in the current context. |
268 */ | 278 */ |
269 static MaybeLocal<Array> GetInternalProperties(Isolate* isolate, | 279 static MaybeLocal<Array> GetInternalProperties(Isolate* isolate, |
270 Local<Value> value); | 280 Local<Value> value); |
271 }; | 281 }; |
272 | 282 |
273 | 283 |
274 } // namespace v8 | 284 } // namespace v8 |
275 | 285 |
276 | 286 |
277 #undef EXPORT | 287 #undef EXPORT |
278 | 288 |
279 | 289 |
280 #endif // V8_V8_DEBUG_H_ | 290 #endif // V8_V8_DEBUG_H_ |
OLD | NEW |