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

Unified Diff: runtime/include/dart_api.h

Issue 8984006: Implement weak persistent handles in the Dart API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments Created 9 years 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') | 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 ea89dd0d9ac278d829621915ec82392f84eb5f88..2b30911566458cded2ee785865c22a5b11194d14 100755
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -95,6 +95,8 @@ typedef unsigned __int64 uint64_t;
*/
typedef struct _Dart_Handle* Dart_Handle;
+typedef void (*Dart_PeerFinalizer)(void* peer);
Ivan Posva 2011/12/20 01:32:34 As discussed we should add the Dart_Handle to this
+
/**
* Is this an error handle?
*
@@ -204,24 +206,24 @@ DART_EXPORT Dart_Handle Dart_NewPersistentHandle(Dart_Handle object);
DART_EXPORT void Dart_DeletePersistentHandle(Dart_Handle object);
/**
- * Takes a persistent handle and makes it weak.
+ * Allocates a weak persistent handle for an object.
*
- * UNIMPLEMENTED.
+ * 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.
*/
-DART_EXPORT Dart_Handle Dart_MakeWeakPersistentHandle(Dart_Handle object);
-// TODO(turnidge): Needs a "near death" callback here.
-// TODO(turnidge): Add IsWeak, Clear, etc.
+DART_EXPORT Dart_Handle Dart_NewWeakPersistentHandle(
+ Dart_Handle object,
+ void* peer,
+ Dart_PeerFinalizer callback);
/**
- * Takes a weak persistent handle and makes it non-weak.
- *
- * UNIMPLEMENTED.
+ * Is this object a weak persistent handle?
*
* Requires there to be a current isolate.
*/
-DART_EXPORT Dart_Handle Dart_MakePersistentHandle(Dart_Handle object);
+DART_EXPORT bool Dart_IsWeakPersistentHandle(Dart_Handle object);
// --- Initialization and Globals ---
@@ -885,9 +887,6 @@ DART_EXPORT Dart_Handle Dart_NewString16(const uint16_t* codepoints,
DART_EXPORT Dart_Handle Dart_NewString32(const uint32_t* codepoints,
intptr_t length);
-
-typedef void (*Dart_PeerFinalizer)(void* peer);
-
/**
* Is this object an external String?
*
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698