Chromium Code Reviews| Index: third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp |
| diff --git a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp |
| index 44c5badf83d62db681b89090707876641dba8236..f051751d309fd1e9de967651888f83de18070a05 100644 |
| --- a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp |
| +++ b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp |
| @@ -646,7 +646,7 @@ void BaseAudioContext::removeFinishedSourceNodes() { |
| m_finishedSourceNodes.clear(); |
| } |
| -void BaseAudioContext::releaseFinishedSourceNodes() { |
| +bool BaseAudioContext::releaseFinishedSourceNodes() { |
| ASSERT(isGraphOwner()); |
| DCHECK(isAudioThread()); |
| bool didRemove = false; |
| @@ -662,13 +662,7 @@ void BaseAudioContext::releaseFinishedSourceNodes() { |
| } |
| } |
| } |
| - if (didRemove) |
| - Platform::current()->mainThread()->getWebTaskRunner()->postTask( |
| - BLINK_FROM_HERE, |
| - crossThreadBind(&BaseAudioContext::removeFinishedSourceNodes, |
| - wrapCrossThreadPersistent(this))); |
| - |
| - m_finishedSourceHandlers.clear(); |
|
hongchan
2017/01/19 12:47:43
We don't have this line in the patchset anymore. I
Raymond Toy
2017/01/20 19:36:10
Fixed.
|
| + return didRemove; |
| } |
| void BaseAudioContext::notifySourceNodeStartedProcessing(AudioNode* node) { |
| @@ -741,18 +735,26 @@ void BaseAudioContext::handlePostRenderTasks() { |
| // is that there will be some nodes which will take slightly longer than usual |
| // to be deleted or removed from the render graph (in which case they'll |
| // render silence). |
| + bool didRemove = false; |
| if (tryLock()) { |
| // Take care of AudioNode tasks where the tryLock() failed previously. |
| deferredTaskHandler().breakConnections(); |
| // Dynamically clean up nodes which are no longer needed. |
| - releaseFinishedSourceNodes(); |
| + didRemove = releaseFinishedSourceNodes(); |
| deferredTaskHandler().handleDeferredTasks(); |
| deferredTaskHandler().requestToDeleteHandlersOnMainThread(); |
| unlock(); |
| } |
| + |
| + if (didRemove) { |
| + Platform::current()->mainThread()->getWebTaskRunner()->postTask( |
| + BLINK_FROM_HERE, |
| + crossThreadBind(&BaseAudioContext::removeFinishedSourceNodes, |
| + wrapCrossThreadPersistent(this))); |
| + } |
| } |
| void BaseAudioContext::resolvePromisesForResumeOnMainThread() { |