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

Unified Diff: third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp

Issue 1878463002: Move DOMArrayBuffer, DOMArrayBufferViews and DataView to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tidy Created 4 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 side-by-side diff with in-line comments
Download patch
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 be4f480e8222ba06ca4ec9ebb1a4df839c9072a6..03c17f4ae1e05add492db138c2f3513f0e6fa186 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp
@@ -130,7 +130,7 @@ bool AudioBuffer::createdSuccessfully(unsigned desiredNumberOfChannels) const
return numberOfChannels() == desiredNumberOfChannels;
}
-PassRefPtr<DOMFloat32Array> AudioBuffer::createFloat32ArrayOrNull(size_t length)
+DOMFloat32Array* AudioBuffer::createFloat32ArrayOrNull(size_t length)
{
RefPtr<WTF::Float32Array> bufferView = WTF::Float32Array::createOrNull(length);
if (!bufferView)
@@ -145,12 +145,11 @@ AudioBuffer::AudioBuffer(unsigned numberOfChannels, size_t numberOfFrames, float
m_channels.reserveCapacity(numberOfChannels);
for (unsigned i = 0; i < numberOfChannels; ++i) {
- RefPtr<DOMFloat32Array> channelDataArray = createFloat32ArrayOrNull(m_length);
+ DOMFloat32Array* channelDataArray = createFloat32ArrayOrNull(m_length);
// If the channel data array could not be created, just return. The caller will need to
// check that the desired number of channels were created.
- if (!channelDataArray) {
+ if (!channelDataArray)
return;
- }
channelDataArray->setNeuterable(false);
m_channels.append(channelDataArray);
@@ -165,7 +164,7 @@ AudioBuffer::AudioBuffer(AudioBus* bus)
unsigned numberOfChannels = bus->numberOfChannels();
m_channels.reserveCapacity(numberOfChannels);
for (unsigned i = 0; i < numberOfChannels; ++i) {
- RefPtr<DOMFloat32Array> channelDataArray = createFloat32ArrayOrNull(m_length);
+ DOMFloat32Array* channelDataArray = createFloat32ArrayOrNull(m_length);
// If the channel data array could not be created, just return. The caller will need to
// check that the desired number of channels were created.
if (!channelDataArray)
@@ -179,7 +178,7 @@ AudioBuffer::AudioBuffer(AudioBus* bus)
}
}
-PassRefPtr<DOMFloat32Array> AudioBuffer::getChannelData(unsigned channelIndex, ExceptionState& exceptionState)
+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()) + ")");

Powered by Google App Engine
This is Rietveld 408576698