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

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

Issue 1140723003: Implement suspend() and resume() for OfflineAudioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Bring to ToT Created 5 years, 5 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
Index: Source/modules/webaudio/AudioContext.h
diff --git a/Source/modules/webaudio/AudioContext.h b/Source/modules/webaudio/AudioContext.h
index 092eece9ac5f427e7bf33a1913c3ae1f5dd9c4b4..eb12bf450fad7e8a0476f6b215b18262d8bb72ca 100644
--- a/Source/modules/webaudio/AudioContext.h
+++ b/Source/modules/webaudio/AudioContext.h
@@ -219,11 +219,9 @@ public:
virtual const AtomicString& interfaceName() const override final;
virtual ExecutionContext* executionContext() const override final;
- DEFINE_ATTRIBUTE_EVENT_LISTENER(complete);
DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange);
void startRendering();
- void fireCompletionEvent();
void notifyStateChange();
// A context is considered closed if:
@@ -238,11 +236,19 @@ public:
// Get the security origin for this audio context.
SecurityOrigin* securityOrigin() const;
+ // TODO: Refactoring needed. These are OfflineAudioContext-specific tasks.
+ virtual void fireCompletionEvent();
+ virtual bool shouldSuspendNow();
+ virtual void resolvePendingSuspendPromises();
+ AudioBuffer* renderTarget() const { return m_renderTarget.get(); }
+
protected:
explicit AudioContext(Document*);
AudioContext(Document*, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate);
- RefPtrWillBeMember<ScriptPromiseResolver> m_offlineResolver;
+ // Shared with OfflineAudioContext.
+ void setContextState(AudioContextState);
+
private:
void initialize();
void uninitialize();
@@ -307,7 +313,6 @@ private:
// The state of the AudioContext.
AudioContextState m_contextState;
- void setContextState(AudioContextState);
AsyncAudioDecoder m_audioDecoder;
@@ -319,6 +324,9 @@ private:
// can, try to stop them so they can be collected.
void handleStoppableSourceNodes();
+ // Perform common tasks after the render quantum. Called by handlePostRenderTasks().
+ void performPostRenderTasks();
+
// This is considering 32 is large enough for multiple channels audio.
// It is somewhat arbitrary and could be increased if necessary.
enum { MaxNumberOfChannels = 32 };

Powered by Google App Engine
This is Rietveld 408576698