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

Side by Side Diff: Source/wtf/Float32Array.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/wtf/ArrayBufferView.h ('k') | Source/wtf/Float64Array.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 22 matching lines...) Expand all
33 namespace WTF { 33 namespace WTF {
34 34
35 class Float32Array final : public TypedArrayBase<float> { 35 class Float32Array final : public TypedArrayBase<float> {
36 public: 36 public:
37 static inline PassRefPtr<Float32Array> create(unsigned length); 37 static inline PassRefPtr<Float32Array> create(unsigned length);
38 static inline PassRefPtr<Float32Array> create(const float* array, unsigned l ength); 38 static inline PassRefPtr<Float32Array> create(const float* array, unsigned l ength);
39 static inline PassRefPtr<Float32Array> create(PassRefPtr<ArrayBuffer>, unsig ned byteOffset, unsigned length); 39 static inline PassRefPtr<Float32Array> create(PassRefPtr<ArrayBuffer>, unsig ned byteOffset, unsigned length);
40 40
41 static inline PassRefPtr<Float32Array> createOrNull(unsigned length); 41 static inline PassRefPtr<Float32Array> createOrNull(unsigned length);
42 42
43 // Should only be used when it is known the entire array will be filled. Do
44 // not return these results directly to JavaScript without filling first.
45 static inline PassRefPtr<Float32Array> createUninitialized(unsigned length);
46
47 using TypedArrayBase<float>::set; 43 using TypedArrayBase<float>::set;
48 44
49 void set(unsigned index, double value) 45 void set(unsigned index, double value)
50 { 46 {
51 if (index >= TypedArrayBase<float>::m_length) 47 if (index >= TypedArrayBase<float>::m_length)
52 return; 48 return;
53 TypedArrayBase<float>::data()[index] = static_cast<float>(value); 49 TypedArrayBase<float>::data()[index] = static_cast<float>(value);
54 } 50 }
55 51
56 inline PassRefPtr<Float32Array> subarray(int start) const;
57 inline PassRefPtr<Float32Array> subarray(int start, int end) const;
58
59 virtual ViewType type() const override 52 virtual ViewType type() const override
60 { 53 {
61 return TypeFloat32; 54 return TypeFloat32;
62 } 55 }
63 56
64 private: 57 private:
65 inline Float32Array(PassRefPtr<ArrayBuffer>, 58 inline Float32Array(PassRefPtr<ArrayBuffer>,
66 unsigned byteOffset, 59 unsigned byteOffset,
67 unsigned length); 60 unsigned length);
68 // Make constructor visible to superclass. 61 // Make constructor visible to superclass.
(...skipping 13 matching lines...) Expand all
82 PassRefPtr<Float32Array> Float32Array::create(PassRefPtr<ArrayBuffer> buffer, un signed byteOffset, unsigned length) 75 PassRefPtr<Float32Array> Float32Array::create(PassRefPtr<ArrayBuffer> buffer, un signed byteOffset, unsigned length)
83 { 76 {
84 return TypedArrayBase<float>::create<Float32Array>(buffer, byteOffset, lengt h); 77 return TypedArrayBase<float>::create<Float32Array>(buffer, byteOffset, lengt h);
85 } 78 }
86 79
87 PassRefPtr<Float32Array> Float32Array::createOrNull(unsigned length) 80 PassRefPtr<Float32Array> Float32Array::createOrNull(unsigned length)
88 { 81 {
89 return TypedArrayBase<float>::createOrNull<Float32Array>(length); 82 return TypedArrayBase<float>::createOrNull<Float32Array>(length);
90 } 83 }
91 84
92 PassRefPtr<Float32Array> Float32Array::createUninitialized(unsigned length)
93 {
94 return TypedArrayBase<float>::createUninitialized<Float32Array>(length);
95 }
96
97 Float32Array::Float32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length) 85 Float32Array::Float32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
98 : TypedArrayBase<float>(buffer, byteOffset, length) 86 : TypedArrayBase<float>(buffer, byteOffset, length)
99 { 87 {
100 } 88 }
101 89
102 PassRefPtr<Float32Array> Float32Array::subarray(int start) const
103 {
104 return subarray(start, length());
105 }
106
107 PassRefPtr<Float32Array> Float32Array::subarray(int start, int end) const
108 {
109 return subarrayImpl<Float32Array>(start, end);
110 }
111
112 } // namespace WTF 90 } // namespace WTF
113 91
114 using WTF::Float32Array; 92 using WTF::Float32Array;
115 93
116 #endif // Float32Array_h 94 #endif // Float32Array_h
OLDNEW
« no previous file with comments | « Source/wtf/ArrayBufferView.h ('k') | Source/wtf/Float64Array.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698