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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 (*EventCallback)(const EventDetails& event_details); | 140 typedef void (*EventCallback)(const EventDetails& event_details); |
141 | 141 |
142 // TODO(yangguo) Deprecate this. | |
143 typedef EventCallback EventCallback2; | |
144 | |
145 /** | 142 /** |
146 * Debug message callback function. | 143 * Debug message callback function. |
147 * | 144 * |
148 * \param message the debug message handler message object | 145 * \param message the debug message handler message object |
149 * | 146 * |
150 * A MessageHandler2 does not take possession of the message data, | 147 * A MessageHandler2 does not take possession of the message data, |
151 * and must not rely on the data persisting after the handler returns. | 148 * and must not rely on the data persisting after the handler returns. |
152 */ | 149 */ |
153 typedef void (*MessageHandler)(const Message& message); | 150 typedef void (*MessageHandler)(const Message& message); |
154 | 151 |
155 // TODO(yangguo) Deprecate this. | |
156 typedef MessageHandler MessageHandler2; | |
157 | |
158 /** | 152 /** |
159 * Callback function for the host to ensure debug messages are processed. | 153 * Callback function for the host to ensure debug messages are processed. |
160 */ | 154 */ |
161 typedef void (*DebugMessageDispatchHandler)(); | 155 typedef void (*DebugMessageDispatchHandler)(); |
162 | 156 |
163 static bool SetDebugEventListener(EventCallback that, | 157 static bool SetDebugEventListener(EventCallback that, |
164 Handle<Value> data = Handle<Value>()); | 158 Handle<Value> data = Handle<Value>()); |
165 | 159 |
166 // TODO(yangguo) Deprecate this. | |
167 static bool SetDebugEventListener2(EventCallback2 that, | |
168 Handle<Value> data = Handle<Value>()) { | |
169 return SetDebugEventListener(that, data); | |
170 } | |
171 | |
172 // Schedule a debugger break to happen when JavaScript code is run | 160 // Schedule a debugger break to happen when JavaScript code is run |
173 // in the given isolate. | 161 // in the given isolate. |
174 static void DebugBreak(Isolate* isolate); | 162 static void DebugBreak(Isolate* isolate); |
175 | 163 |
176 // Remove scheduled debugger break in given isolate if it has not | 164 // Remove scheduled debugger break in given isolate if it has not |
177 // happened yet. | 165 // happened yet. |
178 static void CancelDebugBreak(Isolate* isolate); | 166 static void CancelDebugBreak(Isolate* isolate); |
179 | 167 |
180 // Break execution of JavaScript in the given isolate (this method | 168 // Break execution of JavaScript in the given isolate (this method |
181 // can be invoked from a non-VM thread) for further client command | 169 // can be invoked from a non-VM thread) for further client command |
182 // execution on a VM thread. Client data is then passed in | 170 // execution on a VM thread. Client data is then passed in |
183 // EventDetails to EventCallback2 at the moment when the VM actually | 171 // EventDetails to EventCallback2 at the moment when the VM actually |
184 // stops. | 172 // stops. |
185 static void DebugBreakForCommand(Isolate* isolate, ClientData* data); | 173 static void DebugBreakForCommand(Isolate* isolate, ClientData* data); |
186 | 174 |
187 // TODO(svenpanne) Remove this when Chrome is updated. | 175 // TODO(svenpanne) Remove this when Chrome is updated. |
188 static void DebugBreakForCommand(ClientData* data, Isolate* isolate) { | 176 static void DebugBreakForCommand(ClientData* data, Isolate* isolate) { |
189 DebugBreakForCommand(isolate, data); | 177 DebugBreakForCommand(isolate, data); |
190 } | 178 } |
191 | 179 |
192 // Message based interface. The message protocol is JSON. | 180 // Message based interface. The message protocol is JSON. |
193 static void SetMessageHandler(MessageHandler handler); | 181 static void SetMessageHandler(MessageHandler handler); |
194 | 182 |
195 // TODO(yangguo) Deprecate this. | |
196 static void SetMessageHandler2(MessageHandler2 handler) { | |
197 SetMessageHandler(handler); | |
198 } | |
199 | |
200 static void SendCommand(Isolate* isolate, | 183 static void SendCommand(Isolate* isolate, |
201 const uint16_t* command, int length, | 184 const uint16_t* command, int length, |
202 ClientData* client_data = NULL); | 185 ClientData* client_data = NULL); |
203 | 186 |
204 /** | 187 /** |
205 * Run a JavaScript function in the debugger. | 188 * Run a JavaScript function in the debugger. |
206 * \param fun the function to call | 189 * \param fun the function to call |
207 * \param data passed as second argument to the function | 190 * \param data passed as second argument to the function |
208 * With this call the debugger is entered and the function specified is called | 191 * With this call the debugger is entered and the function specified is called |
209 * with the execution state as the first argument. This makes it possible to | 192 * with the execution state as the first argument. This makes it possible to |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 }; | 266 }; |
284 | 267 |
285 | 268 |
286 } // namespace v8 | 269 } // namespace v8 |
287 | 270 |
288 | 271 |
289 #undef EXPORT | 272 #undef EXPORT |
290 | 273 |
291 | 274 |
292 #endif // V8_V8_DEBUG_H_ | 275 #endif // V8_V8_DEBUG_H_ |
OLD | NEW |