| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 * Debug message callback function. | 143 * Debug message callback function. |
| 144 * | 144 * |
| 145 * \param message the debug message handler message object | 145 * \param message the debug message handler message object |
| 146 * | 146 * |
| 147 * A MessageHandler2 does not take possession of the message data, | 147 * A MessageHandler2 does not take possession of the message data, |
| 148 * 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. |
| 149 */ | 149 */ |
| 150 typedef void (*MessageHandler2)(const Message& message); | 150 typedef void (*MessageHandler2)(const Message& message); |
| 151 | 151 |
| 152 /** | 152 /** |
| 153 * Debug host dispatch callback function. | |
| 154 */ | |
| 155 typedef void (*HostDispatchHandler)(); | |
| 156 | |
| 157 /** | |
| 158 * Callback function for the host to ensure debug messages are processed. | 153 * Callback function for the host to ensure debug messages are processed. |
| 159 */ | 154 */ |
| 160 typedef void (*DebugMessageDispatchHandler)(); | 155 typedef void (*DebugMessageDispatchHandler)(); |
| 161 | 156 |
| 162 static bool SetDebugEventListener2(EventCallback2 that, | 157 static bool SetDebugEventListener2(EventCallback2 that, |
| 163 Handle<Value> data = Handle<Value>()); | 158 Handle<Value> data = Handle<Value>()); |
| 164 | 159 |
| 165 // Set a JavaScript debug event listener. | |
| 166 static bool SetDebugEventListener(v8::Handle<v8::Object> that, | |
| 167 Handle<Value> data = Handle<Value>()); | |
| 168 | |
| 169 // Schedule a debugger break to happen when JavaScript code is run | 160 // Schedule a debugger break to happen when JavaScript code is run |
| 170 // in the given isolate. | 161 // in the given isolate. |
| 171 static void DebugBreak(Isolate* isolate); | 162 static void DebugBreak(Isolate* isolate); |
| 172 | 163 |
| 173 // Remove scheduled debugger break in given isolate if it has not | 164 // Remove scheduled debugger break in given isolate if it has not |
| 174 // happened yet. | 165 // happened yet. |
| 175 static void CancelDebugBreak(Isolate* isolate); | 166 static void CancelDebugBreak(Isolate* isolate); |
| 176 | 167 |
| 177 // Break execution of JavaScript in the given isolate (this method | 168 // Break execution of JavaScript in the given isolate (this method |
| 178 // 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 |
| 179 // execution on a VM thread. Client data is then passed in | 170 // execution on a VM thread. Client data is then passed in |
| 180 // EventDetails to EventCallback2 at the moment when the VM actually | 171 // EventDetails to EventCallback2 at the moment when the VM actually |
| 181 // stops. | 172 // stops. |
| 182 static void DebugBreakForCommand(Isolate* isolate, ClientData* data); | 173 static void DebugBreakForCommand(Isolate* isolate, ClientData* data); |
| 183 | 174 |
| 184 // TODO(svenpanne) Remove this when Chrome is updated. | 175 // TODO(svenpanne) Remove this when Chrome is updated. |
| 185 static void DebugBreakForCommand(ClientData* data, Isolate* isolate) { | 176 static void DebugBreakForCommand(ClientData* data, Isolate* isolate) { |
| 186 DebugBreakForCommand(isolate, data); | 177 DebugBreakForCommand(isolate, data); |
| 187 } | 178 } |
| 188 | 179 |
| 189 // Message based interface. The message protocol is JSON. | 180 // Message based interface. The message protocol is JSON. |
| 190 static void SetMessageHandler2(MessageHandler2 handler); | 181 static void SetMessageHandler2(MessageHandler2 handler); |
| 191 | 182 |
| 192 static void SendCommand(Isolate* isolate, | 183 static void SendCommand(Isolate* isolate, |
| 193 const uint16_t* command, int length, | 184 const uint16_t* command, int length, |
| 194 ClientData* client_data = NULL); | 185 ClientData* client_data = NULL); |
| 195 | 186 |
| 196 // Dispatch interface. | |
| 197 static void SetHostDispatchHandler(HostDispatchHandler handler, | |
| 198 int period = 100); | |
| 199 | |
| 200 /** | 187 /** |
| 201 * Register a callback function to be called when a debug message has been | 188 * Register a callback function to be called when a debug message has been |
| 202 * received and is ready to be processed. For the debug messages to be | 189 * received and is ready to be processed. For the debug messages to be |
| 203 * processed V8 needs to be entered, and in certain embedding scenarios this | 190 * processed V8 needs to be entered, and in certain embedding scenarios this |
| 204 * callback can be used to make sure V8 is entered for the debug message to | 191 * callback can be used to make sure V8 is entered for the debug message to |
| 205 * be processed. Note that debug messages will only be processed if there is | 192 * be processed. Note that debug messages will only be processed if there is |
| 206 * a V8 break. This can happen automatically by using the option | 193 * a V8 break. This can happen automatically by using the option |
| 207 * --debugger-auto-break. | 194 * --debugger-auto-break. |
| 208 * \param provide_locker requires that V8 acquires v8::Locker for you before | 195 * \param provide_locker requires that V8 acquires v8::Locker for you before |
| 209 * calling handler | 196 * calling handler |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 }; | 300 }; |
| 314 | 301 |
| 315 | 302 |
| 316 } // namespace v8 | 303 } // namespace v8 |
| 317 | 304 |
| 318 | 305 |
| 319 #undef EXPORT | 306 #undef EXPORT |
| 320 | 307 |
| 321 | 308 |
| 322 #endif // V8_V8_DEBUG_H_ | 309 #endif // V8_V8_DEBUG_H_ |
| OLD | NEW |