Chromium Code Reviews| Index: Source/modules/webaudio/AudioContext.h |
| diff --git a/Source/modules/webaudio/AudioContext.h b/Source/modules/webaudio/AudioContext.h |
| index 6e17e01ef814888c23a2366325e40c5377f58e0b..cb7253dcb34279bed616e7243a1b3b0d6d988bd7 100644 |
| --- a/Source/modules/webaudio/AudioContext.h |
| +++ b/Source/modules/webaudio/AudioContext.h |
| @@ -237,7 +237,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(); } |
| @@ -348,6 +348,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); |
| @@ -434,6 +435,8 @@ private: |
| void setContextState(AudioContextState); |
| AsyncAudioDecoder m_audioDecoder; |
| + // A vector of the ScriptPromiseResolvers the decodeAudioData method uses. |
| + WillBeHeapVector<RefPtrWillBeMember<ScriptPromiseResolver>> m_audioDecoderResolvers; |
|
yhirano
2015/04/10 04:55:23
Is using WillBeHeapHashSet better?
Raymond Toy
2015/04/10 20:54:57
I was just following what was done for the suspend
|
| // The Promise that is returned by close(); |
| RefPtrWillBeMember<ScriptPromiseResolver> m_closeResolver; |
| @@ -441,6 +444,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. |