| 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 08f092de9f3d6be5fc55631ca511135c53a0e1cb..71be1f1bf431239bb11971382e357c8037ee38d9 100644
|
| --- a/third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp
|
| +++ b/third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp
|
| @@ -185,33 +185,34 @@ AudioBuffer::AudioBuffer(AudioBus* bus)
|
| }
|
| }
|
|
|
| -DOMFloat32Array* AudioBuffer::getChannelData(unsigned channel_index,
|
| - ExceptionState& exception_state) {
|
| +NotShared<DOMFloat32Array> AudioBuffer::getChannelData(
|
| + unsigned channel_index,
|
| + ExceptionState& exception_state) {
|
| if (channel_index >= channels_.size()) {
|
| exception_state.ThrowDOMException(
|
| kIndexSizeError, "channel index (" + String::Number(channel_index) +
|
| ") exceeds number of channels (" +
|
| String::Number(channels_.size()) + ")");
|
| - return nullptr;
|
| + return NotShared<DOMFloat32Array>(nullptr);
|
| }
|
|
|
| return getChannelData(channel_index);
|
| }
|
|
|
| -DOMFloat32Array* AudioBuffer::getChannelData(unsigned channel_index) {
|
| +NotShared<DOMFloat32Array> AudioBuffer::getChannelData(unsigned channel_index) {
|
| if (channel_index >= channels_.size())
|
| - return nullptr;
|
| + return NotShared<DOMFloat32Array>(nullptr);
|
|
|
| - return channels_[channel_index].Get();
|
| + return NotShared<DOMFloat32Array>(channels_[channel_index].Get());
|
| }
|
|
|
| -void AudioBuffer::copyFromChannel(DOMFloat32Array* destination,
|
| +void AudioBuffer::copyFromChannel(NotShared<DOMFloat32Array> destination,
|
| long channel_number,
|
| ExceptionState& exception_state) {
|
| return copyFromChannel(destination, channel_number, 0, exception_state);
|
| }
|
|
|
| -void AudioBuffer::copyFromChannel(DOMFloat32Array* destination,
|
| +void AudioBuffer::copyFromChannel(NotShared<DOMFloat32Array> destination,
|
| long channel_number,
|
| unsigned long start_in_channel,
|
| ExceptionState& exception_state) {
|
| @@ -223,6 +224,7 @@ void AudioBuffer::copyFromChannel(DOMFloat32Array* destination,
|
| ExceptionMessages::kInclusiveBound,
|
| static_cast<long>(channels_.size() - 1),
|
| ExceptionMessages::kInclusiveBound));
|
| +
|
| return;
|
| }
|
|
|
| @@ -240,10 +242,10 @@ void AudioBuffer::copyFromChannel(DOMFloat32Array* destination,
|
| }
|
|
|
| unsigned count = channel_data->length() - start_in_channel;
|
| - count = std::min(destination->length(), count);
|
| + count = std::min(destination.View()->length(), count);
|
|
|
| const float* src = channel_data->Data();
|
| - float* dst = destination->Data();
|
| + float* dst = destination.View()->Data();
|
|
|
| DCHECK(src);
|
| DCHECK(dst);
|
| @@ -251,13 +253,13 @@ void AudioBuffer::copyFromChannel(DOMFloat32Array* destination,
|
| memcpy(dst, src + start_in_channel, count * sizeof(*src));
|
| }
|
|
|
| -void AudioBuffer::copyToChannel(DOMFloat32Array* source,
|
| +void AudioBuffer::copyToChannel(NotShared<DOMFloat32Array> source,
|
| long channel_number,
|
| ExceptionState& exception_state) {
|
| return copyToChannel(source, channel_number, 0, exception_state);
|
| }
|
|
|
| -void AudioBuffer::copyToChannel(DOMFloat32Array* source,
|
| +void AudioBuffer::copyToChannel(NotShared<DOMFloat32Array> source,
|
| long channel_number,
|
| unsigned long start_in_channel,
|
| ExceptionState& exception_state) {
|
| @@ -286,9 +288,9 @@ void AudioBuffer::copyToChannel(DOMFloat32Array* source,
|
| }
|
|
|
| unsigned count = channel_data->length() - start_in_channel;
|
| - 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 = channel_data->Data();
|
|
|
| DCHECK(src);
|
| @@ -299,8 +301,8 @@ void AudioBuffer::copyToChannel(DOMFloat32Array* source,
|
|
|
| void AudioBuffer::Zero() {
|
| for (unsigned i = 0; i < 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));
|
| }
|
| }
|
|
|