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

Unified Diff: runtime/include/dart_api.h

Issue 9655011: Implement prologue weak persistent handles. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: final revision 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.h » ('j') | no next file with comments »
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 ed9f8710f516445e1bddf22e2efcc081ee5e0bbb..c9732c3d7aa7b1767867e70d6e1e66c9aa180338 100755
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -238,6 +238,15 @@ DART_EXPORT void Dart_DeletePersistentHandle(Dart_Handle object);
* explicitly deallocated by calling Dart_DeletePersistentHandle.
*
* Requires there to be a current isolate.
+ *
+ * \param object An object.
+ * \param peer A pointer to a native object or NULL. This value is
+ * provided to callback when it is invoked.
+ * \param callback A function pointer that will be invoked sometime
+ * after the object is garbage collected.
+ *
+ * \return Success if the weak persistent handle was
+ * created. Otherwise, returns an error.
*/
DART_EXPORT Dart_Handle Dart_NewWeakPersistentHandle(
Dart_Handle object,
@@ -251,6 +260,43 @@ DART_EXPORT Dart_Handle Dart_NewWeakPersistentHandle(
*/
DART_EXPORT bool Dart_IsWeakPersistentHandle(Dart_Handle object);
+/**
+ * Allocates a prologue weak persistent handle for an object.
+ *
+ * Prologue weak persistent handles are similar to weak persistent
+ * handles but exhibit different behavior during garbage collections
+ * that invoke the prologue and epilogue callbacks. While weak
+ * persistent handles always weakly reference their referents,
+ * prologue weak persistent handles weakly reference their referents
+ * only during a garbage collection that invokes the prologue and
+ * epilogue callbacks. During all other garbage collections, prologue
+ * weak persistent handles strongly reference their referents.
+ *
+ * This handle has the lifetime of the current isolate unless it is
+ * explicitly deallocated by calling Dart_DeletePersistentHandle.
+ *
+ * Requires there to be a current isolate.
+ *
+ * \param object An object.
+ * \param peer A pointer to a native object or NULL. This value is
+ * provided to callback when it is invoked.
+ * \param callback A function pointer that will be invoked sometime
+ * after the object is garbage collected.
+ *
+ * \return Success if the prologue weak persistent handle was created.
+ * Otherwise, returns an error.
+ */
+DART_EXPORT Dart_Handle Dart_NewPrologueWeakPersistentHandle(
+ Dart_Handle object,
+ void* peer,
+ Dart_WeakPersistentHandleFinalizer callback);
+
+/**
+ * Is this object a prologue weak persistent handle?
+ *
+ * Requires there to be a current isolate.
+ */
+DART_EXPORT bool Dart_IsPrologueWeakPersistentHandle(Dart_Handle object);
/**
* Constructs a set of weak references from the Cartesian product of
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698