Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: include/dart_api.h

Issue 10450016: Add a callback to inform embedders when an isolate is being shut down. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bin/run_vm_tests.cc ('k') | vm/dart.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/dart_api.h
===================================================================
--- include/dart_api.h (revision 7933)
+++ include/dart_api.h (working copy)
@@ -435,8 +435,6 @@
* When the callback is called, Dart_CurrentIsolate can be used to
* figure out which isolate is being interrupted.
*
- * \param current_isolate The isolate being interrupted.
- *
* \return The embedder returns true if the isolate should continue
* execution. If the embedder returns false, the isolate will be
* unwound (currently unimplemented).
@@ -445,6 +443,26 @@
// TODO(turnidge): Define and implement unwinding.
/**
+ * An isolate shutdown callback function.
+ *
+ * This callback, provided by the embedder, is called when the vm
+ * shuts down an isolate.
+ *
+ * The isolate may be in the process of shutting down due to an
+ * unrecoverable error, so it is not safe to enter the isolate or use
+ * it to run any Dart code. No further Dart code will be run on this
+ * isolate by the vm.
+ *
+ * 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_IsolateShutdownCallback)(void* callback_data);
+
+/**
* Initializes the VM.
*
* \param create A function to be called during isolate creation.
@@ -455,7 +473,8 @@
* \return True if initialization is successful.
*/
DART_EXPORT bool Dart_Initialize(Dart_IsolateCreateCallback create,
- Dart_IsolateInterruptCallback interrupt);
+ Dart_IsolateInterruptCallback interrupt,
+ Dart_IsolateShutdownCallback shutdown);
/**
* Sets command line flags. Should be called before Dart_Initialize.
« no previous file with comments | « bin/run_vm_tests.cc ('k') | vm/dart.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698