@@ -244,8 +244,9 @@ typedef struct _Dart_IsolateGroup* Dart_IsolateGroup;
244
244
* the object is garbage collected. It is never safe to use these handles
245
245
* unless you know the object is still reachable.
246
246
*
247
- * WeakPersistentHandles are persistent handles which are auto deleted
248
- * when the object is garbage collected.
247
+ * WeakPersistentHandles are persistent handles which are automatically set
248
+ * to point Dart_Null when the object is garbage collected. They are not auto
249
+ * deleted, so it is safe to use them after the object has become unreachable.
249
250
*/
250
251
typedef struct _Dart_Handle * Dart_Handle ;
251
252
typedef Dart_Handle Dart_PersistentHandle ;
@@ -254,10 +255,6 @@ typedef struct _Dart_FinalizableHandle* Dart_FinalizableHandle;
254
255
// These structs are versioned by DART_API_DL_MAJOR_VERSION, bump the
255
256
// version when changing this struct.
256
257
257
- typedef void (* Dart_WeakPersistentHandleFinalizer )(
258
- void * isolate_callback_data ,
259
- Dart_WeakPersistentHandle handle ,
260
- void * peer );
261
258
typedef void (* Dart_HandleFinalizer )(void * isolate_callback_data , void * peer );
262
259
263
260
/**
@@ -423,6 +420,8 @@ DART_EXPORT Dart_Handle Dart_HandleFromPersistent(Dart_PersistentHandle object);
423
420
424
421
/**
425
422
* Allocates a handle in the current scope from a weak persistent handle.
423
+ *
424
+ * This will be a handle to Dart_Null if the object has been garbage collected.
426
425
*/
427
426
DART_EXPORT Dart_Handle
428
427
Dart_HandleFromWeakPersistent (Dart_WeakPersistentHandle object );
@@ -461,24 +460,18 @@ DART_EXPORT void Dart_DeletePersistentHandle(Dart_PersistentHandle object);
461
460
/**
462
461
* Allocates a weak persistent handle for an object.
463
462
*
464
- * This handle has the lifetime of the current isolate unless the object
465
- * pointed to by the handle is garbage collected, in this case the VM
466
- * automatically deletes the handle after invoking the callback associated
467
- * with the handle. The handle can also be explicitly deallocated by
468
- * calling Dart_DeleteWeakPersistentHandle.
469
- *
470
- * If the object becomes unreachable the callback is invoked with the weak
471
- * persistent handle and the peer as arguments. The callback can be executed on
472
- * any thread, will have an isolate group, but will not have a current isolate.
473
- * The callback can only call Dart_DeletePersistentHandle or
474
- * Dart_DeleteWeakPersistentHandle. The callback must not call
475
- * Dart_DeleteWeakPersistentHandle for the handle being finalized, as it is
476
- * automatically deleted by the VM after the callback returns. This gives the
477
- * embedder the ability to cleanup data associated with the object and clear
478
- * out any cached references to the handle. All references to this handle after
479
- * the callback will be invalid. It is illegal to call into the VM with any
480
- * other Dart_* functions from the callback. If the handle is deleted before
481
- * the object becomes unreachable, the callback is never invoked.
463
+ * This handle has the lifetime of the current isolate. The handle can also be
464
+ * explicitly deallocated by calling Dart_DeleteWeakPersistentHandle.
465
+ *
466
+ * If the object becomes unreachable the callback is invoked with the peer as
467
+ * argument. The callback can be executed on any thread, will have a current
468
+ * isolate group, but will not have a current isolate. The callback can only
469
+ * call Dart_DeletePersistentHandle or Dart_DeleteWeakPersistentHandle. This
470
+ * gives the embedder the ability to cleanup data associated with the object.
471
+ * The handle will point to the Dart_Null object after the finalizer has been
472
+ * run. It is illegal to call into the VM with any other Dart_* functions from
473
+ * the callback. If the handle is deleted before the object becomes
474
+ * unreachable, the callback is never invoked.
482
475
*
483
476
* Requires there to be a current isolate.
484
477
*
@@ -498,7 +491,7 @@ DART_EXPORT Dart_WeakPersistentHandle
498
491
Dart_NewWeakPersistentHandle (Dart_Handle object ,
499
492
void * peer ,
500
493
intptr_t external_allocation_size ,
501
- Dart_WeakPersistentHandleFinalizer callback );
494
+ Dart_HandleFinalizer callback );
502
495
503
496
/**
504
497
* Deletes the given weak persistent [object] handle.
@@ -921,7 +914,7 @@ typedef struct {
921
914
/**
922
915
* Initializes the VM.
923
916
*
924
- * \param flags A struct containing initialization information. The version
917
+ * \param params A struct containing initialization information. The version
925
918
* field of the struct must be DART_INITIALIZE_PARAMS_CURRENT_VERSION.
926
919
*
927
920
* \return NULL if initialization is successful. Returns an error message
@@ -1242,14 +1235,17 @@ DART_EXPORT void Dart_ExitIsolate();
1242
1235
* snapshot. This buffer is scope allocated and is only valid
1243
1236
* until the next call to Dart_ExitScope.
1244
1237
* \param size Returns the size of the buffer.
1238
+ * \param is_core Create a snapshot containing core libraries.
1239
+ * Such snapshot should be agnostic to null safety mode.
1245
1240
*
1246
1241
* \return A valid handle if no error occurs during the operation.
1247
1242
*/
1248
1243
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
1249
1244
Dart_CreateSnapshot (uint8_t * * vm_snapshot_data_buffer ,
1250
1245
intptr_t * vm_snapshot_data_size ,
1251
1246
uint8_t * * isolate_snapshot_data_buffer ,
1252
- intptr_t * isolate_snapshot_data_size );
1247
+ intptr_t * isolate_snapshot_data_size ,
1248
+ bool is_core );
1253
1249
1254
1250
/**
1255
1251
* Returns whether the buffer contains a kernel file.
@@ -2043,7 +2039,7 @@ Dart_NewExternalLatin1String(const uint8_t* latin1_array,
2043
2039
intptr_t length ,
2044
2040
void * peer ,
2045
2041
intptr_t external_allocation_size ,
2046
- Dart_WeakPersistentHandleFinalizer callback );
2042
+ Dart_HandleFinalizer callback );
2047
2043
2048
2044
/**
2049
2045
* Returns a String which references an external array of UTF-16 encoded
@@ -2064,7 +2060,7 @@ Dart_NewExternalUTF16String(const uint16_t* utf16_array,
2064
2060
intptr_t length ,
2065
2061
void * peer ,
2066
2062
intptr_t external_allocation_size ,
2067
- Dart_WeakPersistentHandleFinalizer callback );
2063
+ Dart_HandleFinalizer callback );
2068
2064
2069
2065
/**
2070
2066
* Gets the C string representation of a String.
@@ -2437,13 +2433,13 @@ DART_EXPORT Dart_Handle Dart_NewExternalTypedData(Dart_TypedData_Type type,
2437
2433
* \return The TypedData object if no error occurs. Otherwise returns
2438
2434
* an error handle.
2439
2435
*/
2440
- DART_EXPORT Dart_Handle Dart_NewExternalTypedDataWithFinalizer (
2441
- Dart_TypedData_Type type ,
2442
- void * data ,
2443
- intptr_t length ,
2444
- void * peer ,
2445
- intptr_t external_allocation_size ,
2446
- Dart_WeakPersistentHandleFinalizer callback );
2436
+ DART_EXPORT Dart_Handle
2437
+ Dart_NewExternalTypedDataWithFinalizer ( Dart_TypedData_Type type ,
2438
+ void * data ,
2439
+ intptr_t length ,
2440
+ void * peer ,
2441
+ intptr_t external_allocation_size ,
2442
+ Dart_HandleFinalizer callback );
2447
2443
2448
2444
/**
2449
2445
* Returns a ByteBuffer object for the typed data.
@@ -3695,22 +3691,28 @@ DART_EXPORT Dart_Handle Dart_LoadingUnitLibraryUris(intptr_t loading_unit_id);
3695
3691
#define kSnapshotBuildIdCSymbol "kDartSnapshotBuildId"
3696
3692
#define kVmSnapshotDataCSymbol "kDartVmSnapshotData"
3697
3693
#define kVmSnapshotInstructionsCSymbol "kDartVmSnapshotInstructions"
3694
+ #define kVmSnapshotBssCSymbol "kDartVmSnapshotBss"
3698
3695
#define kIsolateSnapshotDataCSymbol "kDartIsolateSnapshotData"
3699
3696
#define kIsolateSnapshotInstructionsCSymbol "kDartIsolateSnapshotInstructions"
3697
+ #define kIsolateSnapshotBssCSymbol "kDartIsolateSnapshotBss"
3700
3698
#else
3701
3699
#define kSnapshotBuildIdCSymbol "_kDartSnapshotBuildId"
3702
3700
#define kVmSnapshotDataCSymbol "_kDartVmSnapshotData"
3703
3701
#define kVmSnapshotInstructionsCSymbol "_kDartVmSnapshotInstructions"
3702
+ #define kVmSnapshotBssCSymbol "_kDartVmSnapshotBss"
3704
3703
#define kIsolateSnapshotDataCSymbol "_kDartIsolateSnapshotData"
3705
3704
#define kIsolateSnapshotInstructionsCSymbol "_kDartIsolateSnapshotInstructions"
3705
+ #define kIsolateSnapshotBssCSymbol "_kDartIsolateSnapshotBss"
3706
3706
#endif
3707
3707
3708
3708
#define kSnapshotBuildIdAsmSymbol "_kDartSnapshotBuildId"
3709
3709
#define kVmSnapshotDataAsmSymbol "_kDartVmSnapshotData"
3710
3710
#define kVmSnapshotInstructionsAsmSymbol "_kDartVmSnapshotInstructions"
3711
+ #define kVmSnapshotBssAsmSymbol "_kDartVmSnapshotBss"
3711
3712
#define kIsolateSnapshotDataAsmSymbol "_kDartIsolateSnapshotData"
3712
3713
#define kIsolateSnapshotInstructionsAsmSymbol \
3713
3714
"_kDartIsolateSnapshotInstructions"
3715
+ #define kIsolateSnapshotBssAsmSymbol "_kDartIsolateSnapshotBss"
3714
3716
3715
3717
/**
3716
3718
* Creates a precompiled snapshot.
0 commit comments