OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DOMTypedArray_h | 5 #ifndef DOMTypedArray_h |
6 #define DOMTypedArray_h | 6 #define DOMTypedArray_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/dom/DOMArrayBufferView.h" | 9 #include "core/dom/DOMArrayBufferView.h" |
10 #include "core/dom/DOMSharedArrayBuffer.h" | 10 #include "core/dom/DOMSharedArrayBuffer.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 unsigned byte_offset, | 44 unsigned byte_offset, |
45 unsigned length) { | 45 unsigned length) { |
46 return Create( | 46 return Create( |
47 WTFTypedArray::Create(std::move(buffer), byte_offset, length)); | 47 WTFTypedArray::Create(std::move(buffer), byte_offset, length)); |
48 } | 48 } |
49 static ThisType* Create(DOMArrayBufferBase* buffer, | 49 static ThisType* Create(DOMArrayBufferBase* buffer, |
50 unsigned byte_offset, | 50 unsigned byte_offset, |
51 unsigned length) { | 51 unsigned length) { |
52 RefPtr<WTFTypedArray> buffer_view = | 52 RefPtr<WTFTypedArray> buffer_view = |
53 WTFTypedArray::Create(buffer->Buffer(), byte_offset, length); | 53 WTFTypedArray::Create(buffer->Buffer(), byte_offset, length); |
54 return new ThisType(buffer_view.Release(), buffer); | 54 return new ThisType(std::move(buffer_view), buffer); |
55 } | 55 } |
56 | 56 |
57 static ThisType* CreateOrNull(unsigned length) { | 57 static ThisType* CreateOrNull(unsigned length) { |
58 RefPtr<WTF::ArrayBuffer> buffer = | 58 RefPtr<WTF::ArrayBuffer> buffer = |
59 WTF::ArrayBuffer::CreateOrNull(length, sizeof(ValueType)); | 59 WTF::ArrayBuffer::CreateOrNull(length, sizeof(ValueType)); |
60 return buffer ? Create(buffer.Release(), 0, length) : nullptr; | 60 return buffer ? Create(std::move(buffer), 0, length) : nullptr; |
61 } | 61 } |
62 | 62 |
63 const WTFTypedArray* View() const { | 63 const WTFTypedArray* View() const { |
64 return static_cast<const WTFTypedArray*>(DOMArrayBufferView::View()); | 64 return static_cast<const WTFTypedArray*>(DOMArrayBufferView::View()); |
65 } | 65 } |
66 WTFTypedArray* View() { | 66 WTFTypedArray* View() { |
67 return static_cast<WTFTypedArray*>(DOMArrayBufferView::View()); | 67 return static_cast<WTFTypedArray*>(DOMArrayBufferView::View()); |
68 } | 68 } |
69 | 69 |
70 ValueType* Data() const { return View()->Data(); } | 70 ValueType* Data() const { return View()->Data(); } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 typedef DOMTypedArray<WTF::Uint8ClampedArray, v8::Uint8ClampedArray> | 111 typedef DOMTypedArray<WTF::Uint8ClampedArray, v8::Uint8ClampedArray> |
112 DOMUint8ClampedArray; | 112 DOMUint8ClampedArray; |
113 typedef DOMTypedArray<WTF::Uint16Array, v8::Uint16Array> DOMUint16Array; | 113 typedef DOMTypedArray<WTF::Uint16Array, v8::Uint16Array> DOMUint16Array; |
114 typedef DOMTypedArray<WTF::Uint32Array, v8::Uint32Array> DOMUint32Array; | 114 typedef DOMTypedArray<WTF::Uint32Array, v8::Uint32Array> DOMUint32Array; |
115 typedef DOMTypedArray<WTF::Float32Array, v8::Float32Array> DOMFloat32Array; | 115 typedef DOMTypedArray<WTF::Float32Array, v8::Float32Array> DOMFloat32Array; |
116 typedef DOMTypedArray<WTF::Float64Array, v8::Float64Array> DOMFloat64Array; | 116 typedef DOMTypedArray<WTF::Float64Array, v8::Float64Array> DOMFloat64Array; |
117 | 117 |
118 } // namespace blink | 118 } // namespace blink |
119 | 119 |
120 #endif // DOMTypedArray_h | 120 #endif // DOMTypedArray_h |
OLD | NEW |