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

Unified Diff: runtime/include/dart_api.h

Issue 187113003: Track external allocated memory for weak persistent handles. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
Index: runtime/include/dart_api.h
===================================================================
--- runtime/include/dart_api.h (revision 33396)
+++ runtime/include/dart_api.h (working copy)
@@ -442,15 +442,18 @@
* persistent handle and the peer as arguments. This gives the native code the
* ability to cleanup data associated with the object and to delete the weak
* persistent handle. It is illegal to call into the VM from the callback,
- * except to delete the weak persistent handle.
+ * except to delete the weak persistent handle. If the handle is deleted before
+ * the object becomes unreachable, the callback is never invoked.
*
* 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 external_allocation_size The number of externally allocated
+ * bytes for peer. Used to inform the garbage collector.
* \param callback A function pointer that will be invoked sometime
- * after the object is garbage collected.
+ * after the object is garbage collected, unless the handle has been deleted.
*
* \return Success if the weak persistent handle was
* created. Otherwise, returns an error.
@@ -458,6 +461,7 @@
DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle(
Dart_Handle object,
void* peer,
+ intptr_t external_allocation_size,
Dart_WeakPersistentHandleFinalizer callback);
DART_EXPORT void Dart_DeleteWeakPersistentHandle(
@@ -484,8 +488,10 @@
* \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 external_allocation_size The number of externally allocated
+ * bytes for peer. Used to inform the garbage collector.
* \param callback A function pointer that will be invoked sometime
- * after the object is garbage collected.
+ * after the object is garbage collected, unless the handle has been deleted.
*
* \return Success if the prologue weak persistent handle was created.
* Otherwise, returns an error.
@@ -493,6 +499,7 @@
DART_EXPORT Dart_WeakPersistentHandle Dart_NewPrologueWeakPersistentHandle(
Dart_Handle object,
void* peer,
+ intptr_t external_allocation_size,
Dart_WeakPersistentHandleFinalizer callback);
/**

Powered by Google App Engine
This is Rietveld 408576698