Index: Source/modules/webaudio/AudioContext.h |
diff --git a/Source/modules/webaudio/AudioContext.h b/Source/modules/webaudio/AudioContext.h |
index d74b0cc089ea10bb9a9d6be7ac64e4a567f0d455..477c216bc1e7275ee8c2ea815deff84a83127737 100644 |
--- a/Source/modules/webaudio/AudioContext.h |
+++ b/Source/modules/webaudio/AudioContext.h |
@@ -124,7 +124,7 @@ public: |
AudioBuffer* createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionState&); |
// Asynchronous audio file data decoding. |
- void decodeAudioData(DOMArrayBuffer*, AudioBufferCallback*, AudioBufferCallback*, ExceptionState&); |
+ ScriptPromise decodeAudioData(ScriptState*, DOMArrayBuffer*, AudioBufferCallback*, AudioBufferCallback*, ExceptionState&); |
AudioListener* listener() { return m_listener.get(); } |
@@ -283,6 +283,7 @@ public: |
// Get the security origin for this audio context. |
SecurityOrigin* securityOrigin() const; |
+ void removeAudioDecoderResolver(ScriptPromiseResolver*); |
protected: |
explicit AudioContext(Document*); |
AudioContext(Document*, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate); |
@@ -417,6 +418,8 @@ private: |
void setContextState(AudioContextState); |
AsyncAudioDecoder m_audioDecoder; |
+ // A vector of the ScriptPromiseResolvers the decodeAudioData method uses. |
+ WillBeHeapVector<RefPtrWillBeMember<ScriptPromiseResolver>> m_audioDecoderResolvers; |
// Collection of nodes where the channel count mode has changed. We want the channel count mode |
// to change in the pre- or post-rendering phase so as not to disturb the running audio thread. |
@@ -429,6 +432,11 @@ private: |
// Follows the destination's currentSampleFrame, but might be slightly behind due to locking. |
size_t m_cachedSampleFrame; |
+ // When a context is closed, the sample rate is cleared. But decodeAudioData can be called |
+ // after the context has been closed and it needs the sample rate. When the context is closed, |
+ // the sample rate is saved here. |
+ float m_closedContextSampleRate; |
+ |
// Tries to handle AudioBufferSourceNodes that were started but became disconnected or was never |
// connected. Because these never get pulled anymore, they will stay around forever. So if we |
// can, try to stop them so they can be collected. |