| OLD | NEW |
| 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/buffer", function() { | 5 (function() { |
| 6 var internal = mojoBindings.internal; |
| 6 | 7 |
| 7 var kHostIsLittleEndian = (function () { | 8 var kHostIsLittleEndian = (function () { |
| 8 var endianArrayBuffer = new ArrayBuffer(2); | 9 var endianArrayBuffer = new ArrayBuffer(2); |
| 9 var endianUint8Array = new Uint8Array(endianArrayBuffer); | 10 var endianUint8Array = new Uint8Array(endianArrayBuffer); |
| 10 var endianUint16Array = new Uint16Array(endianArrayBuffer); | 11 var endianUint16Array = new Uint16Array(endianArrayBuffer); |
| 11 endianUint16Array[0] = 1; | 12 endianUint16Array[0] = 1; |
| 12 return endianUint8Array[0] == 1; | 13 return endianUint8Array[0] == 1; |
| 13 })(); | 14 })(); |
| 14 | 15 |
| 15 var kHighWordMultiplier = 0x100000000; | 16 var kHighWordMultiplier = 0x100000000; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 144 } |
| 144 } | 145 } |
| 145 | 146 |
| 146 Buffer.prototype.setFloat32 = function(offset, value) { | 147 Buffer.prototype.setFloat32 = function(offset, value) { |
| 147 this.dataView.setFloat32(offset, value, kHostIsLittleEndian); | 148 this.dataView.setFloat32(offset, value, kHostIsLittleEndian); |
| 148 } | 149 } |
| 149 Buffer.prototype.setFloat64 = function(offset, value) { | 150 Buffer.prototype.setFloat64 = function(offset, value) { |
| 150 this.dataView.setFloat64(offset, value, kHostIsLittleEndian); | 151 this.dataView.setFloat64(offset, value, kHostIsLittleEndian); |
| 151 } | 152 } |
| 152 | 153 |
| 153 var exports = {}; | 154 internal.Buffer = Buffer; |
| 154 exports.Buffer = Buffer; | 155 })(); |
| 155 return exports; | |
| 156 }); | |
| OLD | NEW |