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

Unified Diff: Source/modules/webaudio/AudioContext.h

Issue 1006963003: AudioContext.decodeAudioData returns a Promise (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update for review Created 5 years, 8 months 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
« no previous file with comments | « Source/modules/webaudio/AudioBufferCallback.idl ('k') | Source/modules/webaudio/AudioContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
// 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.
« no previous file with comments | « Source/modules/webaudio/AudioBufferCallback.idl ('k') | Source/modules/webaudio/AudioContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698