summaryrefslogtreecommitdiffstats
path: root/mojo/public/js/bindings/connector.js
diff options
context:
space:
mode:
authortsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-23 01:47:33 +0000
committertsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-23 01:47:33 +0000
commit441c47f2715a31ea39ab95806a70f8067395ed08 (patch)
tree2e59fd5f175a272f971bc609e1972f9dc6fdc67f /mojo/public/js/bindings/connector.js
parent816ecff915fe705134b713df053da4e069cf1dad (diff)
downloadchromium_src-441c47f2715a31ea39ab95806a70f8067395ed08.zip
chromium_src-441c47f2715a31ea39ab95806a70f8067395ed08.tar.gz
chromium_src-441c47f2715a31ea39ab95806a70f8067395ed08.tar.bz2
Convert codec.js to use a DataView instead of a Uint8Array.
codec.js is modified to use a DataView as its primary means of accessing an arraybuffer as opposed to a Uint8Array. The DataView then handles the signed/unsigned case appropriately for us without any bit manipulations. We can then remove the load*/store* functions, execpt for the 64-bit versions which remain to pack to/from JS doubles. This then introduces a need to know the endianness of the host, since Mojo messages are written in native byte oreder, but DataView wants a specific ordering (with a big-endian default). The IDL code generator for JS is modified to call into the new functions, which are renamed to avoid confusion between the signed and unsigned versions. The WebUIMojoTest.EndToEndEcho is modified to pass values for each of the possible integral types, to check for correct signedness on the javascript side, and to run fewer iterations. BUG= Review URL: https://codereview.chromium.org/242613010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265473 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/public/js/bindings/connector.js')
-rw-r--r--mojo/public/js/bindings/connector.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/mojo/public/js/bindings/connector.js b/mojo/public/js/bindings/connector.js
index ea5a314..51fb7fe 100644
--- a/mojo/public/js/bindings/connector.js
+++ b/mojo/public/js/bindings/connector.js
@@ -38,10 +38,9 @@ define("mojo/public/js/bindings/connector", [
return true;
var result = core.writeMessage(this.handle_,
- message.memory,
+ new Uint8Array(message.buffer.arrayBuffer),
message.handles,
core.WRITE_MESSAGE_FLAG_NONE);
-
switch (result) {
case core.RESULT_OK:
// The handles were successfully transferred, so we don't own them
@@ -96,11 +95,11 @@ define("mojo/public/js/bindings/connector", [
this.errorHandler_.onError(read.result);
return;
}
- // TODO(abarth): Should core.readMessage return a Uint8Array?
- var memory = new Uint8Array(read.buffer);
- var message = new codec.Message(memory, read.handles);
- if (this.incomingReceiver_)
- this.incomingReceiver_.accept(message);
+ var buffer = new codec.Buffer(read.buffer);
+ var message = new codec.Message(buffer, read.handles);
+ if (this.incomingReceiver_) {
+ this.incomingReceiver_.accept(message);
+ }
}
};