Chromium Code Reviews| Index: Source/modules/webaudio/AudioContext.cpp |
| diff --git a/Source/modules/webaudio/AudioContext.cpp b/Source/modules/webaudio/AudioContext.cpp |
| index 64cfcec8f094668af32aead6d81a4327cc3765b1..cdb24cae014f4ae3b28ecc845264e75384494ea3 100644 |
| --- a/Source/modules/webaudio/AudioContext.cpp |
| +++ b/Source/modules/webaudio/AudioContext.cpp |
| @@ -191,6 +191,11 @@ void AudioContext::initialize() |
| void AudioContext::clear() |
| { |
| +#if ENABLE(OILPAN) |
| + // We need to run disposers before destructing m_contextGraphMutex. |
| + m_liveAudioSummingJunctions.clear(); |
| +#endif |
| + |
| // We have to release our reference to the destination node before the context will ever be deleted since the destination node holds a reference to the context. |
| if (m_destinationNode) |
| m_destinationNode.clear(); |
| @@ -756,6 +761,21 @@ void AudioContext::handleDeferredAudioNodeTasks() |
| m_deferredFinishDerefList.clear(); |
| } |
| +#if ENABLE(OILPAN) |
| +void AudioContext::registerLiveAudioSummingJunction(AudioSummingJunction& junction) |
| +{ |
| + ASSERT(isMainThread()); |
| + m_liveAudioSummingJunctions.add(&junction, adoptPtr(new AudioSummingJunctionDisposer(junction))); |
| +} |
| + |
| +AudioContext::AudioSummingJunctionDisposer::~AudioSummingJunctionDisposer() |
| +{ |
| + ASSERT(isMainThread()); |
| + AudioContext::AutoLocker locker(m_junction.context()); |
|
haraken
2014/07/18 09:49:30
Won't this cause a dead lock? removeMarkedSummingJ
tkent
2014/07/18 09:52:16
No. AutoLocker supports reentrancy. If the curre
tkent
2014/07/18 09:54:22
Anyway, this AutoLocker is redundant and unnecessa
haraken
2014/07/18 10:01:01
Makes sense. However, I think you can just drop th
tkent
2014/07/18 13:43:09
Indeed.
|
| + m_junction.context()->removeMarkedSummingJunction(&m_junction); |
| +} |
| +#endif |
| + |
| void AudioContext::markForDeletion(AudioNode* node) |
| { |
| ASSERT(isGraphOwner()); |
| @@ -817,10 +837,12 @@ void AudioContext::deleteMarkedNodes() |
| AudioNode* node = m_nodesToDelete[n - 1]; |
| m_nodesToDelete.removeLast(); |
| +#if !ENABLE(OILPAN) |
|
haraken
2014/07/18 10:01:00
Probably can we keep this code? In terms of perfor
tkent
2014/07/18 13:43:08
Yeah, It's ok to keep this.
|
| // Before deleting the node, clear out any AudioNodeInputs from m_dirtySummingJunctions. |
| unsigned numberOfInputs = node->numberOfInputs(); |
| for (unsigned i = 0; i < numberOfInputs; ++i) |
| m_dirtySummingJunctions.remove(node->input(i)); |
| +#endif |
| // Before deleting the node, clear out any AudioNodeOutputs from m_dirtyAudioNodeOutputs. |
| unsigned numberOfOutputs = node->numberOfOutputs(); |
| @@ -965,6 +987,9 @@ void AudioContext::trace(Visitor* visitor) |
| visitor->trace(m_renderTarget); |
| visitor->trace(m_destinationNode); |
| visitor->trace(m_listener); |
| +#if ENABLE(OILPAN) |
| + visitor->trace(m_liveAudioSummingJunctions); |
| +#endif |
| EventTargetWithInlineData::trace(visitor); |
| } |