[wasm] Add support for marshalling ArrayBuffer and TypeArrays (#10023)
commit6db65716f323a61283017dfab410df15cae85fef
authorKenneth Pouncey <kjpou@pt.lu>
Mon, 13 Aug 2018 09:41:38 +0000 (13 11:41 +0200)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Mon, 13 Aug 2018 09:41:38 +0000 (13 11:41 +0200)
tree6cabb66933948d5d117fb78017244a108e65f43b
parent3d4ba670f1fd81952596097054e2163a7d4167e0
[wasm] Add support for marshalling ArrayBuffer and TypeArrays (#10023)

* Add support for marshalling ArrayBuffer and TypeArrays from JavaScript to C#.

-  The ArrayBuffer object is used to represent a generic, fixed-length raw binary data buffer.   More Info ---> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays#ArrayBuffer
-  JavaScript typed arrays are array-like objects and provide a mechanism for accessing raw binary data. (...).  More Info ---> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays
-  Some examples of API's that use these are Fetch, WebGL, Canvas, Web Audio API, XMLHttpRequests, WebSockets, Web Workers, Media Source API and File APIs.

| ArrayBuffer | uint8_t | byte[] | byte or Byte (unsigned byte)
| Int8Array  | int8_t | sbyte[] | byte or SByte (signed byte)
| Uint8Array | uint8_t | byte[] | byte or Byte (unsigned byte)
| Uint8ClampedArray| uint8_t | byte[] | byte or Byte (unsigned byte)
| Int16Array | int16_t | short[] | short (signed short)
| Uint16Array | uint16_t | ushort[] | ushort (unsigned short)
| Int32Array | int32_t | int[] | int (signed integer)
| Uint32Array | uint32_t | uint[] | uint (unsigned integer)
| Float32Array | floa t | float[] | float
| Float64Array | double | double[] | double

- Added tests to the bindings-test test harness.

* Add support for marshalling TypeArrays from C# to JavaScript.

- Add tests to test harness.
sdks/wasm/binding_support.js
sdks/wasm/bindings-test.cs
sdks/wasm/driver.c