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

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

Issue 1405413004: Implement suspend() and resume() for OfflineAudioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed feedback from yhirano Created 5 years, 1 month 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/DeferredTaskHandler.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.cpp b/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.cpp
index cba5a99247ab2929a07aae6107dbb4a70cfee023..b1efcf8a2f4df8c5bce622db467e75dad5f97b9c 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()
{
@@ -226,12 +238,19 @@ void DeferredTaskHandler::contextWillBeDestroyed()
// Some handlers might live because of their cross thread tasks.
}
+
haraken 2015/11/17 08:28:10 Nit: Remove the empty line.
hongchan 2015/11/17 18:11:44 Done.
DeferredTaskHandler::AutoLocker::AutoLocker(AbstractAudioContext* context)
: m_handler(context->deferredTaskHandler())
{
m_handler.lock();
}
+DeferredTaskHandler::OfflineGraphAutoLocker::OfflineGraphAutoLocker(OfflineAudioContext* context)
+ : m_handler(context->deferredTaskHandler())
+{
+ m_handler.offlineLock();
+}
+
void DeferredTaskHandler::addRenderingOrphanHandler(PassRefPtr<AudioHandler> handler)
{
ASSERT(handler);

Powered by Google App Engine
This is Rietveld 408576698