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

Unified Diff: third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.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/OfflineAudioContext.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp b/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp
index bf0da224144f6cac26f789b0ad6028ca6bc19895..87f23d7c93629bcc27c82b59b6971a040bd57d8d 100644
--- a/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp
@@ -36,8 +36,10 @@
#include "modules/webaudio/OfflineAudioCompletionEvent.h"
#include "modules/webaudio/OfflineAudioDestinationNode.h"
+#include "platform/CrossThreadFunctional.h"
#include "platform/Histogram.h"
#include "platform/audio/AudioUtilities.h"
+#include "public/platform/Platform.h"
namespace blink {
@@ -374,12 +376,21 @@ void OfflineAudioContext::handlePostOfflineRenderTasks() {
// OfflineGraphAutoLocker here locks the audio graph for the same reason
// above in |handlePreOfflineRenderTasks|.
- OfflineGraphAutoLocker locker(this);
-
- deferredTaskHandler().breakConnections();
- releaseFinishedSourceNodes();
- deferredTaskHandler().handleDeferredTasks();
- deferredTaskHandler().requestToDeleteHandlersOnMainThread();
+ bool didRemove = false;
+ {
+ OfflineGraphAutoLocker locker(this);
+
+ deferredTaskHandler().breakConnections();
+ didRemove = releaseFinishedSourceNodes();
+ deferredTaskHandler().handleDeferredTasks();
+ deferredTaskHandler().requestToDeleteHandlersOnMainThread();
+ }
+ if (didRemove) {
+ Platform::current()->mainThread()->getWebTaskRunner()->postTask(
+ BLINK_FROM_HERE,
+ crossThreadBind(&BaseAudioContext::removeFinishedSourceNodes,
+ wrapCrossThreadPersistent(this)));
+ }
}
OfflineAudioDestinationHandler& OfflineAudioContext::destinationHandler() {

Powered by Google App Engine
This is Rietveld 408576698