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

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

Issue 2103043007: Rename AbstractAudioContext to BaseAudioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use ASSERT(isGraphOwner()) instead of DCHECK Created 4 years, 5 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 #include "modules/webaudio/AudioBuffer.h" 29 #include "modules/webaudio/AudioBuffer.h"
30 30
31 #include "bindings/core/v8/ExceptionMessages.h" 31 #include "bindings/core/v8/ExceptionMessages.h"
32 #include "bindings/core/v8/ExceptionState.h" 32 #include "bindings/core/v8/ExceptionState.h"
33 #include "core/dom/ExceptionCode.h" 33 #include "core/dom/ExceptionCode.h"
34 #include "modules/webaudio/AbstractAudioContext.h" 34 #include "modules/webaudio/BaseAudioContext.h"
35 #include "platform/audio/AudioBus.h" 35 #include "platform/audio/AudioBus.h"
36 #include "platform/audio/AudioFileReader.h" 36 #include "platform/audio/AudioFileReader.h"
37 #include "platform/audio/AudioUtilities.h" 37 #include "platform/audio/AudioUtilities.h"
38 #include "wtf/typed_arrays/Float32Array.h" 38 #include "wtf/typed_arrays/Float32Array.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 AudioBuffer* AudioBuffer::create(unsigned numberOfChannels, size_t numberOfFrame s, float sampleRate) 42 AudioBuffer* AudioBuffer::create(unsigned numberOfChannels, size_t numberOfFrame s, float sampleRate)
43 { 43 {
44 if (!AudioUtilities::isValidAudioBufferSampleRate(sampleRate) || numberOfCha nnels > AbstractAudioContext::maxNumberOfChannels() || !numberOfChannels || !num berOfFrames) 44 if (!AudioUtilities::isValidAudioBufferSampleRate(sampleRate) || numberOfCha nnels > BaseAudioContext::maxNumberOfChannels() || !numberOfChannels || !numberO fFrames)
45 return nullptr; 45 return nullptr;
46 46
47 AudioBuffer* buffer = new AudioBuffer(numberOfChannels, numberOfFrames, samp leRate); 47 AudioBuffer* buffer = new AudioBuffer(numberOfChannels, numberOfFrames, samp leRate);
48 48
49 if (!buffer->createdSuccessfully(numberOfChannels)) 49 if (!buffer->createdSuccessfully(numberOfChannels))
50 return nullptr; 50 return nullptr;
51 return buffer; 51 return buffer;
52 } 52 }
53 53
54 AudioBuffer* AudioBuffer::create(unsigned numberOfChannels, size_t numberOfFrame s, float sampleRate, ExceptionState& exceptionState) 54 AudioBuffer* AudioBuffer::create(unsigned numberOfChannels, size_t numberOfFrame s, float sampleRate, ExceptionState& exceptionState)
55 { 55 {
56 if (!numberOfChannels || numberOfChannels > AbstractAudioContext::maxNumberO fChannels()) { 56 if (!numberOfChannels || numberOfChannels > BaseAudioContext::maxNumberOfCha nnels()) {
57 exceptionState.throwDOMException( 57 exceptionState.throwDOMException(
58 NotSupportedError, 58 NotSupportedError,
59 ExceptionMessages::indexOutsideRange( 59 ExceptionMessages::indexOutsideRange(
60 "number of channels", 60 "number of channels",
61 numberOfChannels, 61 numberOfChannels,
62 1u, 62 1u,
63 ExceptionMessages::InclusiveBound, 63 ExceptionMessages::InclusiveBound,
64 AbstractAudioContext::maxNumberOfChannels(), 64 BaseAudioContext::maxNumberOfChannels(),
65 ExceptionMessages::InclusiveBound)); 65 ExceptionMessages::InclusiveBound));
66 return nullptr; 66 return nullptr;
67 } 67 }
68 68
69 if (!AudioUtilities::isValidAudioBufferSampleRate(sampleRate)) { 69 if (!AudioUtilities::isValidAudioBufferSampleRate(sampleRate)) {
70 exceptionState.throwDOMException( 70 exceptionState.throwDOMException(
71 NotSupportedError, 71 NotSupportedError,
72 ExceptionMessages::indexOutsideRange( 72 ExceptionMessages::indexOutsideRange(
73 "sample rate", 73 "sample rate",
74 sampleRate, 74 sampleRate,
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 for (unsigned i = 0; i < m_channels.size(); ++i) { 298 for (unsigned i = 0; i < m_channels.size(); ++i) {
299 if (DOMFloat32Array* array = getChannelData(i)) { 299 if (DOMFloat32Array* array = getChannelData(i)) {
300 float* data = array->data(); 300 float* data = array->data();
301 memset(data, 0, length() * sizeof(*data)); 301 memset(data, 0, length() * sizeof(*data));
302 } 302 }
303 } 303 }
304 } 304 }
305 305
306 } // namespace blink 306 } // namespace blink
307 307
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698