Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/typedObjects/primitiveTypes.js

Issue 6253377650425856: WIP - Dictionary types implementation (Closed)
Patch Set: Created Jan. 9, 2015, 3:34 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/typedObjects/objectTypes.js ('k') | test/index.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/typedObjects/primitiveTypes.js
===================================================================
--- a/lib/typedObjects/primitiveTypes.js
+++ b/lib/typedObjects/primitiveTypes.js
@@ -14,16 +14,17 @@
* You should have received a copy of the GNU General Public License
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
"use strict";
let {ilog2} = require("typedObjects/utils");
let {createArrayType} = require("typedObjects/arrayTypes");
+let {createDictionaryType} = require("typedObjects/dictionaryTypes");
function createGetter(shift, offset, view)
{
shift = shift | 0;
offset = offset | 0;
offset >>= shift;
return function(bufferIndex, byteOffset)
{
@@ -55,16 +56,17 @@ function PrimitiveType(viewType)
let offsetShift = ilog2(result.byteLength) | 0;
result.createGetter = createGetter.bind(null, offsetShift);
result.createSetter = createSetter.bind(null, offsetShift);
// Note: this is a pretty inefficient way to zero out initial values. We
// should consider using ArrayBuffer.fill(0) once it becomes available
// (https://bugzilla.mozilla.org/show_bug.cgi?id=730880).
result.initialValue = 0;
result.Array = createArrayType.bind(null, result);
+ result.Dictionary = createDictionaryType.bind(null, result);
Object.freeze(result);
return result;
}
exports.uint8 = exports.boolean = new PrimitiveType(Uint8Array);
exports.uint8clamped = new PrimitiveType(Uint8ClampedArray);
exports.int8 = new PrimitiveType(Int8Array);
exports.uint16 = new PrimitiveType(Uint16Array);
« no previous file with comments | « lib/typedObjects/objectTypes.js ('k') | test/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld