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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioBuffer.h

Issue 2812833003: Revert of [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: Created 3 years, 8 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
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
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 13 matching lines...) Expand all
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #ifndef AudioBuffer_h 29 #ifndef AudioBuffer_h
30 #define AudioBuffer_h 30 #define AudioBuffer_h
31 31
32 #include "bindings/core/v8/ScriptWrappable.h" 32 #include "bindings/core/v8/ScriptWrappable.h"
33 #include "core/dom/DOMTypedArray.h" 33 #include "core/dom/DOMTypedArray.h"
34 #include "core/dom/NotShared.h"
35 #include "modules/ModulesExport.h" 34 #include "modules/ModulesExport.h"
36 #include "wtf/PassRefPtr.h" 35 #include "wtf/PassRefPtr.h"
37 #include "wtf/RefPtr.h" 36 #include "wtf/RefPtr.h"
38 #include "wtf/Vector.h" 37 #include "wtf/Vector.h"
39 #include "wtf/build_config.h" 38 #include "wtf/build_config.h"
40 39
41 namespace blink { 40 namespace blink {
42 41
43 class AudioBus; 42 class AudioBus;
44 class AudioBufferOptions; 43 class AudioBufferOptions;
(...skipping 23 matching lines...) Expand all
68 67
69 // Format 68 // Format
70 size_t length() const { return length_; } 69 size_t length() const { return length_; }
71 double duration() const { 70 double duration() const {
72 return length() / static_cast<double>(sampleRate()); 71 return length() / static_cast<double>(sampleRate());
73 } 72 }
74 float sampleRate() const { return sample_rate_; } 73 float sampleRate() const { return sample_rate_; }
75 74
76 // Channel data access 75 // Channel data access
77 unsigned numberOfChannels() const { return channels_.size(); } 76 unsigned numberOfChannels() const { return channels_.size(); }
78 NotShared<DOMFloat32Array> getChannelData(unsigned channel_index, 77 DOMFloat32Array* getChannelData(unsigned channel_index, ExceptionState&);
79 ExceptionState&); 78 DOMFloat32Array* getChannelData(unsigned channel_index);
80 NotShared<DOMFloat32Array> getChannelData(unsigned channel_index); 79 void copyFromChannel(DOMFloat32Array*, long channel_number, ExceptionState&);
81 void copyFromChannel(NotShared<DOMFloat32Array>, 80 void copyFromChannel(DOMFloat32Array*,
82 long channel_number,
83 ExceptionState&);
84 void copyFromChannel(NotShared<DOMFloat32Array>,
85 long channel_number, 81 long channel_number,
86 unsigned long start_in_channel, 82 unsigned long start_in_channel,
87 ExceptionState&); 83 ExceptionState&);
88 void copyToChannel(NotShared<DOMFloat32Array>, 84 void copyToChannel(DOMFloat32Array*, long channel_number, ExceptionState&);
89 long channel_number, 85 void copyToChannel(DOMFloat32Array*,
90 ExceptionState&);
91 void copyToChannel(NotShared<DOMFloat32Array>,
92 long channel_number, 86 long channel_number,
93 unsigned long start_in_channel, 87 unsigned long start_in_channel,
94 ExceptionState&); 88 ExceptionState&);
95 89
96 void Zero(); 90 void Zero();
97 91
98 DEFINE_INLINE_TRACE() { visitor->Trace(channels_); } 92 DEFINE_INLINE_TRACE() { visitor->Trace(channels_); }
99 93
100 private: 94 private:
101 explicit AudioBuffer(AudioBus*); 95 explicit AudioBuffer(AudioBus*);
102 96
103 static DOMFloat32Array* CreateFloat32ArrayOrNull(size_t length); 97 static DOMFloat32Array* CreateFloat32ArrayOrNull(size_t length);
104 98
105 AudioBuffer(unsigned number_of_channels, 99 AudioBuffer(unsigned number_of_channels,
106 size_t number_of_frames, 100 size_t number_of_frames,
107 float sample_rate); 101 float sample_rate);
108 bool CreatedSuccessfully(unsigned desired_number_of_channels) const; 102 bool CreatedSuccessfully(unsigned desired_number_of_channels) const;
109 103
110 float sample_rate_; 104 float sample_rate_;
111 size_t length_; 105 size_t length_;
112 106
113 HeapVector<Member<DOMFloat32Array>> channels_; 107 HeapVector<Member<DOMFloat32Array>> channels_;
114 }; 108 };
115 109
116 } // namespace blink 110 } // namespace blink
117 111
118 #endif // AudioBuffer_h 112 #endif // AudioBuffer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698