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

Unified Diff: runtime/include/dart_api.h

Issue 8775039: Add Dart_IsExternalString and Dart_ExternalStringGetPeer to the dart (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' 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
===================================================================
--- runtime/include/dart_api.h (revision 2079)
+++ runtime/include/dart_api.h (working copy)
@@ -788,16 +788,64 @@
typedef void (*Dart_PeerFinalizer)(void* peer);
+/**
+ * Is this object an external String?
+ *
+ * An external String is a String which references a fixed array of
+ * codepoints which is external to the Dart heap.
+ */
+DART_EXPORT bool Dart_IsExternalString(Dart_Handle object);
+
+/**
+ * Retrieves the peer pointer associated with an external String.
+ */
+DART_EXPORT Dart_Handle Dart_ExternalStringGetPeer(Dart_Handle object,
+ void** peer);
+
+
+/**
+ * Returns a String which references an external array of 8-bit codepoints.
+ *
+ * \param value An array of 8-bit codepoints. This array must not move.
+ * \param length The length of the codepoints array.
+ * \param peer An external pointer to associate with this string.
+ * \param callback A callback to be called when this string is finalized.
+ *
+ * \return The String object if no error occurs. Otherwise returns
+ * an error handle.
+ */
DART_EXPORT Dart_Handle Dart_NewExternalString8(const uint8_t* codepoints,
intptr_t length,
void* peer,
Dart_PeerFinalizer callback);
+/**
+ * Returns a String which references an external array of 16-bit codepoints.
+ *
+ * \param value An array of 16-bit codepoints. This array must not move.
+ * \param length The length of the codepoints array.
+ * \param peer An external pointer to associate with this string.
+ * \param callback A callback to be called when this string is finalized.
+ *
+ * \return The String object if no error occurs. Otherwise returns
+ * an error handle.
+ */
DART_EXPORT Dart_Handle Dart_NewExternalString16(const uint16_t* codepoints,
intptr_t length,
void* peer,
Dart_PeerFinalizer callback);
+/**
+ * Returns a String which references an external array of 32-bit codepoints.
+ *
+ * \param value An array of 32-bit codepoints. This array must not move.
+ * \param length The length of the codepoints array.
+ * \param peer An external pointer to associate with this string.
+ * \param callback A callback to be called when this string is finalized.
+ *
+ * \return The String object if no error occurs. Otherwise returns
+ * an error handle.
+ */
DART_EXPORT Dart_Handle Dart_NewExternalString32(const uint32_t* codepoints,
intptr_t length,
void* peer,
« 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