| 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 INCLUDE_DART_NATIVE_API_H_ | 7 #ifndef INCLUDE_DART_NATIVE_API_H_ |
| 8 #define INCLUDE_DART_NATIVE_API_H_ | 8 #define INCLUDE_DART_NATIVE_API_H_ |
| 9 | 9 |
| 10 #include "include/dart_api.h" | 10 #include "include/dart_api.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 Dart_CObject_kNull = 0, | 32 Dart_CObject_kNull = 0, |
| 33 Dart_CObject_kBool, | 33 Dart_CObject_kBool, |
| 34 Dart_CObject_kInt32, | 34 Dart_CObject_kInt32, |
| 35 Dart_CObject_kInt64, | 35 Dart_CObject_kInt64, |
| 36 Dart_CObject_kBigint, | 36 Dart_CObject_kBigint, |
| 37 Dart_CObject_kDouble, | 37 Dart_CObject_kDouble, |
| 38 Dart_CObject_kString, | 38 Dart_CObject_kString, |
| 39 Dart_CObject_kArray, | 39 Dart_CObject_kArray, |
| 40 Dart_CObject_kTypedData, | 40 Dart_CObject_kTypedData, |
| 41 Dart_CObject_kExternalTypedData, | 41 Dart_CObject_kExternalTypedData, |
| 42 Dart_CObject_kSendPort, |
| 42 Dart_CObject_kUnsupported, | 43 Dart_CObject_kUnsupported, |
| 43 Dart_CObject_kNumberOfTypes | 44 Dart_CObject_kNumberOfTypes |
| 44 } Dart_CObject_Type; | 45 } Dart_CObject_Type; |
| 45 | 46 |
| 46 typedef struct _Dart_CObject { | 47 typedef struct _Dart_CObject { |
| 47 Dart_CObject_Type type; | 48 Dart_CObject_Type type; |
| 48 union { | 49 union { |
| 49 bool as_bool; | 50 bool as_bool; |
| 50 int32_t as_int32; | 51 int32_t as_int32; |
| 51 int64_t as_int64; | 52 int64_t as_int64; |
| 52 double as_double; | 53 double as_double; |
| 53 char* as_string; | 54 char* as_string; |
| 54 char* as_bigint; | 55 char* as_bigint; |
| 56 Dart_Port as_send_port; |
| 55 struct { | 57 struct { |
| 56 intptr_t length; | 58 intptr_t length; |
| 57 struct _Dart_CObject** values; | 59 struct _Dart_CObject** values; |
| 58 } as_array; | 60 } as_array; |
| 59 struct { | 61 struct { |
| 60 Dart_TypedData_Type type; | 62 Dart_TypedData_Type type; |
| 61 intptr_t length; | 63 intptr_t length; |
| 62 uint8_t* values; | 64 uint8_t* values; |
| 63 } as_typed_data; | 65 } as_typed_data; |
| 64 struct { | 66 struct { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 94 * This handler is associated with a native port by calling | 96 * This handler is associated with a native port by calling |
| 95 * Dart_NewNativePort. | 97 * Dart_NewNativePort. |
| 96 * | 98 * |
| 97 * The message received is decoded into the message structure. The | 99 * The message received is decoded into the message structure. The |
| 98 * lifetime of the message data is controlled by the caller. All the | 100 * lifetime of the message data is controlled by the caller. All the |
| 99 * data references from the message are allocated by the caller and | 101 * data references from the message are allocated by the caller and |
| 100 * will be reclaimed when returning to it. | 102 * will be reclaimed when returning to it. |
| 101 */ | 103 */ |
| 102 | 104 |
| 103 typedef void (*Dart_NativeMessageHandler)(Dart_Port dest_port_id, | 105 typedef void (*Dart_NativeMessageHandler)(Dart_Port dest_port_id, |
| 104 Dart_Port reply_port_id, | 106 Dart_CObject* message); |
| 105 Dart_CObject* message); | |
| 106 | 107 |
| 107 /** | 108 /** |
| 108 * Creates a new native port. When messages are received on this | 109 * Creates a new native port. When messages are received on this |
| 109 * native port, then they will be dispatched to the provided native | 110 * native port, then they will be dispatched to the provided native |
| 110 * message handler. | 111 * message handler. |
| 111 * | 112 * |
| 112 * \param name The name of this port in debugging messages. | 113 * \param name The name of this port in debugging messages. |
| 113 * \param handler The C handler to run when messages arrive on the port. | 114 * \param handler The C handler to run when messages arrive on the port. |
| 114 * \param handle_concurrently Is it okay to process requests on this | 115 * \param handle_concurrently Is it okay to process requests on this |
| 115 * native port concurrently? | 116 * native port concurrently? |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 */ | 185 */ |
| 185 DART_EXPORT Dart_Handle Dart_CompileAll(); | 186 DART_EXPORT Dart_Handle Dart_CompileAll(); |
| 186 | 187 |
| 187 /** | 188 /** |
| 188 * Check that all function fingerprints are OK. | 189 * Check that all function fingerprints are OK. |
| 189 * | 190 * |
| 190 */ | 191 */ |
| 191 DART_EXPORT Dart_Handle Dart_CheckFunctionFingerprints(); | 192 DART_EXPORT Dart_Handle Dart_CheckFunctionFingerprints(); |
| 192 | 193 |
| 193 #endif /* INCLUDE_DART_NATIVE_API_H_ */ /* NOLINT */ | 194 #endif /* INCLUDE_DART_NATIVE_API_H_ */ /* NOLINT */ |
| OLD | NEW |