OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 * Copyright (c) 2012, 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_API_H_ | 7 #ifndef INCLUDE_DART_API_H_ |
8 #define INCLUDE_DART_API_H_ | 8 #define INCLUDE_DART_API_H_ |
9 | 9 |
10 /** \mainpage Dart Embedding API Reference | 10 /** \mainpage Dart Embedding API Reference |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 * Allocates a persistent handle for an object. | 390 * Allocates a persistent handle for an object. |
391 * | 391 * |
392 * This handle has the lifetime of the current isolate unless it is | 392 * This handle has the lifetime of the current isolate unless it is |
393 * explicitly deallocated by calling Dart_DeletePersistentHandle. | 393 * explicitly deallocated by calling Dart_DeletePersistentHandle. |
394 * | 394 * |
395 * Requires there to be a current isolate. | 395 * Requires there to be a current isolate. |
396 */ | 396 */ |
397 DART_EXPORT Dart_PersistentHandle Dart_NewPersistentHandle(Dart_Handle object); | 397 DART_EXPORT Dart_PersistentHandle Dart_NewPersistentHandle(Dart_Handle object); |
398 | 398 |
399 /** | 399 /** |
| 400 * Assign value of local handle to a persistent handle. |
| 401 * |
| 402 * Requires there to be a current isolate. |
| 403 * |
| 404 * \param obj1 A persistent handle whose value needs to be set. |
| 405 * \param obj2 An object whose value needs to be set to the persistent handle. |
| 406 * |
| 407 * \return Success if the persistent handle was set |
| 408 * Otherwise, returns an error. |
| 409 */ |
| 410 DART_EXPORT void Dart_SetPersistentHandle(Dart_PersistentHandle obj1, |
| 411 Dart_Handle obj2); |
| 412 |
| 413 /** |
400 * Deallocates a persistent handle. | 414 * Deallocates a persistent handle. |
401 * | 415 * |
402 * Requires there to be a current isolate. | 416 * Requires there to be a current isolate. |
403 */ | 417 */ |
404 DART_EXPORT void Dart_DeletePersistentHandle(Dart_PersistentHandle object); | 418 DART_EXPORT void Dart_DeletePersistentHandle(Dart_PersistentHandle object); |
405 | 419 |
406 /** | 420 /** |
407 * Allocates a weak persistent handle for an object. | 421 * Allocates a weak persistent handle for an object. |
408 * | 422 * |
409 * This handle has the lifetime of the current isolate unless it is | 423 * This handle has the lifetime of the current isolate unless it is |
(...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2112 typedef void (*Dart_NativeFunction)(Dart_NativeArguments arguments); | 2126 typedef void (*Dart_NativeFunction)(Dart_NativeArguments arguments); |
2113 | 2127 |
2114 /** | 2128 /** |
2115 * Native entry resolution callback. | 2129 * Native entry resolution callback. |
2116 * | 2130 * |
2117 * For libraries and scripts which have native functions, the embedder | 2131 * For libraries and scripts which have native functions, the embedder |
2118 * can provide a native entry resolver. This callback is used to map a | 2132 * can provide a native entry resolver. This callback is used to map a |
2119 * name/arity to a Dart_NativeFunction. If no function is found, the | 2133 * name/arity to a Dart_NativeFunction. If no function is found, the |
2120 * callback should return NULL. | 2134 * callback should return NULL. |
2121 * | 2135 * |
| 2136 * The parameters to the native resolver function are: |
| 2137 * \param name a Dart string which is the name of the native function. |
| 2138 * \param num_of_arguments is the number of arguments expected by the |
| 2139 * native function. |
| 2140 * \param auto_setup_scope is a boolean flag that can be set by the resolver |
| 2141 * to indicate if this function needs a Dart API scope (see Dart_EnterScope/ |
| 2142 * Dart_ExitScope) to be setup automatically by the VM before calling into |
| 2143 * the native function. By default most native functions would require this |
| 2144 * to be true but some light weight native functions which do not call back |
| 2145 * into the VM through the Dart API may not require a Dart scope to be |
| 2146 * setup automatically. |
| 2147 * |
| 2148 * \return A valid Dart_NativeFunction which resolves to a native entry point |
| 2149 * for the native function. |
| 2150 * |
2122 * See Dart_SetNativeResolver. | 2151 * See Dart_SetNativeResolver. |
2123 */ | 2152 */ |
2124 typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name, | 2153 typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name, |
2125 int num_of_arguments, | 2154 int num_of_arguments, |
2126 bool* auto_setup_scope); | 2155 bool* auto_setup_scope); |
2127 /* TODO(turnidge): Consider renaming to NativeFunctionResolver or | 2156 /* TODO(turnidge): Consider renaming to NativeFunctionResolver or |
2128 * NativeResolver. */ | 2157 * NativeResolver. */ |
2129 | 2158 |
2130 /* | 2159 /* |
2131 * =========== | 2160 * =========== |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2358 * | 2387 * |
2359 * \param object An object. | 2388 * \param object An object. |
2360 * \param peer A value to store in the peer field. | 2389 * \param peer A value to store in the peer field. |
2361 * | 2390 * |
2362 * \return Returns an error if 'object' is a subtype of Null, num, or | 2391 * \return Returns an error if 'object' is a subtype of Null, num, or |
2363 * bool. | 2392 * bool. |
2364 */ | 2393 */ |
2365 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); | 2394 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); |
2366 | 2395 |
2367 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ | 2396 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ |
OLD | NEW |