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

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

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: update comment, add TODO 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"
34 #include "modules/ModulesExport.h" 35 #include "modules/ModulesExport.h"
35 #include "wtf/PassRefPtr.h" 36 #include "wtf/PassRefPtr.h"
36 #include "wtf/RefPtr.h" 37 #include "wtf/RefPtr.h"
37 #include "wtf/Vector.h" 38 #include "wtf/Vector.h"
38 #include "wtf/build_config.h" 39 #include "wtf/build_config.h"
39 40
40 namespace blink { 41 namespace blink {
41 42
42 class AudioBus; 43 class AudioBus;
43 class AudioBufferOptions; 44 class AudioBufferOptions;
(...skipping 23 matching lines...) Expand all
67 68
68 // Format 69 // Format
69 size_t length() const { return length_; } 70 size_t length() const { return length_; }
70 double duration() const { 71 double duration() const {
71 return length() / static_cast<double>(sampleRate()); 72 return length() / static_cast<double>(sampleRate());
72 } 73 }
73 float sampleRate() const { return sample_rate_; } 74 float sampleRate() const { return sample_rate_; }
74 75
75 // Channel data access 76 // Channel data access
76 unsigned numberOfChannels() const { return channels_.size(); } 77 unsigned numberOfChannels() const { return channels_.size(); }
77 DOMFloat32Array* getChannelData(unsigned channel_index, ExceptionState&); 78 NotShared<DOMFloat32Array> getChannelData(unsigned channel_index,
78 DOMFloat32Array* getChannelData(unsigned channel_index); 79 ExceptionState&);
79 void copyFromChannel(DOMFloat32Array*, long channel_number, ExceptionState&); 80 NotShared<DOMFloat32Array> getChannelData(unsigned channel_index);
80 void copyFromChannel(DOMFloat32Array*, 81 void copyFromChannel(NotShared<DOMFloat32Array>,
82 long channel_number,
83 ExceptionState&);
84 void copyFromChannel(NotShared<DOMFloat32Array>,
81 long channel_number, 85 long channel_number,
82 unsigned long start_in_channel, 86 unsigned long start_in_channel,
83 ExceptionState&); 87 ExceptionState&);
84 void copyToChannel(DOMFloat32Array*, long channel_number, ExceptionState&); 88 void copyToChannel(NotShared<DOMFloat32Array>,
85 void copyToChannel(DOMFloat32Array*, 89 long channel_number,
90 ExceptionState&);
91 void copyToChannel(NotShared<DOMFloat32Array>,
86 long channel_number, 92 long channel_number,
87 unsigned long start_in_channel, 93 unsigned long start_in_channel,
88 ExceptionState&); 94 ExceptionState&);
89 95
90 void Zero(); 96 void Zero();
91 97
92 DEFINE_INLINE_TRACE() { visitor->Trace(channels_); } 98 DEFINE_INLINE_TRACE() { visitor->Trace(channels_); }
93 99
94 private: 100 private:
95 explicit AudioBuffer(AudioBus*); 101 explicit AudioBuffer(AudioBus*);
96 102
97 static DOMFloat32Array* CreateFloat32ArrayOrNull(size_t length); 103 static DOMFloat32Array* CreateFloat32ArrayOrNull(size_t length);
98 104
99 AudioBuffer(unsigned number_of_channels, 105 AudioBuffer(unsigned number_of_channels,
100 size_t number_of_frames, 106 size_t number_of_frames,
101 float sample_rate); 107 float sample_rate);
102 bool CreatedSuccessfully(unsigned desired_number_of_channels) const; 108 bool CreatedSuccessfully(unsigned desired_number_of_channels) const;
103 109
104 float sample_rate_; 110 float sample_rate_;
105 size_t length_; 111 size_t length_;
106 112
107 HeapVector<Member<DOMFloat32Array>> channels_; 113 HeapVector<Member<DOMFloat32Array>> channels_;
108 }; 114 };
109 115
110 } // namespace blink 116 } // namespace blink
111 117
112 #endif // AudioBuffer_h 118 #endif // AudioBuffer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698