diff options
Diffstat (limited to 'Source/WTF/wtf/Int32Array.h')
| -rw-r--r-- | Source/WTF/wtf/Int32Array.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Source/WTF/wtf/Int32Array.h b/Source/WTF/wtf/Int32Array.h index ce6868cc2..99bce1ad2 100644 --- a/Source/WTF/wtf/Int32Array.h +++ b/Source/WTF/wtf/Int32Array.h @@ -37,6 +37,10 @@ public: static inline PassRefPtr<Int32Array> create(const int* array, unsigned length); static inline PassRefPtr<Int32Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); + // Should only be used when it is known the entire array will be filled. Do + // not return these results directly to JavaScript without filling first. + static inline PassRefPtr<Int32Array> createUninitialized(unsigned length); + // Can’t use "using" here due to a bug in the RVCT compiler. bool set(TypedArrayBase<int>* array, unsigned offset) { return TypedArrayBase<int>::set(array, offset); } void set(unsigned index, double value) { IntegralTypedArrayBase<int>::set(index, value); } @@ -44,15 +48,17 @@ public: inline PassRefPtr<Int32Array> subarray(int start) const; inline PassRefPtr<Int32Array> subarray(int start, int end) const; + virtual ViewType getType() const + { + return TypeInt32; + } + private: inline Int32Array(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); // Make constructor visible to superclass. friend class TypedArrayBase<int>; - - // Overridden from ArrayBufferView. - virtual bool isIntArray() const { return true; } }; PassRefPtr<Int32Array> Int32Array::create(unsigned length) @@ -70,6 +76,11 @@ PassRefPtr<Int32Array> Int32Array::create(PassRefPtr<ArrayBuffer> buffer, unsign return TypedArrayBase<int>::create<Int32Array>(buffer, byteOffset, length); } +PassRefPtr<Int32Array> Int32Array::createUninitialized(unsigned length) +{ + return TypedArrayBase<int>::createUninitialized<Int32Array>(length); +} + Int32Array::Int32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length) : IntegralTypedArrayBase<int>(buffer, byteOffset, length) { |
