OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 if (typeof reference != "undefined") | 152 if (typeof reference != "undefined") |
153 { | 153 { |
154 [bufferIndex, byteOffset] = alloc(reference, | 154 [bufferIndex, byteOffset] = alloc(reference, |
155 referenceLength * newSize, (bufferSize / newSize) | 0, | 155 referenceLength * newSize, (bufferSize / newSize) | 0, |
156 buffers, viewTypes, views); | 156 buffers, viewTypes, views); |
157 } | 157 } |
158 else | 158 else |
159 { | 159 { |
160 // This array is too large, it needs an individual buffer | 160 // This array is too large, it needs an individual buffer |
161 bufferIndex = addBuffer(referenceLength * newSize, buffers, viewTypes,
views); | 161 bufferIndex = addBuffer(referenceLength * newSize, buffers, viewTypes,
views); |
162 bufferOffset = 0; | 162 byteOffset = 0; |
163 } | 163 } |
164 | 164 |
165 if (size > 0) | 165 if (size > 0) |
166 { | 166 { |
167 let copyBytes = length * referenceLength; | 167 let copyBytes = length * referenceLength; |
168 let src = new Uint8Array(buffers[this.arrayBufferIndex], this.arrayByt
eOffset, copyBytes); | 168 let src = new Uint8Array(buffers[this.arrayBufferIndex], this.arrayByt
eOffset, copyBytes); |
169 let dst = new Uint8Array(buffers[bufferIndex], byteOffset, copyBytes); | 169 let dst = new Uint8Array(buffers[bufferIndex], byteOffset, copyBytes); |
170 dst.set(src); | 170 dst.set(src); |
171 } | 171 } |
172 | 172 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 meta.watch = {}; | 342 meta.watch = {}; |
343 | 343 |
344 meta.watch.length = createLengthWatcher(elementType, elementSetter); | 344 meta.watch.length = createLengthWatcher(elementType, elementSetter); |
345 meta.watch.size = createSizeWatcher(elementType, minElements, bufferSize, buff
ers, viewTypes, views, firstFree); | 345 meta.watch.size = createSizeWatcher(elementType, minElements, bufferSize, buff
ers, viewTypes, views, firstFree); |
346 | 346 |
347 let {ObjectBase} = require("typedObjects/objectTypes"); | 347 let {ObjectBase} = require("typedObjects/objectTypes"); |
348 return ObjectBase.extend(typeDescriptor, meta); | 348 return ObjectBase.extend(typeDescriptor, meta); |
349 } | 349 } |
350 | 350 |
351 exports.createArrayType = createArrayType; | 351 exports.createArrayType = createArrayType; |
OLD | NEW |