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

Unified Diff: runtime/include/dart_api.h

Issue 14142008: Add support for more typed data types on native ports (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h
index 2ac024ad2383f7717443b4c4e11cb12166064d6f..b75db3c3f9708c5b07f41a03ed1e92b58bf4e3f6 100755
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -942,6 +942,11 @@ DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle object);
* representation as a Dart_CObject.
*
* The string encoding in the 'value.as_string' is UTF-8.
+ *
+ * All the different types from dart:typeddata are all expopsed as
Mads Ager (google) 2013/04/12 09:03:46 are all expopsed -> are exposed
Søren Gjesse 2013/04/15 09:14:34 Done.
+ * type kByteArray. The specific type from dart:typeddata is in the
+ * as_byte_array structure. No matter what specific type the byte
Mads Ager (google) 2013/04/12 09:03:46 Maybe shorten the last sentence to just: "The leng
Søren Gjesse 2013/04/15 09:14:34 Done.
+ * array has the specified length is always in bytes.
*/
typedef struct _Dart_CObject {
enum Type {
@@ -953,11 +958,20 @@ typedef struct _Dart_CObject {
kDouble,
kString,
kArray,
- kUint8Array,
- kExternalUint8Array,
+ kByteArray,
+ kExternalByteArray,
kUnsupported,
kNumberOfTypes
} type;
+
+ enum ByteArrayType {
+ kInt8Array = 0,
+ kUint8Array,
+ kInt16Array,
+ kUint16Array,
+ kNumberOfByteArrayTypes
+ };
+
union {
bool as_bool;
int32_t as_int32;
@@ -970,10 +984,12 @@ typedef struct _Dart_CObject {
struct _Dart_CObject** values;
} as_array;
struct {
+ ByteArrayType type;
int length;
uint8_t* values;
} as_byte_array;
struct {
+ ByteArrayType type;
int length;
uint8_t* data;
void* peer;

Powered by Google App Engine
This is Rietveld 408576698