| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 namespace WTF { | 31 namespace WTF { |
| 32 | 32 |
| 33 class ArrayBuffer; | 33 class ArrayBuffer; |
| 34 | 34 |
| 35 class Int16Array final : public IntegralTypedArrayBase<short> { | 35 class Int16Array final : public IntegralTypedArrayBase<short> { |
| 36 public: | 36 public: |
| 37 static inline PassRefPtr<Int16Array> create(unsigned length); | 37 static inline PassRefPtr<Int16Array> create(unsigned length); |
| 38 static inline PassRefPtr<Int16Array> create(const short* array, unsigned len
gth); | 38 static inline PassRefPtr<Int16Array> create(const short* array, unsigned len
gth); |
| 39 static inline PassRefPtr<Int16Array> create(PassRefPtr<ArrayBuffer>, unsigne
d byteOffset, unsigned length); | 39 static inline PassRefPtr<Int16Array> create(PassRefPtr<ArrayBuffer>, unsigne
d byteOffset, unsigned length); |
| 40 | 40 |
| 41 // Should only be used when it is known the entire array will be filled. Do | |
| 42 // not return these results directly to JavaScript without filling first. | |
| 43 static inline PassRefPtr<Int16Array> createUninitialized(unsigned length); | |
| 44 | |
| 45 using TypedArrayBase<short>::set; | 41 using TypedArrayBase<short>::set; |
| 46 using IntegralTypedArrayBase<short>::set; | 42 using IntegralTypedArrayBase<short>::set; |
| 47 | 43 |
| 48 inline PassRefPtr<Int16Array> subarray(int start) const; | |
| 49 inline PassRefPtr<Int16Array> subarray(int start, int end) const; | |
| 50 | |
| 51 virtual ViewType type() const override | 44 virtual ViewType type() const override |
| 52 { | 45 { |
| 53 return TypeInt16; | 46 return TypeInt16; |
| 54 } | 47 } |
| 55 | 48 |
| 56 private: | 49 private: |
| 57 inline Int16Array(PassRefPtr<ArrayBuffer>, | 50 inline Int16Array(PassRefPtr<ArrayBuffer>, |
| 58 unsigned byteOffset, | 51 unsigned byteOffset, |
| 59 unsigned length); | 52 unsigned length); |
| 60 // Make constructor visible to superclass. | 53 // Make constructor visible to superclass. |
| 61 friend class TypedArrayBase<short>; | 54 friend class TypedArrayBase<short>; |
| 62 }; | 55 }; |
| 63 | 56 |
| 64 PassRefPtr<Int16Array> Int16Array::create(unsigned length) | 57 PassRefPtr<Int16Array> Int16Array::create(unsigned length) |
| 65 { | 58 { |
| 66 return TypedArrayBase<short>::create<Int16Array>(length); | 59 return TypedArrayBase<short>::create<Int16Array>(length); |
| 67 } | 60 } |
| 68 | 61 |
| 69 PassRefPtr<Int16Array> Int16Array::create(const short* array, unsigned length) | 62 PassRefPtr<Int16Array> Int16Array::create(const short* array, unsigned length) |
| 70 { | 63 { |
| 71 return TypedArrayBase<short>::create<Int16Array>(array, length); | 64 return TypedArrayBase<short>::create<Int16Array>(array, length); |
| 72 } | 65 } |
| 73 | 66 |
| 74 PassRefPtr<Int16Array> Int16Array::create(PassRefPtr<ArrayBuffer> buffer, unsign
ed byteOffset, unsigned length) | 67 PassRefPtr<Int16Array> Int16Array::create(PassRefPtr<ArrayBuffer> buffer, unsign
ed byteOffset, unsigned length) |
| 75 { | 68 { |
| 76 return TypedArrayBase<short>::create<Int16Array>(buffer, byteOffset, length)
; | 69 return TypedArrayBase<short>::create<Int16Array>(buffer, byteOffset, length)
; |
| 77 } | 70 } |
| 78 | 71 |
| 79 PassRefPtr<Int16Array> Int16Array::createUninitialized(unsigned length) | |
| 80 { | |
| 81 return TypedArrayBase<short>::createUninitialized<Int16Array>(length); | |
| 82 } | |
| 83 | |
| 84 Int16Array::Int16Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsi
gned length) | 72 Int16Array::Int16Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsi
gned length) |
| 85 : IntegralTypedArrayBase<short>(buffer, byteOffset, length) | 73 : IntegralTypedArrayBase<short>(buffer, byteOffset, length) |
| 86 { | 74 { |
| 87 } | 75 } |
| 88 | 76 |
| 89 PassRefPtr<Int16Array> Int16Array::subarray(int start) const | |
| 90 { | |
| 91 return subarray(start, length()); | |
| 92 } | |
| 93 | |
| 94 PassRefPtr<Int16Array> Int16Array::subarray(int start, int end) const | |
| 95 { | |
| 96 return subarrayImpl<Int16Array>(start, end); | |
| 97 } | |
| 98 | |
| 99 } // namespace WTF | 77 } // namespace WTF |
| 100 | 78 |
| 101 using WTF::Int16Array; | 79 using WTF::Int16Array; |
| 102 | 80 |
| 103 #endif // Int16Array_h | 81 #endif // Int16Array_h |
| OLD | NEW |