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

Unified Diff: runtime/include/dart_api.h

Issue 9368049: Add external byte array API and finalize external strings and byte arrays. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address review comments Created 8 years, 10 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') | 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 edac66ea97950fdf65071d32004dd1d74885db29..bf4483a04f770bcf278217d65b2e3dbede6279ce 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_WeakPersistentHandleFinalizer)(Dart_Handle handle,
+ void* peer);
typedef void (*Dart_PeerFinalizer)(void* peer);
/**
@@ -240,7 +242,7 @@ DART_EXPORT void Dart_DeletePersistentHandle(Dart_Handle object);
DART_EXPORT Dart_Handle Dart_NewWeakPersistentHandle(
Dart_Handle object,
void* peer,
- Dart_PeerFinalizer callback);
+ Dart_WeakPersistentHandleFinalizer callback);
/**
* Is this object a weak persistent handle?
@@ -1111,13 +1113,41 @@ DART_EXPORT Dart_Handle Dart_ListSetAsBytes(Dart_Handle list,
// --- Byte Arrays ---
-DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length);
-
/**
* Is this object a ByteArray?
*/
DART_EXPORT bool Dart_IsByteArray(Dart_Handle object);
+/**
+ * Returns a ByteArray of the desired length.
+ *
+ * \param length The length of the array.
+ *
+ * \return The ByteArray object if no error occurs. Otherwise returns
+ * an error handle.
+ */
+DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length);
+
+/**
+ * Returns a ByteArray which references an external array of 8-bit bytes.
+ *
+ * \param value An array of 8-bit bytes. This array must not move.
+ * \param length The length of the array.
+ *
+ * \return The ByteArray object if no error occurs. Otherwise returns
+ * an error handle.
+ */
+DART_EXPORT Dart_Handle Dart_NewExternalByteArray(uint8_t* data,
+ intptr_t length,
+ void* peer,
+ Dart_PeerFinalizer callback);
+
+/**
+ * Retrieves the peer pointer associated with an external ByteArray.
+ */
+DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetPeer(Dart_Handle object,
+ void** peer);
+
// --- Closures ---
/**
« 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