| Index: third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp
|
| diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp b/third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp
|
| index 294a59f0536253049358697418b8dfca28c54bce..1b9a5ccc920b5e9a259c27232f56518b773cc621 100644
|
| --- a/third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp
|
| +++ b/third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp
|
| @@ -183,33 +183,34 @@ AudioBuffer::AudioBuffer(AudioBus* bus)
|
| }
|
| }
|
|
|
| -DOMFloat32Array* AudioBuffer::getChannelData(unsigned channelIndex,
|
| - ExceptionState& exceptionState) {
|
| +NotShared<DOMFloat32Array> AudioBuffer::getChannelData(
|
| + unsigned channelIndex,
|
| + ExceptionState& exceptionState) {
|
| if (channelIndex >= m_channels.size()) {
|
| exceptionState.throwDOMException(
|
| IndexSizeError, "channel index (" + String::number(channelIndex) +
|
| ") exceeds number of channels (" +
|
| String::number(m_channels.size()) + ")");
|
| - return nullptr;
|
| + return NotShared<DOMFloat32Array>(nullptr);
|
| }
|
|
|
| return getChannelData(channelIndex);
|
| }
|
|
|
| -DOMFloat32Array* AudioBuffer::getChannelData(unsigned channelIndex) {
|
| +NotShared<DOMFloat32Array> AudioBuffer::getChannelData(unsigned channelIndex) {
|
| if (channelIndex >= m_channels.size())
|
| - return nullptr;
|
| + return NotShared<DOMFloat32Array>(nullptr);
|
|
|
| - return m_channels[channelIndex].get();
|
| + return NotShared<DOMFloat32Array>(m_channels[channelIndex].get());
|
| }
|
|
|
| -void AudioBuffer::copyFromChannel(DOMFloat32Array* destination,
|
| +void AudioBuffer::copyFromChannel(NotShared<DOMFloat32Array> destination,
|
| long channelNumber,
|
| ExceptionState& exceptionState) {
|
| return copyFromChannel(destination, channelNumber, 0, exceptionState);
|
| }
|
|
|
| -void AudioBuffer::copyFromChannel(DOMFloat32Array* destination,
|
| +void AudioBuffer::copyFromChannel(NotShared<DOMFloat32Array> destination,
|
| long channelNumber,
|
| unsigned long startInChannel,
|
| ExceptionState& exceptionState) {
|
| @@ -238,10 +239,10 @@ void AudioBuffer::copyFromChannel(DOMFloat32Array* destination,
|
| }
|
|
|
| unsigned count = channelData->length() - startInChannel;
|
| - count = std::min(destination->length(), count);
|
| + count = std::min(destination.view()->length(), count);
|
|
|
| const float* src = channelData->data();
|
| - float* dst = destination->data();
|
| + float* dst = destination.view()->data();
|
|
|
| DCHECK(src);
|
| DCHECK(dst);
|
| @@ -249,13 +250,13 @@ void AudioBuffer::copyFromChannel(DOMFloat32Array* destination,
|
| memcpy(dst, src + startInChannel, count * sizeof(*src));
|
| }
|
|
|
| -void AudioBuffer::copyToChannel(DOMFloat32Array* source,
|
| +void AudioBuffer::copyToChannel(NotShared<DOMFloat32Array> source,
|
| long channelNumber,
|
| ExceptionState& exceptionState) {
|
| return copyToChannel(source, channelNumber, 0, exceptionState);
|
| }
|
|
|
| -void AudioBuffer::copyToChannel(DOMFloat32Array* source,
|
| +void AudioBuffer::copyToChannel(NotShared<DOMFloat32Array> source,
|
| long channelNumber,
|
| unsigned long startInChannel,
|
| ExceptionState& exceptionState) {
|
| @@ -284,9 +285,9 @@ void AudioBuffer::copyToChannel(DOMFloat32Array* source,
|
| }
|
|
|
| unsigned count = channelData->length() - startInChannel;
|
| - count = std::min(source->length(), count);
|
| + count = std::min(source.view()->length(), count);
|
|
|
| - const float* src = source->data();
|
| + const float* src = source.view()->data();
|
| float* dst = channelData->data();
|
|
|
| DCHECK(src);
|
| @@ -297,8 +298,8 @@ void AudioBuffer::copyToChannel(DOMFloat32Array* source,
|
|
|
| void AudioBuffer::zero() {
|
| for (unsigned i = 0; i < m_channels.size(); ++i) {
|
| - if (DOMFloat32Array* array = getChannelData(i)) {
|
| - float* data = array->data();
|
| + if (NotShared<DOMFloat32Array> array = getChannelData(i)) {
|
| + float* data = array.view()->data();
|
| memset(data, 0, length() * sizeof(*data));
|
| }
|
| }
|
|
|