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" | 8 #include "v8.h" |
9 | 9 |
10 /** | 10 /** |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 }; | 130 }; |
131 | 131 |
132 /** | 132 /** |
133 * Debug event callback function. | 133 * Debug event callback function. |
134 * | 134 * |
135 * \param event_details object providing information about the debug event | 135 * \param event_details object providing information about the debug event |
136 * | 136 * |
137 * A EventCallback2 does not take possession of the event data, | 137 * A EventCallback2 does not take possession of the event data, |
138 * and must not rely on the data persisting after the handler returns. | 138 * and must not rely on the data persisting after the handler returns. |
139 */ | 139 */ |
140 typedef void (*EventCallback2)(const EventDetails& event_details); | 140 typedef void (*EventCallback)(const EventDetails& event_details); |
| 141 |
| 142 // TODO(yangguo) Deprecate this. |
| 143 typedef EventCallback EventCallback2; |
141 | 144 |
142 /** | 145 /** |
143 * Debug message callback function. | 146 * Debug message callback function. |
144 * | 147 * |
145 * \param message the debug message handler message object | 148 * \param message the debug message handler message object |
146 * | 149 * |
147 * A MessageHandler2 does not take possession of the message data, | 150 * A MessageHandler2 does not take possession of the message data, |
148 * and must not rely on the data persisting after the handler returns. | 151 * and must not rely on the data persisting after the handler returns. |
149 */ | 152 */ |
150 typedef void (*MessageHandler2)(const Message& message); | 153 typedef void (*MessageHandler)(const Message& message); |
| 154 |
| 155 // TODO(yangguo) Deprecate this. |
| 156 typedef MessageHandler MessageHandler2; |
151 | 157 |
152 /** | 158 /** |
153 * Callback function for the host to ensure debug messages are processed. | 159 * Callback function for the host to ensure debug messages are processed. |
154 */ | 160 */ |
155 typedef void (*DebugMessageDispatchHandler)(); | 161 typedef void (*DebugMessageDispatchHandler)(); |
156 | 162 |
| 163 static bool SetDebugEventListener(EventCallback that, |
| 164 Handle<Value> data = Handle<Value>()); |
| 165 |
| 166 // TODO(yangguo) Deprecate this. |
157 static bool SetDebugEventListener2(EventCallback2 that, | 167 static bool SetDebugEventListener2(EventCallback2 that, |
158 Handle<Value> data = Handle<Value>()); | 168 Handle<Value> data = Handle<Value>()) { |
| 169 return SetDebugEventListener(that, data); |
| 170 } |
159 | 171 |
160 // Schedule a debugger break to happen when JavaScript code is run | 172 // Schedule a debugger break to happen when JavaScript code is run |
161 // in the given isolate. | 173 // in the given isolate. |
162 static void DebugBreak(Isolate* isolate); | 174 static void DebugBreak(Isolate* isolate); |
163 | 175 |
164 // Remove scheduled debugger break in given isolate if it has not | 176 // Remove scheduled debugger break in given isolate if it has not |
165 // happened yet. | 177 // happened yet. |
166 static void CancelDebugBreak(Isolate* isolate); | 178 static void CancelDebugBreak(Isolate* isolate); |
167 | 179 |
168 // Break execution of JavaScript in the given isolate (this method | 180 // Break execution of JavaScript in the given isolate (this method |
169 // can be invoked from a non-VM thread) for further client command | 181 // can be invoked from a non-VM thread) for further client command |
170 // execution on a VM thread. Client data is then passed in | 182 // execution on a VM thread. Client data is then passed in |
171 // EventDetails to EventCallback2 at the moment when the VM actually | 183 // EventDetails to EventCallback2 at the moment when the VM actually |
172 // stops. | 184 // stops. |
173 static void DebugBreakForCommand(Isolate* isolate, ClientData* data); | 185 static void DebugBreakForCommand(Isolate* isolate, ClientData* data); |
174 | 186 |
175 // TODO(svenpanne) Remove this when Chrome is updated. | 187 // TODO(svenpanne) Remove this when Chrome is updated. |
176 static void DebugBreakForCommand(ClientData* data, Isolate* isolate) { | 188 static void DebugBreakForCommand(ClientData* data, Isolate* isolate) { |
177 DebugBreakForCommand(isolate, data); | 189 DebugBreakForCommand(isolate, data); |
178 } | 190 } |
179 | 191 |
180 // Message based interface. The message protocol is JSON. | 192 // Message based interface. The message protocol is JSON. |
181 static void SetMessageHandler2(MessageHandler2 handler); | 193 static void SetMessageHandler(MessageHandler handler); |
| 194 |
| 195 // TODO(yangguo) Deprecate this. |
| 196 static void SetMessageHandler2(MessageHandler2 handler) { |
| 197 SetMessageHandler(handler); |
| 198 } |
182 | 199 |
183 static void SendCommand(Isolate* isolate, | 200 static void SendCommand(Isolate* isolate, |
184 const uint16_t* command, int length, | 201 const uint16_t* command, int length, |
185 ClientData* client_data = NULL); | 202 ClientData* client_data = NULL); |
186 | 203 |
187 /** | 204 /** |
188 * Register a callback function to be called when a debug message has been | 205 * Register a callback function to be called when a debug message has been |
189 * received and is ready to be processed. For the debug messages to be | 206 * received and is ready to be processed. For the debug messages to be |
190 * processed V8 needs to be entered, and in certain embedding scenarios this | 207 * processed V8 needs to be entered, and in certain embedding scenarios this |
191 * callback can be used to make sure V8 is entered for the debug message to | 208 * callback can be used to make sure V8 is entered for the debug message to |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 }; | 317 }; |
301 | 318 |
302 | 319 |
303 } // namespace v8 | 320 } // namespace v8 |
304 | 321 |
305 | 322 |
306 #undef EXPORT | 323 #undef EXPORT |
307 | 324 |
308 | 325 |
309 #endif // V8_V8_DEBUG_H_ | 326 #endif // V8_V8_DEBUG_H_ |
OLD | NEW |