| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 | 81 |
| 82 /** | 82 /** |
| 83 * Debug event callback function. | 83 * Debug event callback function. |
| 84 * | 84 * |
| 85 * \param event the type of the debug event that triggered the callback | 85 * \param event the type of the debug event that triggered the callback |
| 86 * (enum DebugEvent) | 86 * (enum DebugEvent) |
| 87 * \param exec_state execution state (JavaScript object) | 87 * \param exec_state execution state (JavaScript object) |
| 88 * \param event_data event specific data (JavaScript object) | 88 * \param event_data event specific data (JavaScript object) |
| 89 * \param data value passed by the user to AddDebugEventListener | 89 * \param data value passed by the user to SetDebugEventListener |
| 90 */ | 90 */ |
| 91 typedef void (*DebugEventCallback)(DebugEvent event, | 91 typedef void (*DebugEventCallback)(DebugEvent event, |
| 92 Handle<Object> exec_state, | 92 Handle<Object> exec_state, |
| 93 Handle<Object> event_data, | 93 Handle<Object> event_data, |
| 94 Handle<Value> data); | 94 Handle<Value> data); |
| 95 | 95 |
| 96 | 96 |
| 97 /** | 97 /** |
| 98 * Debug message callback function. | 98 * Debug message callback function. |
| 99 * | 99 * |
| 100 * \param message the debug message | 100 * \param message the debug message |
| 101 * \param length length of the message | 101 * \param length length of the message |
| 102 * A DebugMessageHandler does not take posession of the message string, | 102 * A DebugMessageHandler does not take posession of the message string, |
| 103 * and must not rely on the data persisting after the handler returns. | 103 * and must not rely on the data persisting after the handler returns. |
| 104 */ | 104 */ |
| 105 typedef void (*DebugMessageHandler)(const uint16_t* message, int length, | 105 typedef void (*DebugMessageHandler)(const uint16_t* message, int length, |
| 106 void* data); | 106 void* data); |
| 107 | 107 |
| 108 | 108 |
| 109 class EXPORT Debug { | 109 class EXPORT Debug { |
| 110 public: | 110 public: |
| 111 // Add a C debug event listener. | 111 // Set a C debug event listener. |
| 112 static bool AddDebugEventListener(DebugEventCallback that, | 112 static bool SetDebugEventListener(DebugEventCallback that, |
| 113 Handle<Value> data = Handle<Value>()); | 113 Handle<Value> data = Handle<Value>()); |
| 114 | 114 |
| 115 // Add a JavaScript debug event listener. | 115 // Set a JavaScript debug event listener. |
| 116 static bool AddDebugEventListener(v8::Handle<v8::Function> that, | 116 static bool SetDebugEventListener(v8::Handle<v8::Object> that, |
| 117 Handle<Value> data = Handle<Value>()); | 117 Handle<Value> data = Handle<Value>()); |
| 118 | 118 |
| 119 // Remove a C debug event listener. | |
| 120 static void RemoveDebugEventListener(DebugEventCallback that); | |
| 121 | |
| 122 // Remove a JavaScript debug event listener. | |
| 123 static void RemoveDebugEventListener(v8::Handle<v8::Function> that); | |
| 124 | |
| 125 // Break execution of JavaScript. | 119 // Break execution of JavaScript. |
| 126 static void DebugBreak(); | 120 static void DebugBreak(); |
| 127 | 121 |
| 128 // Message based interface. The message protocol is JSON. | 122 // Message based interface. The message protocol is JSON. |
| 129 static void SetMessageHandler(DebugMessageHandler handler, void* data = NULL); | 123 static void SetMessageHandler(DebugMessageHandler handler, void* data = NULL); |
| 130 static void SendCommand(const uint16_t* command, int length); | 124 static void SendCommand(const uint16_t* command, int length); |
| 131 | 125 |
| 132 /** | 126 /** |
| 133 * Run a JavaScript function in the debugger. | 127 * Run a JavaScript function in the debugger. |
| 134 * \param fun the function to call | 128 * \param fun the function to call |
| (...skipping 16 matching lines...) Expand all Loading... |
| 151 }; | 145 }; |
| 152 | 146 |
| 153 | 147 |
| 154 } // namespace v8 | 148 } // namespace v8 |
| 155 | 149 |
| 156 | 150 |
| 157 #undef EXPORT | 151 #undef EXPORT |
| 158 | 152 |
| 159 | 153 |
| 160 #endif // V8_DEBUG_H_ | 154 #endif // V8_DEBUG_H_ |
| OLD | NEW |