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

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: Addressed review comments 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..0563aaa470f177a3081b3a9842235bf2e6c6cd05 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 exposed as type
+ * kTypedData. The specific type from dart:typeddata is in the type
+ * field of the as_typed_data structure. The length in the
+ * as_typed_data structure is always in bytes.
*/
typedef struct _Dart_CObject {
enum Type {
@@ -953,11 +958,20 @@ typedef struct _Dart_CObject {
kDouble,
kString,
kArray,
- kUint8Array,
- kExternalUint8Array,
+ kTypedData,
+ kExternalTypedData,
kUnsupported,
kNumberOfTypes
} type;
+
+ enum TypedDataType {
+ kInt8Array = 0,
+ kUint8Array,
siva 2013/04/15 23:28:45 Don't we also need the kUint8ClampedArray type her
+ kInt16Array,
+ kUint16Array,
+ kNumberOfTypedDataTypes
+ };
+
union {
bool as_bool;
int32_t as_int32;
@@ -970,15 +984,17 @@ typedef struct _Dart_CObject {
struct _Dart_CObject** values;
} as_array;
struct {
+ TypedDataType type;
int length;
uint8_t* values;
- } as_byte_array;
+ } as_typed_data;
struct {
+ TypedDataType type;
int length;
uint8_t* data;
void* peer;
Dart_WeakPersistentHandleFinalizer callback;
- } as_external_byte_array;
+ } as_external_typed_data;
} value;
} Dart_CObject;

Powered by Google App Engine
This is Rietveld 408576698