Add support for flushing microtasks in dart_engine.h

Also add a sample for calling Dart functions which return/accept futures.

Change-Id: I932d0577709f4e068ccd3212797751ecb347c4f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408281
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
Ivan Inozemtsev
2025-02-12 11:10:25 -08:00
committed by Commit Queue
parent a6f06e8c9f
commit 51ea42537a
17 changed files with 478 additions and 38 deletions
+11
View File
@@ -109,6 +109,17 @@ typedef void (*DartEngine_HandleMessageErrorCallback)(
DART_EXPORT void DartEngine_SetHandleMessageErrorCallback(
DartEngine_HandleMessageErrorCallback handle_message_error_callback);
/**
* Drains the microtasks queue. Requires to be an active isolate.
*
* Normally the microtasks queue is drained after handling each
* isolate message, but when the engine calls into Dart, it might be
* required to manually drain the microtasks queue.
*
* \return Dart_Handle invocation result.
*/
DART_EXPORT Dart_Handle DartEngine_DrainMicrotasksQueue();
/**
* Handles a single message for an isolate.
*/