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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 void addView(ArrayBufferView*); | 59 void addView(ArrayBufferView*); |
60 void removeView(ArrayBufferView*); | 60 void removeView(ArrayBufferView*); |
61 | 61 |
62 bool transfer(ArrayBufferContents&); | 62 bool transfer(ArrayBufferContents&); |
63 bool isNeutered() { return m_isNeutered; } | 63 bool isNeutered() { return m_isNeutered; } |
64 | 64 |
65 void setDeallocationObserver(ArrayBufferDeallocationObserver* observer) { m_
contents.setDeallocationObserver(observer); } | 65 void setDeallocationObserver(ArrayBufferDeallocationObserver* observer) { m_
contents.setDeallocationObserver(observer); } |
66 | 66 |
67 ~ArrayBuffer() { } | 67 ~ArrayBuffer() { } |
68 | 68 |
| 69 protected: |
| 70 inline explicit ArrayBuffer(ArrayBufferContents&); |
| 71 |
69 private: | 72 private: |
70 static inline PassRefPtr<ArrayBuffer> create(unsigned numElements, unsigned
elementByteSize, ArrayBufferContents::InitializationPolicy); | 73 static inline PassRefPtr<ArrayBuffer> create(unsigned numElements, unsigned
elementByteSize, ArrayBufferContents::InitializationPolicy); |
71 | 74 |
72 inline ArrayBuffer(ArrayBufferContents&); | |
73 inline PassRefPtr<ArrayBuffer> sliceImpl(unsigned begin, unsigned end) const
; | 75 inline PassRefPtr<ArrayBuffer> sliceImpl(unsigned begin, unsigned end) const
; |
74 inline unsigned clampIndex(int index) const; | 76 inline unsigned clampIndex(int index) const; |
75 static inline int clampValue(int x, int left, int right); | 77 static inline int clampValue(int x, int left, int right); |
76 | 78 |
77 ArrayBufferContents m_contents; | 79 ArrayBufferContents m_contents; |
78 ArrayBufferView* m_firstView; | 80 ArrayBufferView* m_firstView; |
79 bool m_isNeutered; | 81 bool m_isNeutered; |
80 }; | 82 }; |
81 | 83 |
82 int ArrayBuffer::clampValue(int x, int left, int right) | 84 int ArrayBuffer::clampValue(int x, int left, int right) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 if (index < 0) | 172 if (index < 0) |
171 index = currentLength + index; | 173 index = currentLength + index; |
172 return clampValue(index, 0, currentLength); | 174 return clampValue(index, 0, currentLength); |
173 } | 175 } |
174 | 176 |
175 } // namespace WTF | 177 } // namespace WTF |
176 | 178 |
177 using WTF::ArrayBuffer; | 179 using WTF::ArrayBuffer; |
178 | 180 |
179 #endif // ArrayBuffer_h | 181 #endif // ArrayBuffer_h |
OLD | NEW |