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

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: Created 3 years, 10 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/MaybeShared.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 25 matching lines...) Expand all
69 size_t length() const { return m_length; } 70 size_t length() const { return m_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 m_sampleRate; } 74 float sampleRate() const { return m_sampleRate; }
74 75
75 // Channel data access 76 // Channel data access
76 unsigned numberOfChannels() const { return m_channels.size(); } 77 unsigned numberOfChannels() const { return m_channels.size(); }
77 DOMFloat32Array* getChannelData(unsigned channelIndex, ExceptionState&); 78 DOMFloat32Array* getChannelData(unsigned channelIndex, ExceptionState&);
78 DOMFloat32Array* getChannelData(unsigned channelIndex); 79 DOMFloat32Array* getChannelData(unsigned channelIndex);
79 void copyFromChannel(DOMFloat32Array*, long channelNumber, ExceptionState&); 80 void copyFromChannel(const MaybeShared<DOMFloat32Array>&,
80 void copyFromChannel(DOMFloat32Array*, 81 long channelNumber,
82 ExceptionState&);
83 void copyFromChannel(const MaybeShared<DOMFloat32Array>&,
81 long channelNumber, 84 long channelNumber,
82 unsigned long startInChannel, 85 unsigned long startInChannel,
83 ExceptionState&); 86 ExceptionState&);
84 void copyToChannel(DOMFloat32Array*, long channelNumber, ExceptionState&); 87 void copyToChannel(const MaybeShared<DOMFloat32Array>&,
85 void copyToChannel(DOMFloat32Array*, 88 long channelNumber,
89 ExceptionState&);
90 void copyToChannel(const MaybeShared<DOMFloat32Array>&,
86 long channelNumber, 91 long channelNumber,
87 unsigned long startInChannel, 92 unsigned long startInChannel,
88 ExceptionState&); 93 ExceptionState&);
89 94
90 void zero(); 95 void zero();
91 96
92 DEFINE_INLINE_TRACE() { visitor->trace(m_channels); } 97 DEFINE_INLINE_TRACE() { visitor->trace(m_channels); }
93 98
94 private: 99 private:
95 explicit AudioBuffer(AudioBus*); 100 explicit AudioBuffer(AudioBus*);
96 101
97 static DOMFloat32Array* createFloat32ArrayOrNull(size_t length); 102 static DOMFloat32Array* createFloat32ArrayOrNull(size_t length);
98 103
99 AudioBuffer(unsigned numberOfChannels, 104 AudioBuffer(unsigned numberOfChannels,
100 size_t numberOfFrames, 105 size_t numberOfFrames,
101 float sampleRate); 106 float sampleRate);
102 bool createdSuccessfully(unsigned desiredNumberOfChannels) const; 107 bool createdSuccessfully(unsigned desiredNumberOfChannels) const;
103 108
104 float m_sampleRate; 109 float m_sampleRate;
105 size_t m_length; 110 size_t m_length;
106 111
107 HeapVector<Member<DOMFloat32Array>> m_channels; 112 HeapVector<Member<DOMFloat32Array>> m_channels;
108 }; 113 };
109 114
110 } // namespace blink 115 } // namespace blink
111 116
112 #endif // AudioBuffer_h 117 #endif // AudioBuffer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698