| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 static inline PassRefPtr<ArrayBuffer> create(unsigned numElements, | 43 static inline PassRefPtr<ArrayBuffer> create(unsigned numElements, |
| 44 unsigned elementByteSize); | 44 unsigned elementByteSize); |
| 45 static inline PassRefPtr<ArrayBuffer> create(ArrayBuffer*); | 45 static inline PassRefPtr<ArrayBuffer> create(ArrayBuffer*); |
| 46 static inline PassRefPtr<ArrayBuffer> create(const void* source, | 46 static inline PassRefPtr<ArrayBuffer> create(const void* source, |
| 47 unsigned byteLength); | 47 unsigned byteLength); |
| 48 static inline PassRefPtr<ArrayBuffer> create(ArrayBufferContents&); | 48 static inline PassRefPtr<ArrayBuffer> create(ArrayBufferContents&); |
| 49 | 49 |
| 50 static inline PassRefPtr<ArrayBuffer> createOrNull(unsigned numElements, | 50 static inline PassRefPtr<ArrayBuffer> createOrNull(unsigned numElements, |
| 51 unsigned elementByteSize); | 51 unsigned elementByteSize); |
| 52 | 52 |
| 53 // Only for use by XMLHttpRequest::responseArrayBuffer and | 53 // Only for use by DOMArrayBuffer::createUninitializedOrNull(). |
| 54 // Internals::serializeObject (through DOMArrayBuffer::createUninitialized). | 54 static inline PassRefPtr<ArrayBuffer> createUninitializedOrNull( |
| 55 static inline PassRefPtr<ArrayBuffer> createUninitialized( | |
| 56 unsigned numElements, | 55 unsigned numElements, |
| 57 unsigned elementByteSize); | 56 unsigned elementByteSize); |
| 58 | 57 |
| 59 static inline PassRefPtr<ArrayBuffer> createShared(unsigned numElements, | 58 static inline PassRefPtr<ArrayBuffer> createShared(unsigned numElements, |
| 60 unsigned elementByteSize); | 59 unsigned elementByteSize); |
| 61 static inline PassRefPtr<ArrayBuffer> createShared(const void* source, | 60 static inline PassRefPtr<ArrayBuffer> createShared(const void* source, |
| 62 unsigned byteLength); | 61 unsigned byteLength); |
| 63 | 62 |
| 64 inline void* data(); | 63 inline void* data(); |
| 65 inline const void* data() const; | 64 inline const void* data() const; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 RELEASE_ASSERT(contents.dataMaybeShared()); | 146 RELEASE_ASSERT(contents.dataMaybeShared()); |
| 148 return adoptRef(new ArrayBuffer(contents)); | 147 return adoptRef(new ArrayBuffer(contents)); |
| 149 } | 148 } |
| 150 | 149 |
| 151 PassRefPtr<ArrayBuffer> ArrayBuffer::createOrNull(unsigned numElements, | 150 PassRefPtr<ArrayBuffer> ArrayBuffer::createOrNull(unsigned numElements, |
| 152 unsigned elementByteSize) { | 151 unsigned elementByteSize) { |
| 153 return createOrNull(numElements, elementByteSize, | 152 return createOrNull(numElements, elementByteSize, |
| 154 ArrayBufferContents::ZeroInitialize); | 153 ArrayBufferContents::ZeroInitialize); |
| 155 } | 154 } |
| 156 | 155 |
| 157 PassRefPtr<ArrayBuffer> ArrayBuffer::createUninitialized( | 156 PassRefPtr<ArrayBuffer> ArrayBuffer::createUninitializedOrNull( |
| 158 unsigned numElements, | 157 unsigned numElements, |
| 159 unsigned elementByteSize) { | 158 unsigned elementByteSize) { |
| 160 return create(numElements, elementByteSize, | 159 return createOrNull(numElements, elementByteSize, |
| 161 ArrayBufferContents::DontInitialize); | 160 ArrayBufferContents::DontInitialize); |
| 162 } | 161 } |
| 163 | 162 |
| 164 PassRefPtr<ArrayBuffer> ArrayBuffer::create( | 163 PassRefPtr<ArrayBuffer> ArrayBuffer::create( |
| 165 unsigned numElements, | 164 unsigned numElements, |
| 166 unsigned elementByteSize, | 165 unsigned elementByteSize, |
| 167 ArrayBufferContents::InitializationPolicy policy) { | 166 ArrayBufferContents::InitializationPolicy policy) { |
| 168 ArrayBufferContents contents(numElements, elementByteSize, | 167 ArrayBufferContents contents(numElements, elementByteSize, |
| 169 ArrayBufferContents::NotShared, policy); | 168 ArrayBufferContents::NotShared, policy); |
| 170 RELEASE_ASSERT(contents.data()); | 169 RELEASE_ASSERT(contents.data()); |
| 171 return adoptRef(new ArrayBuffer(contents)); | 170 return adoptRef(new ArrayBuffer(contents)); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 if (index < 0) | 262 if (index < 0) |
| 264 index = currentLength + index; | 263 index = currentLength + index; |
| 265 return clampValue(index, 0, currentLength); | 264 return clampValue(index, 0, currentLength); |
| 266 } | 265 } |
| 267 | 266 |
| 268 } // namespace WTF | 267 } // namespace WTF |
| 269 | 268 |
| 270 using WTF::ArrayBuffer; | 269 using WTF::ArrayBuffer; |
| 271 | 270 |
| 272 #endif // ArrayBuffer_h | 271 #endif // ArrayBuffer_h |
| OLD | NEW |