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

Side by Side Diff: mojo/public/js/codec.js

Issue 825613004: Mojo JS Bindings: fix the demos (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | mojo/public/js/connector.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 define("mojo/public/js/codec", [ 5 define("mojo/public/js/codec", [
6 "mojo/public/js/unicode", 6 "mojo/public/js/unicode",
7 "mojo/public/js/buffer", 7 "mojo/public/js/buffer",
8 ], function(unicode, buffer) { 8 ], function(unicode, buffer) {
9 9
10 var kErrorUnsigned = "Passing negative value to unsigned"; 10 var kErrorUnsigned = "Passing negative value to unsigned";
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (!offset) 118 if (!offset)
119 return 0; 119 return 0;
120 return offsetPointer + offset; 120 return offsetPointer + offset;
121 }; 121 };
122 122
123 Decoder.prototype.decodeAndCreateDecoder = function(pointer) { 123 Decoder.prototype.decodeAndCreateDecoder = function(pointer) {
124 return new Decoder(this.buffer, this.handles, pointer); 124 return new Decoder(this.buffer, this.handles, pointer);
125 }; 125 };
126 126
127 Decoder.prototype.decodeHandle = function() { 127 Decoder.prototype.decodeHandle = function() {
128 return this.handles[this.readUint32()]; 128 return this.handles[this.readUint32()] || null;
129 }; 129 };
130 130
131 Decoder.prototype.decodeString = function() { 131 Decoder.prototype.decodeString = function() {
132 var numberOfBytes = this.readUint32(); 132 var numberOfBytes = this.readUint32();
133 var numberOfElements = this.readUint32(); 133 var numberOfElements = this.readUint32();
134 var base = this.next; 134 var base = this.next;
135 this.next += numberOfElements; 135 this.next += numberOfElements;
136 return unicode.decodeUtf8String( 136 return unicode.decodeUtf8String(
137 new Uint8Array(this.buffer.arrayBuffer, base, numberOfElements)); 137 new Uint8Array(this.buffer.arrayBuffer, base, numberOfElements));
138 }; 138 };
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 exports.NullablePointerTo = NullablePointerTo; 820 exports.NullablePointerTo = NullablePointerTo;
821 exports.ArrayOf = ArrayOf; 821 exports.ArrayOf = ArrayOf;
822 exports.NullableArrayOf = NullableArrayOf; 822 exports.NullableArrayOf = NullableArrayOf;
823 exports.PackedBool = PackedBool; 823 exports.PackedBool = PackedBool;
824 exports.Handle = Handle; 824 exports.Handle = Handle;
825 exports.NullableHandle = NullableHandle; 825 exports.NullableHandle = NullableHandle;
826 exports.MapOf = MapOf; 826 exports.MapOf = MapOf;
827 exports.NullableMapOf = NullableMapOf; 827 exports.NullableMapOf = NullableMapOf;
828 return exports; 828 return exports;
829 }); 829 });
OLDNEW
« no previous file with comments | « no previous file | mojo/public/js/connector.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698