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

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

Issue 231743004: Mojo's JS codec missing 16-bit read/write operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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/bindings/codec", function() { 5 define("mojo/public/js/bindings/codec", function() {
6 6
7 // Memory ------------------------------------------------------------------- 7 // Memory -------------------------------------------------------------------
8 8
9 function store8(memory, pointer, val) { 9 function store8(memory, pointer, val) {
10 memory[pointer] = val; 10 memory[pointer] = val;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 Decoder.prototype.skip = function(offset) { 104 Decoder.prototype.skip = function(offset) {
105 this.next += offset; 105 this.next += offset;
106 }; 106 };
107 107
108 Decoder.prototype.read8 = function() { 108 Decoder.prototype.read8 = function() {
109 var result = load8(this.memory, this.next); 109 var result = load8(this.memory, this.next);
110 this.next += 1; 110 this.next += 1;
111 return result; 111 return result;
112 }; 112 };
113 113
114 Decoder.prototype.read16 = function() {
115 var result = load16(this.memory, this.next);
116 this.next += 2;
117 return result;
118 };
119
114 Decoder.prototype.read32 = function() { 120 Decoder.prototype.read32 = function() {
115 var result = this.viewU32[this.next / this.viewU32.BYTES_PER_ELEMENT]; 121 var result = this.viewU32[this.next / this.viewU32.BYTES_PER_ELEMENT];
116 this.next += this.viewU32.BYTES_PER_ELEMENT; 122 this.next += this.viewU32.BYTES_PER_ELEMENT;
117 return result; 123 return result;
118 }; 124 };
119 125
120 Decoder.prototype.read64 = function() { 126 Decoder.prototype.read64 = function() {
121 var low = this.read32(); 127 var low = this.read32();
122 var high = this.read32(); 128 var high = this.read32();
123 return low + high * 0x100000000; 129 return low + high * 0x100000000;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 202
197 Encoder.prototype.skip = function(offset) { 203 Encoder.prototype.skip = function(offset) {
198 this.next += offset; 204 this.next += offset;
199 }; 205 };
200 206
201 Encoder.prototype.write8 = function(val) { 207 Encoder.prototype.write8 = function(val) {
202 store8(this.buffer.memory, this.next, val); 208 store8(this.buffer.memory, this.next, val);
203 this.next += 1; 209 this.next += 1;
204 }; 210 };
205 211
212 Encoder.prototype.write16 = function(val) {
213 store16(this.buffer.memory, this.next, val);
214 this.next += 2;
215 };
216
206 Encoder.prototype.write32 = function(val) { 217 Encoder.prototype.write32 = function(val) {
207 store32(this.buffer.memory, this.next, val); 218 store32(this.buffer.memory, this.next, val);
208 this.next += 4; 219 this.next += 4;
209 }; 220 };
210 221
211 Encoder.prototype.write64 = function(val) { 222 Encoder.prototype.write64 = function(val) {
212 store64(this.buffer.memory, this.next, val); 223 store64(this.buffer.memory, this.next, val);
213 this.next += 8; 224 this.next += 8;
214 }; 225 };
215 226
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 exports.kMessageIsResponse = kMessageIsResponse; 507 exports.kMessageIsResponse = kMessageIsResponse;
497 exports.Uint8 = Uint8; 508 exports.Uint8 = Uint8;
498 exports.Uint16 = Uint16; 509 exports.Uint16 = Uint16;
499 exports.Uint32 = Uint32; 510 exports.Uint32 = Uint32;
500 exports.Uint64 = Uint64; 511 exports.Uint64 = Uint64;
501 exports.PointerTo = PointerTo; 512 exports.PointerTo = PointerTo;
502 exports.ArrayOf = ArrayOf; 513 exports.ArrayOf = ArrayOf;
503 exports.Handle = Handle; 514 exports.Handle = Handle;
504 return exports; 515 return exports;
505 }); 516 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698