Index: runtime/include/dart_api.h |
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h |
index 4db93630fc3f533ed4bbf7c2e78767134dd3d34a..e18df1bf24080c02a1850811e8d5cdd9149f8483 100644 |
--- a/runtime/include/dart_api.h |
+++ b/runtime/include/dart_api.h |
@@ -708,6 +708,22 @@ typedef void (*Dart_IsolateUnhandledExceptionCallback)(Dart_Handle error); |
typedef void (*Dart_IsolateShutdownCallback)(void* callback_data); |
/** |
+ * An isolate cleanup callback function. |
+ * |
+ * This callback, provided by the embedder, is called after the vm |
+ * shuts down an isolate. There will be no current isolate and it is *not* |
+ * safe to run Dart code. |
+ * |
+ * This function should be used to dispose of native resources that |
+ * are allocated to an isolate in order to avoid leaks. |
+ * |
+ * \param callback_data The same callback data which was passed to the |
+ * isolate when it was created. |
+ * |
+ */ |
+typedef void (*Dart_IsolateCleanupCallback)(void* callback_data); |
+ |
+/** |
* A thread death callback function. |
* This callback, provided by the embedder, is called before a thread in the |
* vm thread pool exits. |
@@ -788,6 +804,8 @@ typedef Dart_Handle (*Dart_GetVMServiceAssetsArchive)(); |
* See Dart_IsolateCreateCallback. |
* \param shutdown A function to be called when an isolate is shutdown. |
* See Dart_IsolateShutdownCallback. |
+ * \param cleanup A function to be called after an isolate is shutdown. |
+ * See Dart_IsolateCleanupCallback. |
* \param get_service_assets A function to be called by the service isolate when |
* it requires the vmservice assets archive. |
* See Dart_GetVMServiceAssetsArchive. |
@@ -798,6 +816,7 @@ typedef struct { |
const uint8_t* vm_snapshot_instructions; |
Dart_IsolateCreateCallback create; |
Dart_IsolateShutdownCallback shutdown; |
+ Dart_IsolateCleanupCallback cleanup; |
Dart_ThreadExitCallback thread_exit; |
Dart_FileOpenCallback file_open; |
Dart_FileReadCallback file_read; |