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

Side by Side Diff: Source/core/dom/TypedFlexibleArrayBufferView.h

Issue 1269443002: Introduce FlexibleArrayBufferView and TypedFlexibleArrayBufferView (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed comments Created 5 years, 4 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef TypedFlexibleArrayBufferView_h
6 #define TypedFlexibleArrayBufferView_h
7
8 #include "core/CoreExport.h"
9 #include "core/dom/FlexibleArrayBufferView.h"
10 #include "wtf/Noncopyable.h"
11
12 namespace blink {
13
14 template<typename WTFTypedArray>
15 class CORE_TEMPLATE_CLASS_EXPORT TypedFlexibleArrayBufferView final : public Fle xibleArrayBufferView {
16 STACK_ALLOCATED();
17 WTF_MAKE_NONCOPYABLE(TypedFlexibleArrayBufferView);
18 public:
19 using ValueType = typename WTFTypedArray::ValueType;
20
21 TypedFlexibleArrayBufferView() : FlexibleArrayBufferView() {}
22
23 ValueType* dataMaybeOnStack() const { return static_cast<ValueType*>(baseAdd ressMaybeOnStack()); }
24 unsigned length() const { return byteLength() / sizeof(ValueType); }
haraken 2015/07/30 20:34:44 Shall we add: ASSERT(byteLength() % sizeof(Valu
Michael Lippautz 2015/07/31 07:53:38 Good idea, done.
25 };
26
27 using FlexibleInt32ArrayView = TypedFlexibleArrayBufferView<WTF::Int32Array>;
28 using FlexibleFloat32ArrayView = TypedFlexibleArrayBufferView<WTF::Float32Array> ;
29
30 } // namespace blink
31
32 #endif // TypedFlexibleArrayBufferView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698