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

Unified Diff: runtime/include/dart_api.h

Issue 9605033: Implement a garbage collection prologue and epilogue callback mechanism. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address review comments Created 8 years, 9 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 | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | runtime/vm/gc_callbacks.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/include/dart_api.h
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h
index 48b4a4718b2fd9a99b13f11fc5d30b86c7ede05a..786a3515024efabe2c958df84cb5a39277dfe8c3 100755
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -272,6 +272,75 @@ DART_EXPORT Dart_Handle Dart_NewWeakReferenceSet(Dart_Handle* keys,
Dart_Handle* values,
intptr_t num_values);
+// --- Garbage Collection Callbacks --
+
+/**
+ * Callbacks signal the beginning and end of a garbage collection.
+ *
+ * These signals are intended to be used by the embedder to manage the
+ * lifetime of native objects with a managed object peer.
+ */
+
+/**
+ * A callback invoked at the beginning of a garbage collection.
+ */
+typedef void (*Dart_GcPrologueCallback)();
+
+/**
+ * A callback invoked at the end of a garbage collection.
+ */
+typedef void (*Dart_GcEpilogueCallback)();
+
+/**
+ * Adds a garbage collection prologue callback.
+ *
+ * \param callback A function pointer to a prologue callback function.
+ * This function must not have been previously added as a prologue
+ * callback.
+ *
+ * \return Success if the callback was added. Otherwise, returns an
+ * error handle.
+ */
+DART_EXPORT Dart_Handle Dart_AddGcPrologueCallback(
+ Dart_GcPrologueCallback callback);
+
+/**
+ * Removes a garbage collection prologue callback.
+ *
+ * \param callback A function pointer to a prologue callback function.
+ * This function must have been added as a prologue callback.
+ *
+ * \return Success if the callback was removed. Otherwise, returns an
+ * error handle.
+ */
+DART_EXPORT Dart_Handle Dart_RemoveGcPrologueCallback(
+ Dart_GcPrologueCallback callback);
+
+/**
+ * Adds a garbage collection epilogue callback.
+ *
+ * \param callback A function pointer to an epilogue callback
+ * function. This function must not have been previously added as
+ * an epilogue callback.
+ *
+ * \return Success if the callback was added. Otherwise, returns an
+ * error handle.
+ */
+DART_EXPORT Dart_Handle Dart_AddGcEpilogueCallback(
+ Dart_GcEpilogueCallback callback);
+
+/**
+ * Removes a garbage collection epilogue callback.
+ *
+ * \param callback A function pointer to an epilogue callback
+ * function. This function must have been added as an epilogue
+ * callback.
+ *
+ * \return Success if the callback was removed. Otherwise, returns an
+ * error handle.
+ */
+DART_EXPORT Dart_Handle Dart_RemoveGcEpilogueCallback(
+ Dart_GcEpilogueCallback callback);
// --- Initialization and Globals ---
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | runtime/vm/gc_callbacks.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698