Index: third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.h |
diff --git a/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.h b/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.h |
index b145642b82ea96eb3bd9de6e5d1ab3f3de8955c8..184ee1c0a6d5a8374055941802a0063243e35b98 100644 |
--- a/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.h |
+++ b/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.h |
@@ -38,6 +38,7 @@ |
namespace blink { |
class AbstractAudioContext; |
+class OfflineAudioContext; |
class AudioHandler; |
class AudioNodeOutput; |
class AudioSummingJunction; |
@@ -110,6 +111,11 @@ public: |
void lock(); |
bool tryLock(); |
void unlock(); |
+ |
+ // This locks the audio render thread for OfflineAudioContext rendering. |
+ // MUST NOT be used in the real-time audio context. |
+ void offlineLock(); |
+ |
#if ENABLE(ASSERT) |
// Returns true if this thread owns the context's lock. |
bool isGraphOwner(); |
@@ -131,6 +137,21 @@ public: |
DeferredTaskHandler& m_handler; |
}; |
+ // This is for locking offline render thread (which is considered as the |
+ // audio thread) with unlocking on self-destruction at the end of the scope. |
+ // Also note that it uses lock() rather than tryLock() because the timing |
+ // MUST be accurate on offline rendering. |
+ class MODULES_EXPORT OfflineGraphAutoLocker { |
+ STACK_ALLOCATED(); |
+ public: |
+ explicit OfflineGraphAutoLocker(OfflineAudioContext*); |
+ |
+ ~OfflineGraphAutoLocker() { m_handler.unlock(); } |
+ |
+ private: |
+ DeferredTaskHandler& m_handler; |
+ }; |
+ |
private: |
DeferredTaskHandler(); |
void updateAutomaticPullNodes(); |