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 16 matching lines...) Expand all Loading... |
27 #define Int16Array_h | 27 #define Int16Array_h |
28 | 28 |
29 #include "wtf/IntegralTypedArrayBase.h" | 29 #include "wtf/IntegralTypedArrayBase.h" |
30 | 30 |
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> createOrNull(unsigned length); |
38 static inline PassRefPtr<Int16Array> create(const short* array, unsigned len
gth); | 38 static inline PassRefPtr<Int16Array> createOrNull(const short* array, unsign
ed length); |
| 39 static inline PassRefPtr<Int16Array> deprecatedCreateOrCrash(const short* ar
ray, unsigned length); |
39 static inline PassRefPtr<Int16Array> create(PassRefPtr<ArrayBuffer>, unsigne
d byteOffset, unsigned length); | 40 static inline PassRefPtr<Int16Array> create(PassRefPtr<ArrayBuffer>, unsigne
d byteOffset, unsigned length); |
40 | 41 |
41 using TypedArrayBase<short>::set; | 42 using TypedArrayBase<short>::set; |
42 using IntegralTypedArrayBase<short>::set; | 43 using IntegralTypedArrayBase<short>::set; |
43 | 44 |
44 ViewType type() const override | 45 ViewType type() const override |
45 { | 46 { |
46 return TypeInt16; | 47 return TypeInt16; |
47 } | 48 } |
48 | 49 |
49 private: | 50 private: |
50 inline Int16Array(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned len
gth); | 51 inline Int16Array(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned len
gth); |
51 // Make constructor visible to superclass. | 52 // Make constructor visible to superclass. |
52 friend class TypedArrayBase<short>; | 53 friend class TypedArrayBase<short>; |
53 }; | 54 }; |
54 | 55 |
55 PassRefPtr<Int16Array> Int16Array::create(unsigned length) | 56 PassRefPtr<Int16Array> Int16Array::createOrNull(unsigned length) |
56 { | 57 { |
57 return TypedArrayBase<short>::create<Int16Array>(length); | 58 return TypedArrayBase<short>::createOrNull<Int16Array>(length); |
58 } | 59 } |
59 | 60 |
60 PassRefPtr<Int16Array> Int16Array::create(const short* array, unsigned length) | 61 PassRefPtr<Int16Array> Int16Array::createOrNull(const short* array, unsigned len
gth) |
61 { | 62 { |
62 return TypedArrayBase<short>::create<Int16Array>(array, length); | 63 return TypedArrayBase<short>::createOrNull<Int16Array>(array, length); |
| 64 } |
| 65 |
| 66 PassRefPtr<Int16Array> Int16Array::deprecatedCreateOrCrash(const short* array, u
nsigned length) |
| 67 { |
| 68 return TypedArrayBase<short>::deprecatedCreateOrCrash<Int16Array>(array, len
gth); |
63 } | 69 } |
64 | 70 |
65 PassRefPtr<Int16Array> Int16Array::create(PassRefPtr<ArrayBuffer> buffer, unsign
ed byteOffset, unsigned length) | 71 PassRefPtr<Int16Array> Int16Array::create(PassRefPtr<ArrayBuffer> buffer, unsign
ed byteOffset, unsigned length) |
66 { | 72 { |
67 return TypedArrayBase<short>::create<Int16Array>(buffer, byteOffset, length)
; | 73 return TypedArrayBase<short>::create<Int16Array>(buffer, byteOffset, length)
; |
68 } | 74 } |
69 | 75 |
70 Int16Array::Int16Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsi
gned length) | 76 Int16Array::Int16Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsi
gned length) |
71 : IntegralTypedArrayBase<short>(buffer, byteOffset, length) | 77 : IntegralTypedArrayBase<short>(buffer, byteOffset, length) |
72 { | 78 { |
73 } | 79 } |
74 | 80 |
75 } // namespace WTF | 81 } // namespace WTF |
76 | 82 |
77 using WTF::Int16Array; | 83 using WTF::Int16Array; |
78 | 84 |
79 #endif // Int16Array_h | 85 #endif // Int16Array_h |
OLD | NEW |