Chromium Code Reviews| Index: Source/modules/webaudio/OscillatorNode.cpp |
| diff --git a/Source/modules/webaudio/OscillatorNode.cpp b/Source/modules/webaudio/OscillatorNode.cpp |
| index a2d95dcb4a3508320a64deda6a12e2f669a2c7b4..5580edd4ce995531a41707855120570910f8cdfd 100644 |
| --- a/Source/modules/webaudio/OscillatorNode.cpp |
| +++ b/Source/modules/webaudio/OscillatorNode.cpp |
| @@ -43,9 +43,9 @@ namespace WebCore { |
| using namespace VectorMath; |
| -PassRefPtr<OscillatorNode> OscillatorNode::create(AudioContext* context, float sampleRate) |
| +PassRefPtrWillBeRawPtr<OscillatorNode> OscillatorNode::create(AudioContext* context, float sampleRate) |
| { |
| - return adoptRef(new OscillatorNode(context, sampleRate)); |
| + return adoptRefWillBeNoop(new OscillatorNode(context, sampleRate)); |
| } |
| OscillatorNode::OscillatorNode(AudioContext* context, float sampleRate) |
| @@ -118,23 +118,42 @@ bool OscillatorNode::setType(unsigned type) |
| switch (type) { |
| case SINE: { |
| +#if !ENABLE(OILPAN) |
| DEFINE_STATIC_REF(PeriodicWave, periodicWaveSine, (PeriodicWave::createSine(sampleRate))); |
| periodicWave = periodicWaveSine; |
| +#else |
| + periodicWave = PeriodicWave::createSine(sampleRate); |
|
haraken
2014/03/27 11:44:05
You need to store the created pointer into a stati
keishi
2014/04/03 06:53:19
Done. Created DEFINE_STATIC_REF_WILL_BE_PERSISTENT
|
| +#endif |
| break; |
| } |
| case SQUARE: { |
| +#if !ENABLE(OILPAN) |
| DEFINE_STATIC_REF(PeriodicWave, periodicWaveSquare, (PeriodicWave::createSquare(sampleRate))); |
| periodicWave = periodicWaveSquare; |
| +#else |
| + Persistent<PeriodicWave> periodicWaveSquare = PeriodicWave::createSquare(sampleRate); |
|
haraken
2014/03/27 11:44:05
Use DEFINE_STATIC_LOCAL.
keishi
2014/04/03 06:53:19
Done.
|
| + periodicWave = periodicWaveSquare; |
| +#endif |
| break; |
| } |
| case SAWTOOTH: { |
| +#if !ENABLE(OILPAN) |
| DEFINE_STATIC_REF(PeriodicWave, periodicWaveSawtooth, (PeriodicWave::createSawtooth(sampleRate))); |
| periodicWave = periodicWaveSawtooth; |
| +#else |
| + Persistent<PeriodicWave> periodicWaveSawtooth = PeriodicWave::createSawtooth(sampleRate); |
|
haraken
2014/03/27 11:44:05
Ditto.
keishi
2014/04/03 06:53:19
Done.
|
| + periodicWave = periodicWaveSawtooth; |
| +#endif |
| break; |
| } |
| case TRIANGLE: { |
| +#if !ENABLE(OILPAN) |
| DEFINE_STATIC_REF(PeriodicWave, periodicWaveTriangle, (PeriodicWave::createTriangle(sampleRate))); |
| periodicWave = periodicWaveTriangle; |
| +#else |
| + Persistent<PeriodicWave> periodicWaveTriangle = PeriodicWave::createTriangle(sampleRate); |
|
haraken
2014/03/27 11:44:05
Ditto.
Probably it might be worth introducing DEF
keishi
2014/04/03 06:53:19
Done.
|
| + periodicWave = periodicWaveTriangle; |
| +#endif |
| break; |
| } |
| case CUSTOM: |
| @@ -343,6 +362,14 @@ bool OscillatorNode::propagatesSilence() const |
| return !isPlayingOrScheduled() || hasFinished() || !m_periodicWave.get(); |
| } |
| +void OscillatorNode::trace(Visitor* visitor) |
| +{ |
| + visitor->trace(m_frequency); |
| + visitor->trace(m_detune); |
| + visitor->trace(m_periodicWave); |
| + AudioNode::trace(visitor); |
|
Mads Ager (chromium)
2014/03/27 11:06:49
We should call the immediate super class trace her
keishi
2014/04/03 06:53:19
Done.
|
| +} |
| + |
| } // namespace WebCore |
| #endif // ENABLE(WEB_AUDIO) |