Chromium Code Reviews| Index: runtime/include/dart_api.h |
| =================================================================== |
| --- runtime/include/dart_api.h (revision 23191) |
| +++ runtime/include/dart_api.h (working copy) |
| @@ -176,9 +176,12 @@ |
| * deallocated (see Dart_DeletePersistentHandle). |
| */ |
| typedef struct _Dart_Handle* Dart_Handle; |
| +typedef struct _Dart_PersistentHandle* Dart_PersistentHandle; |
| +typedef struct _Dart_WeakPersistentHandle* Dart_WeakPersistentHandle; |
| -typedef void (*Dart_WeakPersistentHandleFinalizer)(Dart_Handle handle, |
| - void* peer); |
| +typedef void (*Dart_WeakPersistentHandleFinalizer)( |
| + Dart_WeakPersistentHandle handle, |
| + void* peer); |
| typedef void (*Dart_PeerFinalizer)(void* peer); |
| /** |
| @@ -361,6 +364,17 @@ |
| DART_EXPORT bool Dart_IdentityEquals(Dart_Handle obj1, Dart_Handle obj2); |
| /** |
| + * Allocates a handle in the current scope from a persistent handle. |
| + */ |
| +DART_EXPORT Dart_Handle Dart_HandleFromPersistent(Dart_PersistentHandle object); |
| + |
| +/** |
| + * Allocates a handle in the current scope from a weak persistent handle. |
| + */ |
| +DART_EXPORT Dart_Handle Dart_HandleFromWeakPersistent( |
| + Dart_WeakPersistentHandle object); |
| + |
| +/** |
| * Allocates a persistent handle for an object. |
| * |
| * This handle has the lifetime of the current isolate unless it is |
| @@ -368,14 +382,14 @@ |
| * |
| * Requires there to be a current isolate. |
| */ |
| -DART_EXPORT Dart_Handle Dart_NewPersistentHandle(Dart_Handle object); |
| +DART_EXPORT Dart_PersistentHandle Dart_NewPersistentHandle(Dart_Handle object); |
| /** |
| * Deallocates a persistent handle. |
| * |
| * Requires there to be a current isolate. |
| */ |
| -DART_EXPORT void Dart_DeletePersistentHandle(Dart_Handle object); |
| +DART_EXPORT void Dart_DeletePersistentHandle(Dart_PersistentHandle object); |
| /** |
| * Allocates a weak persistent handle for an object. |
| @@ -394,17 +408,12 @@ |
| * \return Success if the weak persistent handle was |
| * created. Otherwise, returns an error. |
| */ |
| -DART_EXPORT Dart_Handle Dart_NewWeakPersistentHandle( |
| +DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle( |
| Dart_Handle object, |
| void* peer, |
| Dart_WeakPersistentHandleFinalizer callback); |
| -/** |
| - * Is this object a weak persistent handle? |
| - * |
| - * Requires there to be a current isolate. |
| - */ |
| -DART_EXPORT bool Dart_IsWeakPersistentHandle(Dart_Handle object); |
| +DART_EXPORT void Dart_DeleteWeakPersistentHandle(Dart_WeakPersistentHandle object); |
| /** |
| * Allocates a prologue weak persistent handle for an object. |
| @@ -432,7 +441,7 @@ |
| * \return Success if the prologue weak persistent handle was created. |
| * Otherwise, returns an error. |
| */ |
| -DART_EXPORT Dart_Handle Dart_NewPrologueWeakPersistentHandle( |
| +DART_EXPORT Dart_WeakPersistentHandle Dart_NewPrologueWeakPersistentHandle( |
| Dart_Handle object, |
| void* peer, |
| Dart_WeakPersistentHandleFinalizer callback); |
| @@ -442,7 +451,8 @@ |
| * |
| * Requires there to be a current isolate. |
| */ |
| -DART_EXPORT bool Dart_IsPrologueWeakPersistentHandle(Dart_Handle object); |
| +DART_EXPORT bool Dart_IsPrologueWeakPersistentHandle( |
| + Dart_WeakPersistentHandle object); |
| /** |
| * Constructs a set of weak references from the Cartesian product of |
| @@ -459,10 +469,11 @@ |
| * \return Success if the weak reference set could be created. |
| * Otherwise, returns an error handle. |
| */ |
| -DART_EXPORT Dart_Handle Dart_NewWeakReferenceSet(Dart_Handle* keys, |
| - intptr_t num_keys, |
| - Dart_Handle* values, |
| - intptr_t num_values); |
| +DART_EXPORT Dart_Handle Dart_NewWeakReferenceSet( |
| + Dart_WeakPersistentHandle* keys, |
|
Anton Muhin
2013/05/27 15:45:49
there was one fancy trick in our code which curren
Ivan Posva
2013/05/28 21:12:20
I am not sure I understand your usage of this API
Anton Muhin
2013/05/29 07:43:13
Yes, that's exactly what we do: weak persistent ha
|
| + intptr_t num_keys, |
| + Dart_WeakPersistentHandle* values, |
| + intptr_t num_values); |
| // --- Garbage Collection Callbacks --- |
| @@ -1766,20 +1777,11 @@ |
| * WeakPersistentHandle which needs to be deleted in the specified callback |
| * using Dart_DeletePersistentHandle. |
| */ |
| -DART_EXPORT Dart_Handle Dart_NewExternalTypedData( |
| - Dart_TypedData_Type type, |
| - void* data, |
| - intptr_t length, |
| - void* peer, |
| - Dart_WeakPersistentHandleFinalizer callback); |
| +DART_EXPORT Dart_Handle Dart_NewExternalTypedData(Dart_TypedData_Type type, |
| + void* data, |
| + intptr_t length); |
| /** |
| - * Retrieves the peer pointer associated with an external TypedData object. |
| - */ |
| -DART_EXPORT Dart_Handle Dart_ExternalTypedDataGetPeer(Dart_Handle object, |
|
Anton Muhin
2013/05/27 15:45:49
there still should be a way to fetch peer object a
Ivan Posva
2013/05/28 21:12:20
For now, please use Dart_SetPeer and Dart_GetPeer
|
| - void** peer); |
| - |
| -/** |
| * Acquires access to the internal data address of a TypedData object. |
| * |
| * \param object The typed data object whose internal data address is to |