Index: third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.cpp |
diff --git a/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.cpp b/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.cpp |
index 3086c030ed1089027ec42a1bdaa6c1cdcd7ca518..ed32c4bd17218ef12012a149330935317583758a 100644 |
--- a/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.cpp |
+++ b/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.cpp |
@@ -28,6 +28,7 @@ |
#include "modules/webaudio/AudioNode.h" |
#include "modules/webaudio/AudioNodeOutput.h" |
+#include "modules/webaudio/OfflineAudioContext.h" |
#include "platform/ThreadSafeFunctional.h" |
#include "public/platform/Platform.h" |
#include "wtf/MainThread.h" |
@@ -60,6 +61,17 @@ void DeferredTaskHandler::unlock() |
m_contextGraphMutex.unlock(); |
} |
+void DeferredTaskHandler::offlineLock() |
+{ |
+ // RELEASE_ASSERT is here to make sure to explicitly crash if this is called |
+ // from other than the offline render thread, which is considered as the |
+ // audio thread in OfflineAudioContext. |
+ RELEASE_ASSERT_WITH_MESSAGE(isAudioThread(), |
+ "DeferredTaskHandler::offlineLock() must be called within the offline audio thread."); |
+ |
+ m_contextGraphMutex.lock(); |
+} |
+ |
#if ENABLE(ASSERT) |
bool DeferredTaskHandler::isGraphOwner() |
{ |
@@ -232,6 +244,12 @@ DeferredTaskHandler::AutoLocker::AutoLocker(AbstractAudioContext* context) |
m_handler.lock(); |
} |
+DeferredTaskHandler::OfflineGraphAutoLocker::OfflineGraphAutoLocker(OfflineAudioContext* context) |
+ : m_handler(context->deferredTaskHandler()) |
+{ |
+ m_handler.offlineLock(); |
+} |
+ |
void DeferredTaskHandler::addRenderingOrphanHandler(PassRefPtr<AudioHandler> handler) |
{ |
ASSERT(handler); |