Chromium Code Reviews| 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" // NOLINT(build/include) | 8 #include "v8.h" // NOLINT(build/include) |
| 9 | 9 |
| 10 /** | 10 /** |
| 11 * Debugger support for the V8 JavaScript engine. | 11 * Debugger support for the V8 JavaScript engine. |
| 12 */ | 12 */ |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 | 14 |
| 15 // Debug events which can occur in the V8 JavaScript engine. | 15 // Debug events which can occur in the V8 JavaScript engine. |
| 16 enum DebugEvent { | 16 enum DebugEvent { |
| 17 Break = 1, | 17 Break = 1, |
| 18 Exception = 2, | 18 Exception = 2, |
| 19 AfterCompile = 3, | 19 NewFunction = 3, |
| 20 CompileError = 4, | 20 BeforeCompile = 4, |
| 21 AsyncTaskEvent = 5, | 21 AfterCompile = 5, |
| 22 CompileError = 6, | |
| 23 AsyncTaskEvent = 7, | |
|
Yang
2016/12/01 09:04:33
we probably dont have to revert this part.
| |
| 22 }; | 24 }; |
| 23 | 25 |
| 24 class V8_EXPORT Debug { | 26 class V8_EXPORT Debug { |
| 25 public: | 27 public: |
| 26 /** | 28 /** |
| 27 * A client object passed to the v8 debugger whose ownership will be taken by | 29 * A client object passed to the v8 debugger whose ownership will be taken by |
| 28 * it. v8 is always responsible for deleting the object. | 30 * it. v8 is always responsible for deleting the object. |
| 29 */ | 31 */ |
| 30 class ClientData { | 32 class ClientData { |
| 31 public: | 33 public: |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 * A EventCallback2 does not take possession of the event data, | 137 * A EventCallback2 does not take possession of the event data, |
| 136 * 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. |
| 137 */ | 139 */ |
| 138 typedef void (*EventCallback)(const EventDetails& event_details); | 140 typedef void (*EventCallback)(const EventDetails& event_details); |
| 139 | 141 |
| 140 /** | 142 /** |
| 141 * Debug message callback function. | 143 * Debug message callback function. |
| 142 * | 144 * |
| 143 * \param message the debug message handler message object | 145 * \param message the debug message handler message object |
| 144 * | 146 * |
| 145 * A MessageHandler does not take possession of the message data, | 147 * A MessageHandler2 does not take possession of the message data, |
| 146 * 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. |
| 147 */ | 149 */ |
| 148 typedef void (*MessageHandler)(const Message& message); | 150 typedef void (*MessageHandler)(const Message& message); |
| 149 | 151 |
| 150 /** | 152 /** |
| 151 * Callback function for the host to ensure debug messages are processed. | 153 * Callback function for the host to ensure debug messages are processed. |
| 152 */ | 154 */ |
| 153 typedef void (*DebugMessageDispatchHandler)(); | 155 typedef void (*DebugMessageDispatchHandler)(); |
| 154 | 156 |
| 155 static bool SetDebugEventListener(Isolate* isolate, EventCallback that, | 157 static bool SetDebugEventListener(Isolate* isolate, EventCallback that, |
| 156 Local<Value> data = Local<Value>()); | 158 Local<Value> data = Local<Value>()); |
| 157 | 159 |
| 158 // Schedule a debugger break to happen when JavaScript code is run | 160 // Schedule a debugger break to happen when JavaScript code is run |
| 159 // in the given isolate. | 161 // in the given isolate. |
| 160 static void DebugBreak(Isolate* isolate); | 162 static void DebugBreak(Isolate* isolate); |
| 161 | 163 |
| 162 // Remove scheduled debugger break in given isolate if it has not | 164 // Remove scheduled debugger break in given isolate if it has not |
| 163 // happened yet. | 165 // happened yet. |
| 164 static void CancelDebugBreak(Isolate* isolate); | 166 static void CancelDebugBreak(Isolate* isolate); |
| 165 | 167 |
| 166 // Check if a debugger break is scheduled in the given isolate. | 168 // Check if a debugger break is scheduled in the given isolate. |
| 167 V8_DEPRECATED("No longer supported", | 169 static bool CheckDebugBreak(Isolate* isolate); |
| 168 static bool CheckDebugBreak(Isolate* isolate)); | |
| 169 | 170 |
| 170 // Message based interface. The message protocol is JSON. | 171 // Message based interface. The message protocol is JSON. |
| 171 V8_DEPRECATED("No longer supported", | 172 V8_DEPRECATED("No longer supported", |
| 172 static void SetMessageHandler(Isolate* isolate, | 173 static void SetMessageHandler(Isolate* isolate, |
| 173 MessageHandler handler)); | 174 MessageHandler handler)); |
| 174 | 175 |
| 175 V8_DEPRECATED("No longer supported", | 176 V8_DEPRECATED("No longer supported", |
| 176 static void SendCommand(Isolate* isolate, | 177 static void SendCommand(Isolate* isolate, |
| 177 const uint16_t* command, int length, | 178 const uint16_t* command, int length, |
| 178 ClientData* client_data = NULL)); | 179 ClientData* client_data = NULL)); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 196 * \endcode | 197 * \endcode |
| 197 */ | 198 */ |
| 198 // TODO(dcarney): data arg should be a MaybeLocal | 199 // TODO(dcarney): data arg should be a MaybeLocal |
| 199 static MaybeLocal<Value> Call(Local<Context> context, | 200 static MaybeLocal<Value> Call(Local<Context> context, |
| 200 v8::Local<v8::Function> fun, | 201 v8::Local<v8::Function> fun, |
| 201 Local<Value> data = Local<Value>()); | 202 Local<Value> data = Local<Value>()); |
| 202 | 203 |
| 203 /** | 204 /** |
| 204 * Returns a mirror object for the given object. | 205 * Returns a mirror object for the given object. |
| 205 */ | 206 */ |
| 206 V8_DEPRECATED("No longer supported", | 207 static MaybeLocal<Value> GetMirror(Local<Context> context, |
| 207 static MaybeLocal<Value> GetMirror(Local<Context> context, | 208 v8::Local<v8::Value> obj); |
| 208 v8::Local<v8::Value> obj)); | |
| 209 | 209 |
| 210 /** | 210 /** |
| 211 * Makes V8 process all pending debug messages. | 211 * Makes V8 process all pending debug messages. |
| 212 * | 212 * |
| 213 * From V8 point of view all debug messages come asynchronously (e.g. from | 213 * From V8 point of view all debug messages come asynchronously (e.g. from |
| 214 * remote debugger) but they all must be handled synchronously: V8 cannot | 214 * remote debugger) but they all must be handled synchronously: V8 cannot |
| 215 * do 2 things at one time so normal script execution must be interrupted | 215 * do 2 things at one time so normal script execution must be interrupted |
| 216 * for a while. | 216 * for a while. |
| 217 * | 217 * |
| 218 * Generally when message arrives V8 may be in one of 3 states: | 218 * Generally when message arrives V8 may be in one of 3 states: |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 247 * debugger context. Note that the content of the debugger context is subject | 247 * debugger context. Note that the content of the debugger context is subject |
| 248 * to change. The Context exists only when the debugger is active, i.e. at | 248 * to change. The Context exists only when the debugger is active, i.e. at |
| 249 * least one DebugEventListener or MessageHandler is set. | 249 * least one DebugEventListener or MessageHandler is set. |
| 250 */ | 250 */ |
| 251 static Local<Context> GetDebugContext(Isolate* isolate); | 251 static Local<Context> GetDebugContext(Isolate* isolate); |
| 252 | 252 |
| 253 /** | 253 /** |
| 254 * While in the debug context, this method returns the top-most non-debug | 254 * While in the debug context, this method returns the top-most non-debug |
| 255 * context, if it exists. | 255 * context, if it exists. |
| 256 */ | 256 */ |
| 257 V8_DEPRECATED( | 257 static MaybeLocal<Context> GetDebuggedContext(Isolate* isolate); |
|
Yang
2016/12/01 09:04:33
let's keep marking these APIs as deprecated.
| |
| 258 "No longer supported", | |
| 259 static MaybeLocal<Context> GetDebuggedContext(Isolate* isolate)); | |
| 260 | 258 |
| 261 /** | 259 /** |
| 262 * Enable/disable LiveEdit functionality for the given Isolate | 260 * Enable/disable LiveEdit functionality for the given Isolate |
| 263 * (default Isolate if not provided). V8 will abort if LiveEdit is | 261 * (default Isolate if not provided). V8 will abort if LiveEdit is |
| 264 * unexpectedly used. LiveEdit is enabled by default. | 262 * unexpectedly used. LiveEdit is enabled by default. |
| 265 */ | 263 */ |
| 266 static void SetLiveEditEnabled(Isolate* isolate, bool enable); | 264 static void SetLiveEditEnabled(Isolate* isolate, bool enable); |
| 267 | 265 |
| 268 /** | 266 /** |
| 269 * Returns array of internal properties specific to the value type. Result has | 267 * Returns array of internal properties specific to the value type. Result has |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 283 }; | 281 }; |
| 284 | 282 |
| 285 | 283 |
| 286 } // namespace v8 | 284 } // namespace v8 |
| 287 | 285 |
| 288 | 286 |
| 289 #undef EXPORT | 287 #undef EXPORT |
| 290 | 288 |
| 291 | 289 |
| 292 #endif // V8_V8_DEBUG_H_ | 290 #endif // V8_V8_DEBUG_H_ |
| OLD | NEW |