OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 /** | 143 /** |
144 * Client data passed to DebugBreakForCommand function. The | 144 * Client data passed to DebugBreakForCommand function. The |
145 * debugger takes ownership of the data and will delete it even if | 145 * debugger takes ownership of the data and will delete it even if |
146 * there is no message handler. | 146 * there is no message handler. |
147 */ | 147 */ |
148 virtual ClientData* GetClientData() const = 0; | 148 virtual ClientData* GetClientData() const = 0; |
149 | 149 |
150 virtual ~EventDetails() {} | 150 virtual ~EventDetails() {} |
151 }; | 151 }; |
152 | 152 |
153 | |
154 /** | 153 /** |
155 * Debug event callback function. | 154 * Debug event callback function. |
156 * | 155 * |
157 * \param event the type of the debug event that triggered the callback | |
158 * (enum DebugEvent) | |
159 * \param exec_state execution state (JavaScript object) | |
160 * \param event_data event specific data (JavaScript object) | |
161 * \param data value passed by the user to SetDebugEventListener | |
162 */ | |
163 typedef void (*EventCallback)(DebugEvent event, | |
164 Handle<Object> exec_state, | |
165 Handle<Object> event_data, | |
166 Handle<Value> data); | |
167 | |
168 /** | |
169 * Debug event callback function. | |
170 * | |
171 * \param event_details object providing information about the debug event | 156 * \param event_details object providing information about the debug event |
172 * | 157 * |
173 * A EventCallback2 does not take possession of the event data, | 158 * A EventCallback2 does not take possession of the event data, |
174 * and must not rely on the data persisting after the handler returns. | 159 * and must not rely on the data persisting after the handler returns. |
175 */ | 160 */ |
176 typedef void (*EventCallback2)(const EventDetails& event_details); | 161 typedef void (*EventCallback2)(const EventDetails& event_details); |
177 | 162 |
178 /** | 163 /** |
179 * Debug message callback function. | 164 * Debug message callback function. |
180 * | 165 * |
181 * \param message the debug message handler message object | 166 * \param message the debug message handler message object |
182 * \param length length of the message | |
183 * \param client_data the data value passed when registering the message handl
er | |
184 | |
185 * A MessageHandler does not take possession of the message string, | |
186 * and must not rely on the data persisting after the handler returns. | |
187 * | |
188 * This message handler is deprecated. Use MessageHandler2 instead. | |
189 */ | |
190 typedef void (*MessageHandler)(const uint16_t* message, int length, | |
191 ClientData* client_data); | |
192 | |
193 /** | |
194 * Debug message callback function. | |
195 * | |
196 * \param message the debug message handler message object | |
197 * | 167 * |
198 * A MessageHandler does not take possession of the message data, | 168 * A MessageHandler2 does not take possession of the message data, |
199 * and must not rely on the data persisting after the handler returns. | 169 * and must not rely on the data persisting after the handler returns. |
200 */ | 170 */ |
201 typedef void (*MessageHandler2)(const Message& message); | 171 typedef void (*MessageHandler2)(const Message& message); |
202 | 172 |
203 /** | 173 /** |
204 * Debug host dispatch callback function. | 174 * Debug host dispatch callback function. |
205 */ | 175 */ |
206 typedef void (*HostDispatchHandler)(); | 176 typedef void (*HostDispatchHandler)(); |
207 | 177 |
208 /** | 178 /** |
209 * Callback function for the host to ensure debug messages are processed. | 179 * Callback function for the host to ensure debug messages are processed. |
210 */ | 180 */ |
211 typedef void (*DebugMessageDispatchHandler)(); | 181 typedef void (*DebugMessageDispatchHandler)(); |
212 | 182 |
213 // Set a C debug event listener. | |
214 V8_DEPRECATED(static bool SetDebugEventListener( | |
215 EventCallback that, | |
216 Handle<Value> data = Handle<Value>())); | |
217 static bool SetDebugEventListener2(EventCallback2 that, | 183 static bool SetDebugEventListener2(EventCallback2 that, |
218 Handle<Value> data = Handle<Value>()); | 184 Handle<Value> data = Handle<Value>()); |
219 | 185 |
220 // Set a JavaScript debug event listener. | 186 // Set a JavaScript debug event listener. |
221 static bool SetDebugEventListener(v8::Handle<v8::Object> that, | 187 static bool SetDebugEventListener(v8::Handle<v8::Object> that, |
222 Handle<Value> data = Handle<Value>()); | 188 Handle<Value> data = Handle<Value>()); |
223 | 189 |
224 // Schedule a debugger break to happen when JavaScript code is run | 190 // Schedule a debugger break to happen when JavaScript code is run |
225 // in the given isolate. If no isolate is provided the default | 191 // in the given isolate. If no isolate is provided the default |
226 // isolate is used. | 192 // isolate is used. |
227 static void DebugBreak(Isolate* isolate = NULL); | 193 static void DebugBreak(Isolate* isolate = NULL); |
228 | 194 |
229 // Remove scheduled debugger break in given isolate if it has not | 195 // Remove scheduled debugger break in given isolate if it has not |
230 // happened yet. If no isolate is provided the default isolate is | 196 // happened yet. If no isolate is provided the default isolate is |
231 // used. | 197 // used. |
232 static void CancelDebugBreak(Isolate* isolate = NULL); | 198 static void CancelDebugBreak(Isolate* isolate = NULL); |
233 | 199 |
234 // Break execution of JavaScript in the given isolate (this method | 200 // Break execution of JavaScript in the given isolate (this method |
235 // can be invoked from a non-VM thread) for further client command | 201 // can be invoked from a non-VM thread) for further client command |
236 // execution on a VM thread. Client data is then passed in | 202 // execution on a VM thread. Client data is then passed in |
237 // EventDetails to EventCallback at the moment when the VM actually | 203 // EventDetails to EventCallback2 at the moment when the VM actually |
238 // stops. If no isolate is provided the default isolate is used. | 204 // stops. If no isolate is provided the default isolate is used. |
239 static void DebugBreakForCommand(ClientData* data = NULL, | 205 static void DebugBreakForCommand(ClientData* data = NULL, |
240 Isolate* isolate = NULL); | 206 Isolate* isolate = NULL); |
241 | 207 |
242 // Message based interface. The message protocol is JSON. NOTE the message | 208 // Message based interface. The message protocol is JSON. |
243 // handler thread is not supported any more parameter must be false. | |
244 V8_DEPRECATED(static void SetMessageHandler( | |
245 MessageHandler handler, | |
246 bool message_handler_thread = false)); | |
247 static void SetMessageHandler2(MessageHandler2 handler); | 209 static void SetMessageHandler2(MessageHandler2 handler); |
248 | 210 |
249 // If no isolate is provided the default isolate is | 211 // If no isolate is provided the default isolate is |
250 // used. | 212 // used. |
251 static void SendCommand(const uint16_t* command, int length, | 213 static void SendCommand(const uint16_t* command, int length, |
252 ClientData* client_data = NULL, | 214 ClientData* client_data = NULL, |
253 Isolate* isolate = NULL); | 215 Isolate* isolate = NULL); |
254 | 216 |
255 // Dispatch interface. | 217 // Dispatch interface. |
256 static void SetHostDispatchHandler(HostDispatchHandler handler, | 218 static void SetHostDispatchHandler(HostDispatchHandler handler, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 }; | 329 }; |
368 | 330 |
369 | 331 |
370 } // namespace v8 | 332 } // namespace v8 |
371 | 333 |
372 | 334 |
373 #undef EXPORT | 335 #undef EXPORT |
374 | 336 |
375 | 337 |
376 #endif // V8_V8_DEBUG_H_ | 338 #endif // V8_V8_DEBUG_H_ |
OLD | NEW |