| 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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 /** | 435 /** |
| 436 * Allocates a weak persistent handle for an object. | 436 * Allocates a weak persistent handle for an object. |
| 437 * | 437 * |
| 438 * This handle has the lifetime of the current isolate unless it is | 438 * This handle has the lifetime of the current isolate unless it is |
| 439 * explicitly deallocated by calling Dart_DeleteWeakPersistentHandle. | 439 * explicitly deallocated by calling Dart_DeleteWeakPersistentHandle. |
| 440 * | 440 * |
| 441 * If the object becomes unreachable the callback is invoked with the weak | 441 * If the object becomes unreachable the callback is invoked with the weak |
| 442 * persistent handle and the peer as arguments. This gives the native code the | 442 * persistent handle and the peer as arguments. This gives the native code the |
| 443 * ability to cleanup data associated with the object and to delete the weak | 443 * ability to cleanup data associated with the object and to delete the weak |
| 444 * persistent handle. It is illegal to call into the VM from the callback, | 444 * persistent handle. It is illegal to call into the VM from the callback, |
| 445 * except to delete the weak persistent handle. | 445 * except to delete the weak persistent handle. If the handle is deleted before |
| 446 * the object becomes unreachable, the callback is never invoked. |
| 446 * | 447 * |
| 447 * Requires there to be a current isolate. | 448 * Requires there to be a current isolate. |
| 448 * | 449 * |
| 449 * \param object An object. | 450 * \param object An object. |
| 450 * \param peer A pointer to a native object or NULL. This value is | 451 * \param peer A pointer to a native object or NULL. This value is |
| 451 * provided to callback when it is invoked. | 452 * provided to callback when it is invoked. |
| 453 * \param external_allocation_size The number of externally allocated |
| 454 * bytes for peer. Used to inform the garbage collector. |
| 452 * \param callback A function pointer that will be invoked sometime | 455 * \param callback A function pointer that will be invoked sometime |
| 453 * after the object is garbage collected. | 456 * after the object is garbage collected, unless the handle has been deleted. |
| 454 * | 457 * |
| 455 * \return Success if the weak persistent handle was | 458 * \return Success if the weak persistent handle was |
| 456 * created. Otherwise, returns an error. | 459 * created. Otherwise, returns an error. |
| 457 */ | 460 */ |
| 458 DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle( | 461 DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle( |
| 459 Dart_Handle object, | 462 Dart_Handle object, |
| 460 void* peer, | 463 void* peer, |
| 464 intptr_t external_allocation_size, |
| 461 Dart_WeakPersistentHandleFinalizer callback); | 465 Dart_WeakPersistentHandleFinalizer callback); |
| 462 | 466 |
| 463 DART_EXPORT void Dart_DeleteWeakPersistentHandle( | 467 DART_EXPORT void Dart_DeleteWeakPersistentHandle( |
| 464 Dart_Isolate isolate, | 468 Dart_Isolate isolate, |
| 465 Dart_WeakPersistentHandle object); | 469 Dart_WeakPersistentHandle object); |
| 466 | 470 |
| 467 /** | 471 /** |
| 468 * Allocates a prologue weak persistent handle for an object. | 472 * Allocates a prologue weak persistent handle for an object. |
| 469 * | 473 * |
| 470 * Prologue weak persistent handles are similar to weak persistent | 474 * Prologue weak persistent handles are similar to weak persistent |
| 471 * handles but exhibit different behavior during garbage collections | 475 * handles but exhibit different behavior during garbage collections |
| 472 * that invoke the prologue and epilogue callbacks. While weak | 476 * that invoke the prologue and epilogue callbacks. While weak |
| 473 * persistent handles always weakly reference their referents, | 477 * persistent handles always weakly reference their referents, |
| 474 * prologue weak persistent handles weakly reference their referents | 478 * prologue weak persistent handles weakly reference their referents |
| 475 * only during a garbage collection that invokes the prologue and | 479 * only during a garbage collection that invokes the prologue and |
| 476 * epilogue callbacks. During all other garbage collections, prologue | 480 * epilogue callbacks. During all other garbage collections, prologue |
| 477 * weak persistent handles strongly reference their referents. | 481 * weak persistent handles strongly reference their referents. |
| 478 * | 482 * |
| 479 * This handle has the lifetime of the current isolate unless it is | 483 * This handle has the lifetime of the current isolate unless it is |
| 480 * explicitly deallocated by calling Dart_DeleteWeakPersistentHandle. | 484 * explicitly deallocated by calling Dart_DeleteWeakPersistentHandle. |
| 481 * | 485 * |
| 482 * Requires there to be a current isolate. | 486 * Requires there to be a current isolate. |
| 483 * | 487 * |
| 484 * \param object An object. | 488 * \param object An object. |
| 485 * \param peer A pointer to a native object or NULL. This value is | 489 * \param peer A pointer to a native object or NULL. This value is |
| 486 * provided to callback when it is invoked. | 490 * provided to callback when it is invoked. |
| 491 * \param external_allocation_size The number of externally allocated |
| 492 * bytes for peer. Used to inform the garbage collector. |
| 487 * \param callback A function pointer that will be invoked sometime | 493 * \param callback A function pointer that will be invoked sometime |
| 488 * after the object is garbage collected. | 494 * after the object is garbage collected, unless the handle has been deleted. |
| 489 * | 495 * |
| 490 * \return Success if the prologue weak persistent handle was created. | 496 * \return Success if the prologue weak persistent handle was created. |
| 491 * Otherwise, returns an error. | 497 * Otherwise, returns an error. |
| 492 */ | 498 */ |
| 493 DART_EXPORT Dart_WeakPersistentHandle Dart_NewPrologueWeakPersistentHandle( | 499 DART_EXPORT Dart_WeakPersistentHandle Dart_NewPrologueWeakPersistentHandle( |
| 494 Dart_Handle object, | 500 Dart_Handle object, |
| 495 void* peer, | 501 void* peer, |
| 502 intptr_t external_allocation_size, |
| 496 Dart_WeakPersistentHandleFinalizer callback); | 503 Dart_WeakPersistentHandleFinalizer callback); |
| 497 | 504 |
| 498 /** | 505 /** |
| 499 * Is this object a prologue weak persistent handle? | 506 * Is this object a prologue weak persistent handle? |
| 500 * | 507 * |
| 501 * Requires there to be a current isolate. | 508 * Requires there to be a current isolate. |
| 502 */ | 509 */ |
| 503 DART_EXPORT bool Dart_IsPrologueWeakPersistentHandle( | 510 DART_EXPORT bool Dart_IsPrologueWeakPersistentHandle( |
| 504 Dart_WeakPersistentHandle object); | 511 Dart_WeakPersistentHandle object); |
| 505 | 512 |
| (...skipping 2037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2543 * NOTE: If multiple callbacks with the same name are registered, only the | 2550 * NOTE: If multiple callbacks with the same name are registered, only the |
| 2544 * last callback registered will be remembered. | 2551 * last callback registered will be remembered. |
| 2545 */ | 2552 */ |
| 2546 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 2553 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
| 2547 const char* name, | 2554 const char* name, |
| 2548 Dart_ServiceRequestCallback callback, | 2555 Dart_ServiceRequestCallback callback, |
| 2549 void* user_data); | 2556 void* user_data); |
| 2550 | 2557 |
| 2551 | 2558 |
| 2552 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ | 2559 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ |
| OLD | NEW |