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

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: 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 DISALLOW_ALLOCATION();
17 WTF_MAKE_NONCOPYABLE(TypedFlexibleArrayBufferView);
haraken 2015/07/30 14:54:57 Add WTF_MAKE_FAST_ALLOCATED.
Michael Lippautz 2015/07/30 17:06:15 STACK_ALLOCATED() (?)
18 public:
19 typedef typename WTFTypedArray::ValueType ValueType;
haraken 2015/07/30 14:54:57 Use 'using'.
Michael Lippautz 2015/07/30 17:06:15 Done.
20
21 TypedFlexibleArrayBufferView() : FlexibleArrayBufferView() {}
22
23 ValueType* data() const { return static_cast<ValueType*>(baseAddress()); }
haraken 2015/07/30 14:54:57 I'd rename this to dataMaybeOnStack() or something
Michael Lippautz 2015/07/30 17:06:15 Done.
24 unsigned length() const { return byteLength() / sizeof(ValueType); }
25 };
26
27 typedef TypedFlexibleArrayBufferView<WTF::Float32Array> FlexibleFloat32ArrayView ;
28 typedef TypedFlexibleArrayBufferView<WTF::Int32Array> FlexibleInt32ArrayView;
haraken 2015/07/30 14:54:57 Blink prefers 'using' in the new coding style.
Michael Lippautz 2015/07/30 17:06:15 Done.
29
30 } // namespace blink
31
32 #endif // TypedFlexibleArrayBufferView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698