| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 #include <assert.h> | 66 #include <assert.h> |
| 67 | 67 |
| 68 /* | 68 /* |
| 69 * ======= | 69 * ======= |
| 70 * Handles | 70 * Handles |
| 71 * ======= | 71 * ======= |
| 72 */ | 72 */ |
| 73 | 73 |
| 74 /** | 74 /** |
| 75 * An isolate is the unit of concurrency in Dart. Each isolate has |
| 76 * its own memory and thread of control. No state is shared between |
| 77 * isolates. Instead, isolates communicate by message passing. |
| 78 * |
| 79 * Each thread keeps track of its current isolate, which is the |
| 80 * isolate which is ready to execute on the current thread. The |
| 81 * current isolate may be NULL, in which case no isolate is ready to |
| 82 * execute. Most of the Dart apis require there to be a current |
| 83 * isolate in order to function without error. The current isolate is |
| 84 * set by any call to Dart_CreateIsolate or Dart_EnterIsolate. |
| 85 */ |
| 86 typedef struct _Dart_Isolate* Dart_Isolate; |
| 87 |
| 88 /** |
| 75 * An object reference managed by the Dart VM garbage collector. | 89 * An object reference managed by the Dart VM garbage collector. |
| 76 * | 90 * |
| 77 * Because the garbage collector may move objects, it is unsafe to | 91 * Because the garbage collector may move objects, it is unsafe to |
| 78 * refer to objects directly. Instead, we refer to objects through | 92 * refer to objects directly. Instead, we refer to objects through |
| 79 * handles, which are known to the garbage collector and updated | 93 * handles, which are known to the garbage collector and updated |
| 80 * automatically when the object is moved. Handles should be passed | 94 * automatically when the object is moved. Handles should be passed |
| 81 * by value (except in cases like out-parameters) and should never be | 95 * by value (except in cases like out-parameters) and should never be |
| 82 * allocated on the heap. | 96 * allocated on the heap. |
| 83 * | 97 * |
| 84 * Most functions in the Dart Embedding API return a handle. When a | 98 * Most functions in the Dart Embedding API return a handle. When a |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 * The type Dart_Handle represents a handle (both local and persistent). | 202 * The type Dart_Handle represents a handle (both local and persistent). |
| 189 * The type Dart_PersistentHandle is a Dart_Handle and it is used to | 203 * The type Dart_PersistentHandle is a Dart_Handle and it is used to |
| 190 * document that a persistent handle is expected as a parameter to a call | 204 * document that a persistent handle is expected as a parameter to a call |
| 191 * or the return value from a call is a persistent handle. | 205 * or the return value from a call is a persistent handle. |
| 192 */ | 206 */ |
| 193 typedef struct _Dart_Handle* Dart_Handle; | 207 typedef struct _Dart_Handle* Dart_Handle; |
| 194 typedef Dart_Handle Dart_PersistentHandle; | 208 typedef Dart_Handle Dart_PersistentHandle; |
| 195 typedef struct _Dart_WeakPersistentHandle* Dart_WeakPersistentHandle; | 209 typedef struct _Dart_WeakPersistentHandle* Dart_WeakPersistentHandle; |
| 196 | 210 |
| 197 typedef void (*Dart_WeakPersistentHandleFinalizer)( | 211 typedef void (*Dart_WeakPersistentHandleFinalizer)( |
| 212 Dart_Isolate isolate, |
| 198 Dart_WeakPersistentHandle handle, | 213 Dart_WeakPersistentHandle handle, |
| 199 void* peer); | 214 void* peer); |
| 200 typedef void (*Dart_PeerFinalizer)(void* peer); | 215 typedef void (*Dart_PeerFinalizer)(void* peer); |
| 201 | 216 |
| 202 /** | 217 /** |
| 203 * Is this an error handle? | 218 * Is this an error handle? |
| 204 * | 219 * |
| 205 * Requires there to be a current isolate. | 220 * Requires there to be a current isolate. |
| 206 */ | 221 */ |
| 207 DART_EXPORT bool Dart_IsError(Dart_Handle handle); | 222 DART_EXPORT bool Dart_IsError(Dart_Handle handle); |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 * | 454 * |
| 440 * \return Success if the weak persistent handle was | 455 * \return Success if the weak persistent handle was |
| 441 * created. Otherwise, returns an error. | 456 * created. Otherwise, returns an error. |
| 442 */ | 457 */ |
| 443 DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle( | 458 DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle( |
| 444 Dart_Handle object, | 459 Dart_Handle object, |
| 445 void* peer, | 460 void* peer, |
| 446 Dart_WeakPersistentHandleFinalizer callback); | 461 Dart_WeakPersistentHandleFinalizer callback); |
| 447 | 462 |
| 448 DART_EXPORT void Dart_DeleteWeakPersistentHandle( | 463 DART_EXPORT void Dart_DeleteWeakPersistentHandle( |
| 464 Dart_Isolate isolate, |
| 449 Dart_WeakPersistentHandle object); | 465 Dart_WeakPersistentHandle object); |
| 450 | 466 |
| 451 /** | 467 /** |
| 452 * Allocates a prologue weak persistent handle for an object. | 468 * Allocates a prologue weak persistent handle for an object. |
| 453 * | 469 * |
| 454 * Prologue weak persistent handles are similar to weak persistent | 470 * Prologue weak persistent handles are similar to weak persistent |
| 455 * handles but exhibit different behavior during garbage collections | 471 * handles but exhibit different behavior during garbage collections |
| 456 * that invoke the prologue and epilogue callbacks. While weak | 472 * that invoke the prologue and epilogue callbacks. While weak |
| 457 * persistent handles always weakly reference their referents, | 473 * persistent handles always weakly reference their referents, |
| 458 * prologue weak persistent handles weakly reference their referents | 474 * prologue weak persistent handles weakly reference their referents |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 /** | 609 /** |
| 594 * Gets the version string for the Dart VM. | 610 * Gets the version string for the Dart VM. |
| 595 * | 611 * |
| 596 * The version of the Dart VM can be accessed without initializing the VM. | 612 * The version of the Dart VM can be accessed without initializing the VM. |
| 597 * | 613 * |
| 598 * \return The version string for the embedded Dart VM. | 614 * \return The version string for the embedded Dart VM. |
| 599 */ | 615 */ |
| 600 DART_EXPORT const char* Dart_VersionString(); | 616 DART_EXPORT const char* Dart_VersionString(); |
| 601 | 617 |
| 602 /** | 618 /** |
| 603 * An isolate is the unit of concurrency in Dart. Each isolate has | |
| 604 * its own memory and thread of control. No state is shared between | |
| 605 * isolates. Instead, isolates communicate by message passing. | |
| 606 * | |
| 607 * Each thread keeps track of its current isolate, which is the | |
| 608 * isolate which is ready to execute on the current thread. The | |
| 609 * current isolate may be NULL, in which case no isolate is ready to | |
| 610 * execute. Most of the Dart apis require there to be a current | |
| 611 * isolate in order to function without error. The current isolate is | |
| 612 * set by any call to Dart_CreateIsolate or Dart_EnterIsolate. | |
| 613 */ | |
| 614 typedef struct _Dart_Isolate* Dart_Isolate; | |
| 615 | |
| 616 /** | |
| 617 * An isolate creation and initialization callback function. | 619 * An isolate creation and initialization callback function. |
| 618 * | 620 * |
| 619 * This callback, provided by the embedder, is called when the vm | 621 * This callback, provided by the embedder, is called when the vm |
| 620 * needs to create an isolate. The callback should create an isolate | 622 * needs to create an isolate. The callback should create an isolate |
| 621 * by calling Dart_CreateIsolate and load any scripts required for | 623 * by calling Dart_CreateIsolate and load any scripts required for |
| 622 * execution. | 624 * execution. |
| 623 * | 625 * |
| 624 * When the function returns false, it is the responsibility of this | 626 * When the function returns false, it is the responsibility of this |
| 625 * function to ensure that Dart_ShutdownIsolate has been called if | 627 * function to ensure that Dart_ShutdownIsolate has been called if |
| 626 * required (for example, if the isolate was created successfully by | 628 * required (for example, if the isolate was created successfully by |
| (...skipping 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2543 * NOTE: If multiple callbacks with the same name are registered, only the | 2545 * NOTE: If multiple callbacks with the same name are registered, only the |
| 2544 * last callback registered will be remembered. | 2546 * last callback registered will be remembered. |
| 2545 */ | 2547 */ |
| 2546 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 2548 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
| 2547 const char* name, | 2549 const char* name, |
| 2548 Dart_ServiceRequestCallback callback, | 2550 Dart_ServiceRequestCallback callback, |
| 2549 void* user_data); | 2551 void* user_data); |
| 2550 | 2552 |
| 2551 | 2553 |
| 2552 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ | 2554 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ |
| OLD | NEW |