Commit 56c23bd4 authored by zandobersek@gmail.com's avatar zandobersek@gmail.com

Move WebAudio source code to std::unique_ptr

https://bugs.webkit.org/show_bug.cgi?id=127274

Reviewed by Eric Carlson.

Move from using OwnPtr and PassOwnPtr to using std::unique_ptr and move semantics
in the WebAudio module and the WebAudio code in the platform layer.

* Modules/webaudio/AsyncAudioDecoder.cpp:
* Modules/webaudio/AsyncAudioDecoder.h:
* Modules/webaudio/AudioBasicInspectorNode.cpp:
(WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode):
* Modules/webaudio/AudioBasicProcessorNode.cpp:
(WebCore::AudioBasicProcessorNode::AudioBasicProcessorNode):
* Modules/webaudio/AudioBasicProcessorNode.h:
* Modules/webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::AudioBufferSourceNode):
* Modules/webaudio/AudioContext.cpp:
* Modules/webaudio/AudioContext.h:
* Modules/webaudio/AudioDestinationNode.cpp:
(WebCore::AudioDestinationNode::AudioDestinationNode):
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::addInput):
(WebCore::AudioNode::addOutput):
(WebCore::AudioNode::checkNumberOfChannelsForInput):
* Modules/webaudio/AudioNode.h:
* Modules/webaudio/BiquadFilterNode.cpp:
(WebCore::BiquadFilterNode::BiquadFilterNode):
* Modules/webaudio/BiquadProcessor.cpp:
(WebCore::BiquadProcessor::createKernel):
(WebCore::BiquadProcessor::getFrequencyResponse):
* Modules/webaudio/BiquadProcessor.h:
* Modules/webaudio/ChannelMergerNode.cpp:
(WebCore::ChannelMergerNode::ChannelMergerNode):
* Modules/webaudio/ChannelSplitterNode.cpp:
(WebCore::ChannelSplitterNode::ChannelSplitterNode):
* Modules/webaudio/ConvolverNode.cpp:
(WebCore::ConvolverNode::ConvolverNode):
(WebCore::ConvolverNode::uninitialize):
(WebCore::ConvolverNode::setBuffer):
* Modules/webaudio/ConvolverNode.h:
* Modules/webaudio/DefaultAudioDestinationNode.h:
* Modules/webaudio/DelayNode.cpp:
(WebCore::DelayNode::DelayNode):
* Modules/webaudio/DelayProcessor.cpp:
(WebCore::DelayProcessor::createKernel):
* Modules/webaudio/DelayProcessor.h:
* Modules/webaudio/DynamicsCompressorNode.cpp:
(WebCore::DynamicsCompressorNode::DynamicsCompressorNode):
(WebCore::DynamicsCompressorNode::initialize):
(WebCore::DynamicsCompressorNode::uninitialize):
* Modules/webaudio/DynamicsCompressorNode.h:
* Modules/webaudio/GainNode.cpp:
(WebCore::GainNode::GainNode):
* Modules/webaudio/MediaElementAudioSourceNode.cpp:
(WebCore::MediaElementAudioSourceNode::MediaElementAudioSourceNode):
(WebCore::MediaElementAudioSourceNode::setFormat):
* Modules/webaudio/MediaElementAudioSourceNode.h:
* Modules/webaudio/MediaStreamAudioDestinationNode.h:
* Modules/webaudio/MediaStreamAudioSource.cpp:
* Modules/webaudio/MediaStreamAudioSourceNode.cpp:
(WebCore::MediaStreamAudioSourceNode::MediaStreamAudioSourceNode):
* Modules/webaudio/MediaStreamAudioSourceNode.h:
* Modules/webaudio/OscillatorNode.cpp:
(WebCore::OscillatorNode::OscillatorNode):
* Modules/webaudio/PannerNode.cpp:
(WebCore::PannerNode::PannerNode):
(WebCore::PannerNode::uninitialize):
(WebCore::PannerNode::setPanningModel):
* Modules/webaudio/PannerNode.h:
* Modules/webaudio/PeriodicWave.cpp:
(WebCore::PeriodicWave::createBandLimitedTables):
* Modules/webaudio/PeriodicWave.h:
* Modules/webaudio/RealtimeAnalyser.cpp:
(WebCore::RealtimeAnalyser::RealtimeAnalyser):
(WebCore::RealtimeAnalyser::setFftSize):
* Modules/webaudio/RealtimeAnalyser.h:
* Modules/webaudio/ScriptProcessorNode.cpp:
(WebCore::ScriptProcessorNode::ScriptProcessorNode):
* Modules/webaudio/WaveShaperDSPKernel.cpp:
(WebCore::WaveShaperDSPKernel::lazyInitializeOversampling):
* Modules/webaudio/WaveShaperDSPKernel.h:
* Modules/webaudio/WaveShaperNode.cpp:
(WebCore::WaveShaperNode::WaveShaperNode):
* Modules/webaudio/WaveShaperProcessor.cpp:
(WebCore::WaveShaperProcessor::createKernel):
* Modules/webaudio/WaveShaperProcessor.h:
* platform/audio/AudioBus.cpp:
(WebCore::AudioBus::AudioBus):
(WebCore::AudioBus::copyWithGainFrom):
* platform/audio/AudioBus.h:
* platform/audio/AudioChannel.cpp:
* platform/audio/AudioChannel.h:
(WebCore::AudioChannel::AudioChannel):
(WebCore::AudioChannel::set):
* platform/audio/AudioDSPKernelProcessor.h:
* platform/audio/AudioDestination.h:
* platform/audio/AudioResampler.cpp:
(WebCore::AudioResampler::AudioResampler):
(WebCore::AudioResampler::configureChannels):
* platform/audio/AudioResampler.h:
* platform/audio/AudioSession.h:
* platform/audio/DynamicsCompressor.cpp:
(WebCore::DynamicsCompressor::setNumberOfChannels):
* platform/audio/DynamicsCompressor.h:
* platform/audio/DynamicsCompressorKernel.cpp:
(WebCore::DynamicsCompressorKernel::setNumberOfChannels):
* platform/audio/DynamicsCompressorKernel.h:
* platform/audio/FFTFrame.cpp:
(WebCore::FFTFrame::createInterpolatedFrame):
* platform/audio/FFTFrame.h:
* platform/audio/HRTFDatabase.cpp:
(WebCore::HRTFDatabase::HRTFDatabase):
* platform/audio/HRTFDatabase.h:
* platform/audio/HRTFDatabaseLoader.cpp:
(WebCore::HRTFDatabaseLoader::~HRTFDatabaseLoader):
(WebCore::HRTFDatabaseLoader::load):
* platform/audio/HRTFDatabaseLoader.h:
* platform/audio/HRTFElevation.cpp:
(WebCore::HRTFElevation::createForSubject):
(WebCore::HRTFElevation::createByInterpolatingSlices):
* platform/audio/HRTFElevation.h:
(WebCore::HRTFElevation::HRTFElevation):
* platform/audio/HRTFKernel.cpp:
(WebCore::HRTFKernel::HRTFKernel):
(WebCore::HRTFKernel::createImpulseResponse):
(WebCore::HRTFKernel::createInterpolatedKernel):
* platform/audio/HRTFKernel.h:
(WebCore::HRTFKernel::create):
(WebCore::HRTFKernel::HRTFKernel):
* platform/audio/MultiChannelResampler.cpp:
(WebCore::MultiChannelResampler::MultiChannelResampler):
* platform/audio/MultiChannelResampler.h:
* platform/audio/Panner.cpp:
(WebCore::Panner::create):
* platform/audio/Panner.h:
* platform/audio/Reverb.cpp:
(WebCore::Reverb::initialize):
* platform/audio/Reverb.h:
* platform/audio/ReverbConvolver.h:
* platform/audio/ReverbConvolverStage.cpp:
(WebCore::ReverbConvolverStage::ReverbConvolverStage):
* platform/audio/ReverbConvolverStage.h:
* platform/audio/gstreamer/AudioDestinationGStreamer.cpp:
(WebCore::AudioDestination::create):
* platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
* platform/audio/ios/AudioDestinationIOS.cpp:
(WebCore::AudioDestination::create):
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSession::AudioSession):
* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestination::create):
* platform/audio/mac/AudioDestinationMac.h:
* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSession::AudioSession):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162368 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2d4882d6
2014-01-20 Zan Dobersek <zdobersek@igalia.com>
Move WebAudio source code to std::unique_ptr
https://bugs.webkit.org/show_bug.cgi?id=127274
Reviewed by Eric Carlson.
Move from using OwnPtr and PassOwnPtr to using std::unique_ptr and move semantics
in the WebAudio module and the WebAudio code in the platform layer.
* Modules/webaudio/AsyncAudioDecoder.cpp:
* Modules/webaudio/AsyncAudioDecoder.h:
* Modules/webaudio/AudioBasicInspectorNode.cpp:
(WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode):
* Modules/webaudio/AudioBasicProcessorNode.cpp:
(WebCore::AudioBasicProcessorNode::AudioBasicProcessorNode):
* Modules/webaudio/AudioBasicProcessorNode.h:
* Modules/webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::AudioBufferSourceNode):
* Modules/webaudio/AudioContext.cpp:
* Modules/webaudio/AudioContext.h:
* Modules/webaudio/AudioDestinationNode.cpp:
(WebCore::AudioDestinationNode::AudioDestinationNode):
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::addInput):
(WebCore::AudioNode::addOutput):
(WebCore::AudioNode::checkNumberOfChannelsForInput):
* Modules/webaudio/AudioNode.h:
* Modules/webaudio/BiquadFilterNode.cpp:
(WebCore::BiquadFilterNode::BiquadFilterNode):
* Modules/webaudio/BiquadProcessor.cpp:
(WebCore::BiquadProcessor::createKernel):
(WebCore::BiquadProcessor::getFrequencyResponse):
* Modules/webaudio/BiquadProcessor.h:
* Modules/webaudio/ChannelMergerNode.cpp:
(WebCore::ChannelMergerNode::ChannelMergerNode):
* Modules/webaudio/ChannelSplitterNode.cpp:
(WebCore::ChannelSplitterNode::ChannelSplitterNode):
* Modules/webaudio/ConvolverNode.cpp:
(WebCore::ConvolverNode::ConvolverNode):
(WebCore::ConvolverNode::uninitialize):
(WebCore::ConvolverNode::setBuffer):
* Modules/webaudio/ConvolverNode.h:
* Modules/webaudio/DefaultAudioDestinationNode.h:
* Modules/webaudio/DelayNode.cpp:
(WebCore::DelayNode::DelayNode):
* Modules/webaudio/DelayProcessor.cpp:
(WebCore::DelayProcessor::createKernel):
* Modules/webaudio/DelayProcessor.h:
* Modules/webaudio/DynamicsCompressorNode.cpp:
(WebCore::DynamicsCompressorNode::DynamicsCompressorNode):
(WebCore::DynamicsCompressorNode::initialize):
(WebCore::DynamicsCompressorNode::uninitialize):
* Modules/webaudio/DynamicsCompressorNode.h:
* Modules/webaudio/GainNode.cpp:
(WebCore::GainNode::GainNode):
* Modules/webaudio/MediaElementAudioSourceNode.cpp:
(WebCore::MediaElementAudioSourceNode::MediaElementAudioSourceNode):
(WebCore::MediaElementAudioSourceNode::setFormat):
* Modules/webaudio/MediaElementAudioSourceNode.h:
* Modules/webaudio/MediaStreamAudioDestinationNode.h:
* Modules/webaudio/MediaStreamAudioSource.cpp:
* Modules/webaudio/MediaStreamAudioSourceNode.cpp:
(WebCore::MediaStreamAudioSourceNode::MediaStreamAudioSourceNode):
* Modules/webaudio/MediaStreamAudioSourceNode.h:
* Modules/webaudio/OscillatorNode.cpp:
(WebCore::OscillatorNode::OscillatorNode):
* Modules/webaudio/PannerNode.cpp:
(WebCore::PannerNode::PannerNode):
(WebCore::PannerNode::uninitialize):
(WebCore::PannerNode::setPanningModel):
* Modules/webaudio/PannerNode.h:
* Modules/webaudio/PeriodicWave.cpp:
(WebCore::PeriodicWave::createBandLimitedTables):
* Modules/webaudio/PeriodicWave.h:
* Modules/webaudio/RealtimeAnalyser.cpp:
(WebCore::RealtimeAnalyser::RealtimeAnalyser):
(WebCore::RealtimeAnalyser::setFftSize):
* Modules/webaudio/RealtimeAnalyser.h:
* Modules/webaudio/ScriptProcessorNode.cpp:
(WebCore::ScriptProcessorNode::ScriptProcessorNode):
* Modules/webaudio/WaveShaperDSPKernel.cpp:
(WebCore::WaveShaperDSPKernel::lazyInitializeOversampling):
* Modules/webaudio/WaveShaperDSPKernel.h:
* Modules/webaudio/WaveShaperNode.cpp:
(WebCore::WaveShaperNode::WaveShaperNode):
* Modules/webaudio/WaveShaperProcessor.cpp:
(WebCore::WaveShaperProcessor::createKernel):
* Modules/webaudio/WaveShaperProcessor.h:
* platform/audio/AudioBus.cpp:
(WebCore::AudioBus::AudioBus):
(WebCore::AudioBus::copyWithGainFrom):
* platform/audio/AudioBus.h:
* platform/audio/AudioChannel.cpp:
* platform/audio/AudioChannel.h:
(WebCore::AudioChannel::AudioChannel):
(WebCore::AudioChannel::set):
* platform/audio/AudioDSPKernelProcessor.h:
* platform/audio/AudioDestination.h:
* platform/audio/AudioResampler.cpp:
(WebCore::AudioResampler::AudioResampler):
(WebCore::AudioResampler::configureChannels):
* platform/audio/AudioResampler.h:
* platform/audio/AudioSession.h:
* platform/audio/DynamicsCompressor.cpp:
(WebCore::DynamicsCompressor::setNumberOfChannels):
* platform/audio/DynamicsCompressor.h:
* platform/audio/DynamicsCompressorKernel.cpp:
(WebCore::DynamicsCompressorKernel::setNumberOfChannels):
* platform/audio/DynamicsCompressorKernel.h:
* platform/audio/FFTFrame.cpp:
(WebCore::FFTFrame::createInterpolatedFrame):
* platform/audio/FFTFrame.h:
* platform/audio/HRTFDatabase.cpp:
(WebCore::HRTFDatabase::HRTFDatabase):
* platform/audio/HRTFDatabase.h:
* platform/audio/HRTFDatabaseLoader.cpp:
(WebCore::HRTFDatabaseLoader::~HRTFDatabaseLoader):
(WebCore::HRTFDatabaseLoader::load):
* platform/audio/HRTFDatabaseLoader.h:
* platform/audio/HRTFElevation.cpp:
(WebCore::HRTFElevation::createForSubject):
(WebCore::HRTFElevation::createByInterpolatingSlices):
* platform/audio/HRTFElevation.h:
(WebCore::HRTFElevation::HRTFElevation):
* platform/audio/HRTFKernel.cpp:
(WebCore::HRTFKernel::HRTFKernel):
(WebCore::HRTFKernel::createImpulseResponse):
(WebCore::HRTFKernel::createInterpolatedKernel):
* platform/audio/HRTFKernel.h:
(WebCore::HRTFKernel::create):
(WebCore::HRTFKernel::HRTFKernel):
* platform/audio/MultiChannelResampler.cpp:
(WebCore::MultiChannelResampler::MultiChannelResampler):
* platform/audio/MultiChannelResampler.h:
* platform/audio/Panner.cpp:
(WebCore::Panner::create):
* platform/audio/Panner.h:
* platform/audio/Reverb.cpp:
(WebCore::Reverb::initialize):
* platform/audio/Reverb.h:
* platform/audio/ReverbConvolver.h:
* platform/audio/ReverbConvolverStage.cpp:
(WebCore::ReverbConvolverStage::ReverbConvolverStage):
* platform/audio/ReverbConvolverStage.h:
* platform/audio/gstreamer/AudioDestinationGStreamer.cpp:
(WebCore::AudioDestination::create):
* platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
* platform/audio/ios/AudioDestinationIOS.cpp:
(WebCore::AudioDestination::create):
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSession::AudioSession):
* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestination::create):
* platform/audio/mac/AudioDestinationMac.h:
* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSession::AudioSession):
2014-01-20 Morten Stenshorne <mstensho@opera.com>
Region based multicol: support explicit column breaks
......@@ -32,8 +32,6 @@
#include "AudioBufferCallback.h"
#include <runtime/ArrayBuffer.h>
#include <wtf/MainThread.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
namespace WebCore {
......
......@@ -25,9 +25,9 @@
#ifndef AsyncAudioDecoder_h
#define AsyncAudioDecoder_h
#include <memory>
#include <wtf/Forward.h>
#include <wtf/MessageQueue.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Threading.h>
......
......@@ -38,8 +38,8 @@ AudioBasicInspectorNode::AudioBasicInspectorNode(AudioContext* context, float sa
: AudioNode(context, sampleRate)
, m_needAutomaticPull(false)
{
addInput(adoptPtr(new AudioNodeInput(this)));
addOutput(adoptPtr(new AudioNodeOutput(this, outputChannelCount)));
addInput(std::make_unique<AudioNodeInput>(this));
addOutput(std::make_unique<AudioNodeOutput>(this, outputChannelCount));
}
// We override pullInputs() as an optimization allowing this node to take advantage of in-place processing,
......
......@@ -39,8 +39,8 @@ namespace WebCore {
AudioBasicProcessorNode::AudioBasicProcessorNode(AudioContext* context, float sampleRate)
: AudioNode(context, sampleRate)
{
addInput(adoptPtr(new AudioNodeInput(this)));
addOutput(adoptPtr(new AudioNodeOutput(this, 1)));
addInput(std::make_unique<AudioNodeInput>(this));
addOutput(std::make_unique<AudioNodeOutput>(this, 1));
// The subclass must create m_processor.
}
......
......@@ -26,6 +26,7 @@
#define AudioBasicProcessorNode_h
#include "AudioNode.h"
#include <memory>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/Threading.h>
......@@ -59,7 +60,7 @@ protected:
virtual double latencyTime() const override;
AudioProcessor* processor() { return m_processor.get(); }
OwnPtr<AudioProcessor> m_processor;
std::unique_ptr<AudioProcessor> m_processor;
};
} // namespace WebCore
......
......@@ -73,7 +73,7 @@ AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* context, float sample
m_playbackRate = AudioParam::create(context, "playbackRate", 1.0, 0.0, MaxRate);
// Default to mono. A call to setBuffer() will set the number of output channels to that of the buffer.
addOutput(adoptPtr(new AudioNodeOutput(this, 1)));
addOutput(std::make_unique<AudioNodeOutput>(this, 1));
initialize();
}
......
......@@ -88,8 +88,6 @@
#include <runtime/ArrayBuffer.h>
#include <wtf/Atomics.h>
#include <wtf/MainThread.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
......
......@@ -34,7 +34,6 @@
#include "MediaCanStartListener.h"
#include <wtf/HashSet.h>
#include <wtf/MainThread.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
......
......@@ -40,7 +40,7 @@ AudioDestinationNode::AudioDestinationNode(AudioContext* context, float sampleRa
: AudioNode(context, sampleRate)
, m_currentSampleFrame(0)
{
addInput(adoptPtr(new AudioNodeInput(this)));
addInput(std::make_unique<AudioNodeInput>(this));
setNodeType(NodeTypeDestination);
}
......
......@@ -98,14 +98,14 @@ void AudioNode::lazyInitialize()
initialize();
}
void AudioNode::addInput(PassOwnPtr<AudioNodeInput> input)
void AudioNode::addInput(std::unique_ptr<AudioNodeInput> input)
{
m_inputs.append(input);
m_inputs.append(std::move(input));
}
void AudioNode::addOutput(PassOwnPtr<AudioNodeOutput> output)
void AudioNode::addOutput(std::unique_ptr<AudioNodeOutput> output)
{
m_outputs.append(output);
m_outputs.append(std::move(output));
}
AudioNodeInput* AudioNode::input(unsigned i)
......@@ -324,11 +324,14 @@ void AudioNode::checkNumberOfChannelsForInput(AudioNodeInput* input)
{
ASSERT(context()->isAudioThread() && context()->isGraphOwner());
ASSERT(m_inputs.contains(input));
if (!m_inputs.contains(input))
return;
for (const std::unique_ptr<AudioNodeInput>& savedInput : m_inputs) {
if (input == savedInput.get()) {
input->updateInternalBus();
return;
}
}
input->updateInternalBus();
ASSERT_NOT_REACHED();
}
bool AudioNode::propagatesSilence() const
......
......@@ -27,9 +27,8 @@
#include "AudioBus.h"
#include "EventTarget.h"
#include <memory>
#include <wtf/Forward.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
......@@ -185,8 +184,8 @@ public:
protected:
// Inputs and outputs must be created before the AudioNode is initialized.
void addInput(PassOwnPtr<AudioNodeInput>);
void addOutput(PassOwnPtr<AudioNodeOutput>);
void addInput(std::unique_ptr<AudioNodeInput>);
void addOutput(std::unique_ptr<AudioNodeOutput>);
// Called by processIfNecessary() to cause all parts of the rendering graph connected to us to process.
// Each rendering quantum, the audio data for each of the AudioNode's inputs will be available after this method is called.
......@@ -201,8 +200,8 @@ private:
NodeType m_nodeType;
RefPtr<AudioContext> m_context;
float m_sampleRate;
Vector<OwnPtr<AudioNodeInput>> m_inputs;
Vector<OwnPtr<AudioNodeOutput>> m_outputs;
Vector<std::unique_ptr<AudioNodeInput>> m_inputs;
Vector<std::unique_ptr<AudioNodeOutput>> m_outputs;
double m_lastProcessingTime;
double m_lastNonSilentTime;
......
......@@ -36,7 +36,7 @@ BiquadFilterNode::BiquadFilterNode(AudioContext* context, float sampleRate)
: AudioBasicProcessorNode(context, sampleRate)
{
// Initially setup as lowpass filter.
m_processor = adoptPtr(new BiquadProcessor(context, sampleRate, 1, false));
m_processor = std::make_unique<BiquadProcessor>(context, sampleRate, 1, false);
setNodeType(NodeTypeBiquadFilter);
}
......
......@@ -60,9 +60,9 @@ BiquadProcessor::~BiquadProcessor()
uninitialize();
}
PassOwnPtr<AudioDSPKernel> BiquadProcessor::createKernel()
std::unique_ptr<AudioDSPKernel> BiquadProcessor::createKernel()
{
return adoptPtr(new BiquadDSPKernel(this));
return std::make_unique<BiquadDSPKernel>(this);
}
void BiquadProcessor::checkForDirtyCoefficients()
......@@ -128,7 +128,7 @@ void BiquadProcessor::getFrequencyResponse(int nFrequencies,
// to avoid interfering with the processing running in the audio
// thread on the main kernels.
OwnPtr<BiquadDSPKernel> responseKernel = adoptPtr(new BiquadDSPKernel(this));
auto responseKernel = std::make_unique<BiquadDSPKernel>(this);
responseKernel->getFrequencyResponse(nFrequencies, frequencyHz, magResponse, phaseResponse);
}
......
......@@ -30,6 +30,7 @@
#include "AudioNode.h"
#include "AudioParam.h"
#include "Biquad.h"
#include <memory>
#include <wtf/RefPtr.h>
namespace WebCore {
......@@ -53,7 +54,7 @@ public:
virtual ~BiquadProcessor();
virtual PassOwnPtr<AudioDSPKernel> createKernel() override;
virtual std::unique_ptr<AudioDSPKernel> createKernel() override;
virtual void process(const AudioBus* source, AudioBus* destination, size_t framesToProcess) override;
......
......@@ -54,9 +54,9 @@ ChannelMergerNode::ChannelMergerNode(AudioContext* context, float sampleRate, un
{
// Create the requested number of inputs.
for (unsigned i = 0; i < numberOfInputs; ++i)
addInput(adoptPtr(new AudioNodeInput(this)));
addInput(std::make_unique<AudioNodeInput>(this));
addOutput(adoptPtr(new AudioNodeOutput(this, 1)));
addOutput(std::make_unique<AudioNodeOutput>(this, 1));
setNodeType(NodeTypeChannelMerger);
......
......@@ -45,11 +45,11 @@ PassRefPtr<ChannelSplitterNode> ChannelSplitterNode::create(AudioContext* contex
ChannelSplitterNode::ChannelSplitterNode(AudioContext* context, float sampleRate, unsigned numberOfOutputs)
: AudioNode(context, sampleRate)
{
addInput(adoptPtr(new AudioNodeInput(this)));
addInput(std::make_unique<AudioNodeInput>(this));
// Create a fixed number of outputs (able to handle the maximum number of channels fed to an input).
for (unsigned i = 0; i < numberOfOutputs; ++i)
addOutput(adoptPtr(new AudioNodeOutput(this, 1)));
addOutput(std::make_unique<AudioNodeOutput>(this, 1));
setNodeType(NodeTypeChannelSplitter);
......
......@@ -49,8 +49,8 @@ ConvolverNode::ConvolverNode(AudioContext* context, float sampleRate)
: AudioNode(context, sampleRate)
, m_normalize(true)
{
addInput(adoptPtr(new AudioNodeInput(this)));
addOutput(adoptPtr(new AudioNodeOutput(this, 2)));
addInput(std::make_unique<AudioNodeInput>(this));
addOutput(std::make_unique<AudioNodeOutput>(this, 2));
// Node-specific default mixing rules.
m_channelCount = 2;
......@@ -111,7 +111,7 @@ void ConvolverNode::uninitialize()
if (!isInitialized())
return;
m_reverb.clear();
m_reverb.reset();
AudioNode::uninitialize();
}
......@@ -141,12 +141,12 @@ void ConvolverNode::setBuffer(AudioBuffer* buffer)
// Create the reverb with the given impulse response.
bool useBackgroundThreads = !context()->isOfflineContext();
OwnPtr<Reverb> reverb = adoptPtr(new Reverb(bufferBus.get(), AudioNode::ProcessingSizeInFrames, MaxFFTSize, 2, useBackgroundThreads, m_normalize));
auto reverb = std::make_unique<Reverb>(bufferBus.get(), AudioNode::ProcessingSizeInFrames, MaxFFTSize, 2, useBackgroundThreads, m_normalize);
{
// Synchronize with process().
std::lock_guard<std::mutex> lock(m_processMutex);
m_reverb = reverb.release();
m_reverb = std::move(reverb);
m_buffer = buffer;
}
}
......
......@@ -26,8 +26,8 @@
#define ConvolverNode_h
#include "AudioNode.h"
#include <memory>
#include <mutex>
#include <wtf/OwnPtr.h>
#include <wtf/RefPtr.h>
namespace WebCore {
......@@ -63,7 +63,7 @@ private:
virtual double tailTime() const override;
virtual double latencyTime() const override;
OwnPtr<Reverb> m_reverb;
std::unique_ptr<Reverb> m_reverb;
RefPtr<AudioBuffer> m_buffer;
// This synchronizes dynamic changes to the convolution impulse response with process().
......
......@@ -27,7 +27,7 @@
#include "AudioDestination.h"
#include "AudioDestinationNode.h"
#include <wtf/OwnPtr.h>
#include <memory>
namespace WebCore {
......@@ -56,7 +56,7 @@ private:
explicit DefaultAudioDestinationNode(AudioContext*);
void createDestination();
OwnPtr<AudioDestination> m_destination;
std::unique_ptr<AudioDestination> m_destination;
String m_inputDeviceId;
unsigned m_numberOfInputChannels;
};
......
......@@ -39,7 +39,7 @@ DelayNode::DelayNode(AudioContext* context, float sampleRate, double maxDelayTim
ec = NOT_SUPPORTED_ERR;
return;
}
m_processor = adoptPtr(new DelayProcessor(context, sampleRate, 1, maxDelayTime));
m_processor = std::make_unique<DelayProcessor>(context, sampleRate, 1, maxDelayTime);
setNodeType(NodeTypeDelay);
}
......
......@@ -45,9 +45,9 @@ DelayProcessor::~DelayProcessor()
uninitialize();
}
PassOwnPtr<AudioDSPKernel> DelayProcessor::createKernel()
std::unique_ptr<AudioDSPKernel> DelayProcessor::createKernel()
{
return adoptPtr(new DelayDSPKernel(this));
return std::make_unique<DelayDSPKernel>(this);
}
} // namespace WebCore
......
......@@ -27,8 +27,7 @@
#include "AudioDSPKernelProcessor.h"
#include "AudioParam.h"
#include <wtf/PassOwnPtr.h>
#include <memory>
#include <wtf/RefPtr.h>
namespace WebCore {
......@@ -40,7 +39,7 @@ public:
DelayProcessor(AudioContext*, float sampleRate, unsigned numberOfChannels, double maxDelayTime);
virtual ~DelayProcessor();
virtual PassOwnPtr<AudioDSPKernel> createKernel() override;
virtual std::unique_ptr<AudioDSPKernel> createKernel() override;
AudioParam* delayTime() const { return m_delayTime.get(); }
......
......@@ -41,8 +41,8 @@ namespace WebCore {
DynamicsCompressorNode::DynamicsCompressorNode(AudioContext* context, float sampleRate)
: AudioNode(context, sampleRate)
{
addInput(adoptPtr(new AudioNodeInput(this)));
addOutput(adoptPtr(new AudioNodeOutput(this, defaultNumberOfOutputChannels)));
addInput(std::make_unique<AudioNodeInput>(this));
addOutput(std::make_unique<AudioNodeOutput>(this, defaultNumberOfOutputChannels));
setNodeType(NodeTypeDynamicsCompressor);
......@@ -95,7 +95,7 @@ void DynamicsCompressorNode::initialize()
return;
AudioNode::initialize();
m_dynamicsCompressor = adoptPtr(new DynamicsCompressor(sampleRate(), defaultNumberOfOutputChannels));
m_dynamicsCompressor = std::make_unique<DynamicsCompressor>(sampleRate(), defaultNumberOfOutputChannels);
}
void DynamicsCompressorNode::uninitialize()
......@@ -103,7 +103,7 @@ void DynamicsCompressorNode::uninitialize()
if (!isInitialized())
return;
m_dynamicsCompressor.clear();
m_dynamicsCompressor.reset();
AudioNode::uninitialize();
}
......
......@@ -27,7 +27,7 @@
#include "AudioNode.h"
#include "AudioParam.h"
#include <wtf/OwnPtr.h>
#include <memory>
namespace WebCore {
......@@ -64,7 +64,7 @@ private:
DynamicsCompressorNode(AudioContext*, float sampleRate);
OwnPtr<DynamicsCompressor> m_dynamicsCompressor;
std::unique_ptr<DynamicsCompressor> m_dynamicsCompressor;
RefPtr<AudioParam> m_threshold;
RefPtr<AudioParam> m_knee;
RefPtr<AudioParam> m_ratio;
......
......@@ -41,8 +41,8 @@ GainNode::GainNode(AudioContext* context, float sampleRate)
{
m_gain = AudioParam::create(context, "gain", 1.0, 0.0, 1.0);
addInput(adoptPtr(new AudioNodeInput(this)));
addOutput(adoptPtr(new AudioNodeOutput(this, 1)));
addInput(std::make_unique<AudioNodeInput>(this));
addOutput(std::make_unique<AudioNodeOutput>(this, 1));
setNodeType(NodeTypeGain);
......
......@@ -52,7 +52,7 @@ MediaElementAudioSourceNode::MediaElementAudioSourceNode(AudioContext* context,
, m_sourceSampleRate(0)
{
// Default to stereo. This could change depending on what the media element .src is set to.
addOutput(adoptPtr(new AudioNodeOutput(this, 2)));
addOutput(std::make_unique<AudioNodeOutput>(this, 2));
setNodeType(NodeTypeMediaElementAudioSource);
......@@ -84,10 +84,10 @@ void MediaElementAudioSourceNode::setFormat(size_t numberOfChannels, float sourc
if (sourceSampleRate != sampleRate()) {
double scaleFactor = sourceSampleRate / sampleRate();
m_multiChannelResampler = adoptPtr(new MultiChannelResampler(scaleFactor, numberOfChannels));
m_multiChannelResampler = std::make_unique<MultiChannelResampler>(scaleFactor, numberOfChannels);
} else {
// Bypass resampling.
m_multiChannelResampler.clear();
m_multiChannelResampler.reset();
}
{
......
......@@ -31,8 +31,8 @@
#include "AudioSourceProviderClient.h"
#include "HTMLMediaElement.h"
#include "MultiChannelResampler.h"
#include <memory>
#include <mutex>
#include <wtf/OwnPtr.h>
#include <wtf/PassRefPtr.h>
namespace WebCore {
......@@ -72,7 +72,7 @@ private:
unsigned m_sourceNumberOfChannels;
double m_sourceSampleRate;
OwnPtr<MultiChannelResampler> m_multiChannelResampler;
std::unique_ptr<MultiChannelResampler> m_multiChannelResampler;
};
} // namespace WebCore
......
......@@ -30,7 +30,6 @@
#include "AudioBasicInspectorNode.h"
#include "AudioBus.h"
#include "MediaStream.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassRefPtr.h>
namespace WebCore {
......