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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 * Indicate whether this is a response to a continue command which will | 53 * Indicate whether this is a response to a continue command which will |
54 * start the VM running after this is processed. | 54 * start the VM running after this is processed. |
55 */ | 55 */ |
56 virtual bool WillStartRunning() const = 0; | 56 virtual bool WillStartRunning() const = 0; |
57 | 57 |
58 /** | 58 /** |
59 * Access to execution state and event data. Don't store these cross | 59 * Access to execution state and event data. Don't store these cross |
60 * callbacks as their content becomes invalid. These objects are from the | 60 * callbacks as their content becomes invalid. These objects are from the |
61 * debugger event that started the debug message loop. | 61 * debugger event that started the debug message loop. |
62 */ | 62 */ |
63 virtual Handle<Object> GetExecutionState() const = 0; | 63 virtual Local<Object> GetExecutionState() const = 0; |
64 virtual Handle<Object> GetEventData() const = 0; | 64 virtual Local<Object> GetEventData() const = 0; |
65 | 65 |
66 /** | 66 /** |
67 * Get the debugger protocol JSON. | 67 * Get the debugger protocol JSON. |
68 */ | 68 */ |
69 virtual Handle<String> GetJSON() const = 0; | 69 virtual Local<String> GetJSON() const = 0; |
70 | 70 |
71 /** | 71 /** |
72 * Get the context active when the debug event happened. Note this is not | 72 * Get the context active when the debug event happened. Note this is not |
73 * the current active context as the JavaScript part of the debugger is | 73 * the current active context as the JavaScript part of the debugger is |
74 * running in its own context which is entered at this point. | 74 * running in its own context which is entered at this point. |
75 */ | 75 */ |
76 virtual Handle<Context> GetEventContext() const = 0; | 76 virtual Local<Context> GetEventContext() const = 0; |
77 | 77 |
78 /** | 78 /** |
79 * Client data passed with the corresponding request if any. This is the | 79 * Client data passed with the corresponding request if any. This is the |
80 * client_data data value passed into Debug::SendCommand along with the | 80 * client_data data value passed into Debug::SendCommand along with the |
81 * request that led to the message or NULL if the message is an event. The | 81 * request that led to the message or NULL if the message is an event. The |
82 * debugger takes ownership of the data and will delete it even if there is | 82 * debugger takes ownership of the data and will delete it even if there is |
83 * no message handler. | 83 * no message handler. |
84 */ | 84 */ |
85 virtual ClientData* GetClientData() const = 0; | 85 virtual ClientData* GetClientData() const = 0; |
86 | 86 |
(...skipping 10 matching lines...) Expand all Loading... |
97 public: | 97 public: |
98 /** | 98 /** |
99 * Event type. | 99 * Event type. |
100 */ | 100 */ |
101 virtual DebugEvent GetEvent() const = 0; | 101 virtual DebugEvent GetEvent() const = 0; |
102 | 102 |
103 /** | 103 /** |
104 * Access to execution state and event data of the debug event. Don't store | 104 * Access to execution state and event data of the debug event. Don't store |
105 * these cross callbacks as their content becomes invalid. | 105 * these cross callbacks as their content becomes invalid. |
106 */ | 106 */ |
107 virtual Handle<Object> GetExecutionState() const = 0; | 107 virtual Local<Object> GetExecutionState() const = 0; |
108 virtual Handle<Object> GetEventData() const = 0; | 108 virtual Local<Object> GetEventData() const = 0; |
109 | 109 |
110 /** | 110 /** |
111 * Get the context active when the debug event happened. Note this is not | 111 * Get the context active when the debug event happened. Note this is not |
112 * the current active context as the JavaScript part of the debugger is | 112 * the current active context as the JavaScript part of the debugger is |
113 * running in its own context which is entered at this point. | 113 * running in its own context which is entered at this point. |
114 */ | 114 */ |
115 virtual Handle<Context> GetEventContext() const = 0; | 115 virtual Local<Context> GetEventContext() const = 0; |
116 | 116 |
117 /** | 117 /** |
118 * Client data passed with the corresponding callback when it was | 118 * Client data passed with the corresponding callback when it was |
119 * registered. | 119 * registered. |
120 */ | 120 */ |
121 virtual Handle<Value> GetCallbackData() const = 0; | 121 virtual Local<Value> GetCallbackData() const = 0; |
122 | 122 |
123 /** | 123 /** |
124 * Client data passed to DebugBreakForCommand function. The | 124 * Client data passed to DebugBreakForCommand function. The |
125 * debugger takes ownership of the data and will delete it even if | 125 * debugger takes ownership of the data and will delete it even if |
126 * there is no message handler. | 126 * there is no message handler. |
127 */ | 127 */ |
128 virtual ClientData* GetClientData() const = 0; | 128 virtual ClientData* GetClientData() const = 0; |
129 | 129 |
130 virtual ~EventDetails() {} | 130 virtual ~EventDetails() {} |
131 }; | 131 }; |
(...skipping 17 matching lines...) Expand all Loading... |
149 * and must not rely on the data persisting after the handler returns. | 149 * and must not rely on the data persisting after the handler returns. |
150 */ | 150 */ |
151 typedef void (*MessageHandler)(const Message& message); | 151 typedef void (*MessageHandler)(const Message& message); |
152 | 152 |
153 /** | 153 /** |
154 * Callback function for the host to ensure debug messages are processed. | 154 * Callback function for the host to ensure debug messages are processed. |
155 */ | 155 */ |
156 typedef void (*DebugMessageDispatchHandler)(); | 156 typedef void (*DebugMessageDispatchHandler)(); |
157 | 157 |
158 static bool SetDebugEventListener(EventCallback that, | 158 static bool SetDebugEventListener(EventCallback that, |
159 Handle<Value> data = Handle<Value>()); | 159 Local<Value> data = Local<Value>()); |
160 | 160 |
161 // Schedule a debugger break to happen when JavaScript code is run | 161 // Schedule a debugger break to happen when JavaScript code is run |
162 // in the given isolate. | 162 // in the given isolate. |
163 static void DebugBreak(Isolate* isolate); | 163 static void DebugBreak(Isolate* isolate); |
164 | 164 |
165 // Remove scheduled debugger break in given isolate if it has not | 165 // Remove scheduled debugger break in given isolate if it has not |
166 // happened yet. | 166 // happened yet. |
167 static void CancelDebugBreak(Isolate* isolate); | 167 static void CancelDebugBreak(Isolate* isolate); |
168 | 168 |
169 // Check if a debugger break is scheduled in the given isolate. | 169 // Check if a debugger break is scheduled in the given isolate. |
(...skipping 19 matching lines...) Expand all Loading... |
189 * v8::Debug::Call will return the current line of JavaScript execution. | 189 * v8::Debug::Call will return the current line of JavaScript execution. |
190 * | 190 * |
191 * \code | 191 * \code |
192 * function frame_source_line(exec_state) { | 192 * function frame_source_line(exec_state) { |
193 * return exec_state.frame(0).sourceLine(); | 193 * return exec_state.frame(0).sourceLine(); |
194 * } | 194 * } |
195 * \endcode | 195 * \endcode |
196 */ | 196 */ |
197 static V8_DEPRECATE_SOON( | 197 static V8_DEPRECATE_SOON( |
198 "Use maybe version", | 198 "Use maybe version", |
199 Local<Value> Call(v8::Handle<v8::Function> fun, | 199 Local<Value> Call(v8::Local<v8::Function> fun, |
200 Handle<Value> data = Handle<Value>())); | 200 Local<Value> data = Local<Value>())); |
201 // TODO(dcarney): data arg should be a MaybeLocal | 201 // TODO(dcarney): data arg should be a MaybeLocal |
202 static MaybeLocal<Value> Call(Local<Context> context, | 202 static MaybeLocal<Value> Call(Local<Context> context, |
203 v8::Handle<v8::Function> fun, | 203 v8::Local<v8::Function> fun, |
204 Handle<Value> data = Handle<Value>()); | 204 Local<Value> data = Local<Value>()); |
205 | 205 |
206 /** | 206 /** |
207 * Returns a mirror object for the given object. | 207 * Returns a mirror object for the given object. |
208 */ | 208 */ |
209 static V8_DEPRECATE_SOON("Use maybe version", | 209 static V8_DEPRECATE_SOON("Use maybe version", |
210 Local<Value> GetMirror(v8::Handle<v8::Value> obj)); | 210 Local<Value> GetMirror(v8::Local<v8::Value> obj)); |
211 static MaybeLocal<Value> GetMirror(Local<Context> context, | 211 static MaybeLocal<Value> GetMirror(Local<Context> context, |
212 v8::Handle<v8::Value> obj); | 212 v8::Local<v8::Value> obj); |
213 | 213 |
214 /** | 214 /** |
215 * Makes V8 process all pending debug messages. | 215 * Makes V8 process all pending debug messages. |
216 * | 216 * |
217 * From V8 point of view all debug messages come asynchronously (e.g. from | 217 * From V8 point of view all debug messages come asynchronously (e.g. from |
218 * remote debugger) but they all must be handled synchronously: V8 cannot | 218 * remote debugger) but they all must be handled synchronously: V8 cannot |
219 * do 2 things at one time so normal script execution must be interrupted | 219 * do 2 things at one time so normal script execution must be interrupted |
220 * for a while. | 220 * for a while. |
221 * | 221 * |
222 * Generally when message arrives V8 may be in one of 3 states: | 222 * Generally when message arrives V8 may be in one of 3 states: |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 }; | 271 }; |
272 | 272 |
273 | 273 |
274 } // namespace v8 | 274 } // namespace v8 |
275 | 275 |
276 | 276 |
277 #undef EXPORT | 277 #undef EXPORT |
278 | 278 |
279 | 279 |
280 #endif // V8_V8_DEBUG_H_ | 280 #endif // V8_V8_DEBUG_H_ |
OLD | NEW |