| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 2 * Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 3 * for details. All rights reserved. Use of this source code is governed by a | 3 * for details. All rights reserved. Use of this source code is governed by a |
| 4 * BSD-style license that can be found in the LICENSE file. | 4 * BSD-style license that can be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #ifndef RUNTIME_INCLUDE_DART_NATIVE_API_H_ | 7 #ifndef RUNTIME_INCLUDE_DART_NATIVE_API_H_ |
| 8 #define RUNTIME_INCLUDE_DART_NATIVE_API_H_ | 8 #define RUNTIME_INCLUDE_DART_NATIVE_API_H_ |
| 9 | 9 |
| 10 #include "include/dart_api.h" | 10 #include "include/dart_api.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 * This handler is associated with a native port by calling | 117 * This handler is associated with a native port by calling |
| 118 * Dart_NewNativePort. | 118 * Dart_NewNativePort. |
| 119 * | 119 * |
| 120 * The message received is decoded into the message structure. The | 120 * The message received is decoded into the message structure. The |
| 121 * lifetime of the message data is controlled by the caller. All the | 121 * lifetime of the message data is controlled by the caller. All the |
| 122 * data references from the message are allocated by the caller and | 122 * data references from the message are allocated by the caller and |
| 123 * will be reclaimed when returning to it. | 123 * will be reclaimed when returning to it. |
| 124 */ | 124 */ |
| 125 | 125 |
| 126 typedef void (*Dart_NativeMessageHandler)(Dart_Port dest_port_id, | 126 typedef void (*Dart_NativeMessageHandler)(Dart_Port dest_port_id, |
| 127 Dart_CObject* message, | 127 Dart_CObject* message); |
| 128 void* peer); | |
| 129 | 128 |
| 130 /** | 129 /** |
| 131 * Creates a new native port. When messages are received on this | 130 * Creates a new native port. When messages are received on this |
| 132 * native port, then they will be dispatched to the provided native | 131 * native port, then they will be dispatched to the provided native |
| 133 * message handler. | 132 * message handler. |
| 134 * | 133 * |
| 135 * \param name The name of this port in debugging messages. | 134 * \param name The name of this port in debugging messages. |
| 136 * \param handler The C handler to run when messages arrive on the port. | 135 * \param handler The C handler to run when messages arrive on the port. |
| 137 * \param handle_concurrently Is it okay to process requests on this | 136 * \param handle_concurrently Is it okay to process requests on this |
| 138 * native port concurrently? | 137 * native port concurrently? |
| 139 * \param peer Peer associated with this port. It will be passed down to the | |
| 140 handler when new message arrives. | |
| 141 * | 138 * |
| 142 * \return If successful, returns the port id for the native port. In | 139 * \return If successful, returns the port id for the native port. In |
| 143 * case of error, returns ILLEGAL_PORT. | 140 * case of error, returns ILLEGAL_PORT. |
| 144 */ | 141 */ |
| 145 DART_EXPORT Dart_Port Dart_NewNativePort(const char* name, | 142 DART_EXPORT Dart_Port Dart_NewNativePort(const char* name, |
| 146 Dart_NativeMessageHandler handler, | 143 Dart_NativeMessageHandler handler, |
| 147 bool handle_concurrently, | 144 bool handle_concurrently); |
| 148 void* peer); | |
| 149 /* TODO(turnidge): Currently handle_concurrently is ignored. */ | 145 /* TODO(turnidge): Currently handle_concurrently is ignored. */ |
| 150 | 146 |
| 151 /** | 147 /** |
| 152 * Closes the native port with the given id. | 148 * Closes the native port with the given id. |
| 153 * | 149 * |
| 154 * The port must have been allocated by a call to Dart_NewNativePort. | 150 * The port must have been allocated by a call to Dart_NewNativePort. |
| 155 * | 151 * |
| 156 * \param native_port_id The id of the native port to close. | 152 * \param native_port_id The id of the native port to close. |
| 157 * | 153 * |
| 158 * \return Returns true if the port was closed successfully. | 154 * \return Returns true if the port was closed successfully. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 174 */ | 170 */ |
| 175 DART_EXPORT Dart_Handle Dart_CompileAll(); | 171 DART_EXPORT Dart_Handle Dart_CompileAll(); |
| 176 | 172 |
| 177 /** | 173 /** |
| 178 * Parses all loaded functions in the current isolate.. | 174 * Parses all loaded functions in the current isolate.. |
| 179 * | 175 * |
| 180 */ | 176 */ |
| 181 DART_EXPORT Dart_Handle Dart_ParseAll(); | 177 DART_EXPORT Dart_Handle Dart_ParseAll(); |
| 182 | 178 |
| 183 #endif /* INCLUDE_DART_NATIVE_API_H_ */ /* NOLINT */ | 179 #endif /* INCLUDE_DART_NATIVE_API_H_ */ /* NOLINT */ |
| OLD | NEW |