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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 * debugger takes ownership of the data and will delete it even if there is | 137 * debugger takes ownership of the data and will delete it even if there is |
138 * no message handler. | 138 * no message handler. |
139 */ | 139 */ |
140 virtual ClientData* GetClientData() const = 0; | 140 virtual ClientData* GetClientData() const = 0; |
141 | 141 |
142 virtual ~Message() {} | 142 virtual ~Message() {} |
143 }; | 143 }; |
144 | 144 |
145 | 145 |
146 /** | 146 /** |
| 147 * An event details object passed to the debug event listener. |
| 148 */ |
| 149 class EventDetails { |
| 150 public: |
| 151 /** |
| 152 * Event type. |
| 153 */ |
| 154 virtual DebugEvent GetEvent() const = 0; |
| 155 |
| 156 /** |
| 157 * Access to execution state and event data of the debug event. Don't store |
| 158 * these cross callbacks as their content becomes invalid. |
| 159 */ |
| 160 virtual Handle<Object> GetExecutionState() const = 0; |
| 161 virtual Handle<Object> GetEventData() const = 0; |
| 162 |
| 163 /** |
| 164 * Get the context active when the debug event happened. Note this is not |
| 165 * the current active context as the JavaScript part of the debugger is |
| 166 * running in it's own context which is entered at this point. |
| 167 */ |
| 168 virtual Handle<Context> GetEventContext() const = 0; |
| 169 |
| 170 /** |
| 171 * Client data passed with the corresponding callbak whet it was registered. |
| 172 */ |
| 173 virtual Handle<Value> GetCallbackData() const = 0; |
| 174 |
| 175 virtual ~EventDetails() {} |
| 176 }; |
| 177 |
| 178 |
| 179 /** |
147 * Debug event callback function. | 180 * Debug event callback function. |
148 * | 181 * |
149 * \param event the type of the debug event that triggered the callback | 182 * \param event the type of the debug event that triggered the callback |
150 * (enum DebugEvent) | 183 * (enum DebugEvent) |
151 * \param exec_state execution state (JavaScript object) | 184 * \param exec_state execution state (JavaScript object) |
152 * \param event_data event specific data (JavaScript object) | 185 * \param event_data event specific data (JavaScript object) |
153 * \param data value passed by the user to SetDebugEventListener | 186 * \param data value passed by the user to SetDebugEventListener |
154 */ | 187 */ |
155 typedef void (*EventCallback)(DebugEvent event, | 188 typedef void (*EventCallback)(DebugEvent event, |
156 Handle<Object> exec_state, | 189 Handle<Object> exec_state, |
157 Handle<Object> event_data, | 190 Handle<Object> event_data, |
158 Handle<Value> data); | 191 Handle<Value> data); |
159 | 192 |
| 193 /** |
| 194 * Debug event callback function. |
| 195 * |
| 196 * \param event_details object providing information about the debug event |
| 197 * |
| 198 * A EventCallback2 does not take possession of the event data, |
| 199 * and must not rely on the data persisting after the handler returns. |
| 200 */ |
| 201 typedef void (*EventCallback2)(const EventDetails& event_details); |
160 | 202 |
161 /** | 203 /** |
162 * Debug message callback function. | 204 * Debug message callback function. |
163 * | 205 * |
164 * \param message the debug message handler message object | 206 * \param message the debug message handler message object |
165 * \param length length of the message | 207 * \param length length of the message |
166 * \param client_data the data value passed when registering the message handl
er | 208 * \param client_data the data value passed when registering the message handl
er |
167 | 209 |
168 * A MessageHandler does not take posession of the message string, | 210 * A MessageHandler does not take possession of the message string, |
169 * and must not rely on the data persisting after the handler returns. | 211 * and must not rely on the data persisting after the handler returns. |
170 * | 212 * |
171 * This message handler is deprecated. Use MessageHandler2 instead. | 213 * This message handler is deprecated. Use MessageHandler2 instead. |
172 */ | 214 */ |
173 typedef void (*MessageHandler)(const uint16_t* message, int length, | 215 typedef void (*MessageHandler)(const uint16_t* message, int length, |
174 ClientData* client_data); | 216 ClientData* client_data); |
175 | 217 |
176 /** | 218 /** |
177 * Debug message callback function. | 219 * Debug message callback function. |
178 * | 220 * |
179 * \param message the debug message handler message object | 221 * \param message the debug message handler message object |
180 | 222 |
181 * A MessageHandler does not take posession of the message data, | 223 * A MessageHandler does not take possession of the message data, |
182 * and must not rely on the data persisting after the handler returns. | 224 * and must not rely on the data persisting after the handler returns. |
183 */ | 225 */ |
184 typedef void (*MessageHandler2)(const Message& message); | 226 typedef void (*MessageHandler2)(const Message& message); |
185 | 227 |
186 /** | 228 /** |
187 * Debug host dispatch callback function. | 229 * Debug host dispatch callback function. |
188 */ | 230 */ |
189 typedef void (*HostDispatchHandler)(); | 231 typedef void (*HostDispatchHandler)(); |
190 | 232 |
191 /** | 233 /** |
192 * Callback function for the host to ensure debug messages are processed. | 234 * Callback function for the host to ensure debug messages are processed. |
193 */ | 235 */ |
194 typedef void (*DebugMessageDispatchHandler)(); | 236 typedef void (*DebugMessageDispatchHandler)(); |
195 | 237 |
196 // Set a C debug event listener. | 238 // Set a C debug event listener. |
197 static bool SetDebugEventListener(EventCallback that, | 239 static bool SetDebugEventListener(EventCallback that, |
198 Handle<Value> data = Handle<Value>()); | 240 Handle<Value> data = Handle<Value>()); |
| 241 static bool SetDebugEventListener2(EventCallback2 that, |
| 242 Handle<Value> data = Handle<Value>()); |
199 | 243 |
200 // Set a JavaScript debug event listener. | 244 // Set a JavaScript debug event listener. |
201 static bool SetDebugEventListener(v8::Handle<v8::Object> that, | 245 static bool SetDebugEventListener(v8::Handle<v8::Object> that, |
202 Handle<Value> data = Handle<Value>()); | 246 Handle<Value> data = Handle<Value>()); |
203 | 247 |
204 // Break execution of JavaScript. | 248 // Break execution of JavaScript. |
205 static void DebugBreak(); | 249 static void DebugBreak(); |
206 | 250 |
207 // Message based interface. The message protocol is JSON. NOTE the message | 251 // Message based interface. The message protocol is JSON. NOTE the message |
208 // handler thread is not supported any more parameter must be false. | 252 // handler thread is not supported any more parameter must be false. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 }; | 358 }; |
315 | 359 |
316 | 360 |
317 } // namespace v8 | 361 } // namespace v8 |
318 | 362 |
319 | 363 |
320 #undef EXPORT | 364 #undef EXPORT |
321 | 365 |
322 | 366 |
323 #endif // V8_V8_DEBUG_H_ | 367 #endif // V8_V8_DEBUG_H_ |
OLD | NEW |