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

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

Issue 625363004: Implement suspend/resume for AudioContext (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | « no previous file | Source/modules/webaudio/AudioContext.cpp » ('j') | Source/modules/webaudio/AudioContext.cpp » ('J')
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 3377ce6497d2fc0b3bc80a36a085a82d99a24942..dda904f2b7a84daa3f33c740bad5151d800a934f 100644
--- a/Source/modules/webaudio/AudioContext.h
+++ b/Source/modules/webaudio/AudioContext.h
@@ -25,6 +25,8 @@
#ifndef AudioContext_h
#define AudioContext_h
+#include "bindings/core/v8/ScriptPromise.h"
+#include "bindings/core/v8/ScriptPromiseResolver.h"
#include "core/dom/ActiveDOMObject.h"
#include "core/events/EventListener.h"
#include "modules/EventTargetModules.h"
@@ -128,6 +130,10 @@ public:
OscillatorNode* createOscillator();
PeriodicWave* createPeriodicWave(Float32Array* real, Float32Array* imag, ExceptionState&);
+ // Pause/Resume
+ void suspendContext();
+ ScriptPromise resumeContext(ScriptState*);
+
// When a source node has no more processing to do (has finished playing), then it tells the context to dereference it.
void notifyNodeFinishedProcessing(AudioNode*);
@@ -166,6 +172,9 @@ public:
unsigned connectionCount() const { return m_connectionCount; }
+ void resolvePromisesForResume();
+ void resolvePromisesForResumeOnMainThread();
yhirano 2014/10/08 01:12:14 These function can be private.
+
//
// Thread Safety and Graph Locking:
//
@@ -274,6 +283,13 @@ private:
// AudioNode::breakConnection() when we remove an AudioNode from this.
HeapVector<Member<AudioNode> > m_referencedNodes;
+ GC_PLUGIN_IGNORE("http://crbug.com/404527")
+ Vector<RefPtr<ScriptPromiseResolver> > m_resumePromises;
+ // True if we're in the process of resolving promises for resume(). Resolving can take some
+ // time and the audio context process loop is very fast, so we don't want to call resolve an
+ // excessive number of times.
+ bool m_isResolvingResumePromises;
+
class AudioNodeDisposer {
public:
explicit AudioNodeDisposer(AudioNode& node) : m_node(node) { }
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioContext.cpp » ('j') | Source/modules/webaudio/AudioContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698