| Index: Source/wtf/ArrayBufferView.h
|
| diff --git a/Source/wtf/ArrayBufferView.h b/Source/wtf/ArrayBufferView.h
|
| index c6c5b0cf89687721def23f0f122a3f014b46a184..09125cc9adb21654438880f225cdd310490b2b22 100644
|
| --- a/Source/wtf/ArrayBufferView.h
|
| +++ b/Source/wtf/ArrayBufferView.h
|
| @@ -32,7 +32,6 @@
|
| #include "wtf/RefCounted.h"
|
| #include "wtf/RefPtr.h"
|
| #include "wtf/WTFExport.h"
|
| -#include <algorithm>
|
| #include <limits.h>
|
|
|
| namespace WTF {
|
| @@ -85,9 +84,6 @@ class WTF_EXPORT ArrayBufferView : public RefCounted<ArrayBufferView> {
|
|
|
| inline bool zeroRangeImpl(unsigned byteOffset, size_t rangeByteLength);
|
|
|
| - static inline void calculateOffsetAndLength(int start, int end, unsigned arraySize,
|
| - unsigned* offset, unsigned* length);
|
| -
|
| // Helper to verify that a given sub-range of an ArrayBuffer is
|
| // within range.
|
| template <typename T>
|
| @@ -107,26 +103,6 @@ class WTF_EXPORT ArrayBufferView : public RefCounted<ArrayBufferView> {
|
| return true;
|
| }
|
|
|
| - // Input offset is in number of elements from this array's view;
|
| - // output offset is in number of bytes from the underlying buffer's view.
|
| - template <typename T>
|
| - static void clampOffsetAndNumElements(PassRefPtr<ArrayBuffer> buffer,
|
| - unsigned arrayByteOffset,
|
| - unsigned *offset,
|
| - unsigned *numElements)
|
| - {
|
| - unsigned maxOffset = (UINT_MAX - arrayByteOffset) / sizeof(T);
|
| - if (*offset > maxOffset) {
|
| - *offset = buffer->byteLength();
|
| - *numElements = 0;
|
| - return;
|
| - }
|
| - *offset = arrayByteOffset + *offset * sizeof(T);
|
| - *offset = std::min(buffer->byteLength(), *offset);
|
| - unsigned remainingElements = (buffer->byteLength() - *offset) / sizeof(T);
|
| - *numElements = std::min(remainingElements, *numElements);
|
| - }
|
| -
|
| virtual void neuter();
|
|
|
| // This is the address of the ArrayBuffer's storage, plus the byte offset.
|
| @@ -184,25 +160,6 @@ bool ArrayBufferView::zeroRangeImpl(unsigned byteOffset, size_t rangeByteLength)
|
| return true;
|
| }
|
|
|
| -void ArrayBufferView::calculateOffsetAndLength(int start, int end, unsigned arraySize,
|
| - unsigned* offset, unsigned* length)
|
| -{
|
| - if (start < 0)
|
| - start += arraySize;
|
| - if (start < 0)
|
| - start = 0;
|
| - if (end < 0)
|
| - end += arraySize;
|
| - if (end < 0)
|
| - end = 0;
|
| - if (static_cast<unsigned>(end) > arraySize)
|
| - end = arraySize;
|
| - if (end < start)
|
| - end = start;
|
| - *offset = static_cast<unsigned>(start);
|
| - *length = static_cast<unsigned>(end - start);
|
| -}
|
| -
|
| } // namespace WTF
|
|
|
| using WTF::ArrayBufferView;
|
|
|