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

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

Issue 2638413004: Don't run removeFinishedSourceNodes with the context lock. (Closed)
Patch Set: Created 3 years, 11 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/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() {

Powered by Google App Engine
This is Rietveld 408576698