Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2576)

Unified Diff: Source/wtf/ArrayBufferView.h

Issue 1180713004: Remove unused code from WTF TypedArrays (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/wtf/ArrayBuffer.h ('k') | Source/wtf/Float32Array.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « Source/wtf/ArrayBuffer.h ('k') | Source/wtf/Float32Array.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698