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

Unified Diff: mojo/apps/js/bindings/codec.js

Issue 114883003: Implement more of the JavaScript GL API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: asdf Created 7 years 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
« no previous file with comments | « gin/runner.cc ('k') | mojo/apps/js/bindings/connector.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/apps/js/bindings/codec.js
diff --git a/mojo/apps/js/bindings/codec.js b/mojo/apps/js/bindings/codec.js
index 0245de4d3c843c2bf3d7b0062a713304aae690b0..edaa005eafed9a9cdacc6c8aa855bc9d48f7d650 100644
--- a/mojo/apps/js/bindings/codec.js
+++ b/mojo/apps/js/bindings/codec.js
@@ -44,12 +44,6 @@ define(function() {
(memory[pointer + 3] << 24);
}
- function load64(memory, pointer) {
- var low = load32(memory, pointer);
- var high = load32(memory, pointer + 4);
- return low + high * 0x10000;
- }
-
var kAlignment = 8;
function align(size) {
@@ -98,6 +92,9 @@ define(function() {
this.handles = handles;
this.base = base;
this.next = base;
+ this.viewU32 = new Uint32Array(
+ this.memory.buffer, 0,
+ Math.floor(this.memory.length / Uint32Array.BYTES_PER_ELEMENT));
}
Decoder.prototype.skip = function(offset) {
@@ -111,15 +108,15 @@ define(function() {
};
Decoder.prototype.read32 = function() {
- var result = load32(this.memory, this.next);
- this.next += 4;
+ var result = this.viewU32[this.next / this.viewU32.BYTES_PER_ELEMENT];
+ this.next += this.viewU32.BYTES_PER_ELEMENT;
return result;
};
Decoder.prototype.read64 = function() {
- var result = load64(this.memory, this.next);
- this.next += 8;
- return result;
+ var low = this.read32();
+ var high = this.read32();
+ return low + high * 0x100000000;
};
Decoder.prototype.decodePointer = function() {
« no previous file with comments | « gin/runner.cc ('k') | mojo/apps/js/bindings/connector.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698