OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
3 * Copyright (c) 2010, Google Inc. All rights reserved. | 3 * Copyright (c) 2010, Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 } | 53 } |
54 | 54 |
55 // Overridden from ArrayBufferView. This must be public because of | 55 // Overridden from ArrayBufferView. This must be public because of |
56 // rules about inheritance of members in template classes, and | 56 // rules about inheritance of members in template classes, and |
57 // because it is accessed via pointers to subclasses. | 57 // because it is accessed via pointers to subclasses. |
58 unsigned length() const | 58 unsigned length() const |
59 { | 59 { |
60 return m_length; | 60 return m_length; |
61 } | 61 } |
62 | 62 |
63 virtual unsigned byteLength() const | 63 virtual unsigned byteLength() const OVERRIDE FINAL |
64 { | 64 { |
65 return m_length * sizeof(T); | 65 return m_length * sizeof(T); |
66 } | 66 } |
67 | 67 |
68 // Invoked by the indexed getter. Does not perform range checks; caller | 68 // Invoked by the indexed getter. Does not perform range checks; caller |
69 // is responsible for doing so and returning undefined as necessary. | 69 // is responsible for doing so and returning undefined as necessary. |
70 T item(unsigned index) const | 70 T item(unsigned index) const |
71 { | 71 { |
72 ASSERT_WITH_SECURITY_IMPLICATION(index < TypedArrayBase<T>::m_length); | 72 ASSERT_WITH_SECURITY_IMPLICATION(index < TypedArrayBase<T>::m_length); |
73 return TypedArrayBase<T>::data()[index]; | 73 return TypedArrayBase<T>::data()[index]; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 | 130 |
131 template <class Subclass> | 131 template <class Subclass> |
132 PassRefPtr<Subclass> subarrayImpl(int start, int end) const | 132 PassRefPtr<Subclass> subarrayImpl(int start, int end) const |
133 { | 133 { |
134 unsigned offset, length; | 134 unsigned offset, length; |
135 calculateOffsetAndLength(start, end, m_length, &offset, &length); | 135 calculateOffsetAndLength(start, end, m_length, &offset, &length); |
136 clampOffsetAndNumElements<T>(buffer(), m_byteOffset, &offset, &length); | 136 clampOffsetAndNumElements<T>(buffer(), m_byteOffset, &offset, &length); |
137 return create<Subclass>(buffer(), offset, length); | 137 return create<Subclass>(buffer(), offset, length); |
138 } | 138 } |
139 | 139 |
140 virtual void neuter() | 140 virtual void neuter() OVERRIDE FINAL |
eseidel
2014/01/11 02:38:01
Very strange choice of method name.
| |
141 { | 141 { |
142 ArrayBufferView::neuter(); | 142 ArrayBufferView::neuter(); |
143 m_length = 0; | 143 m_length = 0; |
144 } | 144 } |
145 | 145 |
146 // We do not want to have to access this via a virtual function in subclasse s, | 146 // We do not want to have to access this via a virtual function in subclasse s, |
147 // which is why it is protected rather than private. | 147 // which is why it is protected rather than private. |
148 unsigned m_length; | 148 unsigned m_length; |
149 }; | 149 }; |
150 | 150 |
151 } // namespace WTF | 151 } // namespace WTF |
152 | 152 |
153 using WTF::TypedArrayBase; | 153 using WTF::TypedArrayBase; |
154 | 154 |
155 #endif // TypedArrayBase_h | 155 #endif // TypedArrayBase_h |
OLD | NEW |