Index: Source/modules/webaudio/OfflineAudioContext.h |
diff --git a/Source/modules/webaudio/OfflineAudioContext.h b/Source/modules/webaudio/OfflineAudioContext.h |
index 99276e7cbb5e19dc7edf2934b67a726f2eed8d2a..0d823ee2e21151b095784c5a51720a7a75d4414e 100644 |
--- a/Source/modules/webaudio/OfflineAudioContext.h |
+++ b/Source/modules/webaudio/OfflineAudioContext.h |
@@ -36,12 +36,43 @@ class MODULES_EXPORT OfflineAudioContext final : public AudioContext { |
DEFINE_WRAPPERTYPEINFO(); |
public: |
static OfflineAudioContext* create(ExecutionContext*, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionState&); |
- |
virtual ~OfflineAudioContext(); |
+ virtual bool suspendIfNecessary(); |
+ bool isSuspendScheduled() const; |
+ |
ScriptPromise startOfflineRendering(ScriptState*); |
+ ScriptPromise suspendOfflineRendering(ScriptState*, double suspendTime); |
+ ScriptPromise resumeOfflineRendering(ScriptState*); |
+ |
private: |
OfflineAudioContext(Document*, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate); |
+ |
+ // A container class for pairs of time information and suspend promise. |
+ class ScheduledSuspendContainer : public NoBaseWillBeGarbageCollected<ScheduledSuspendContainer> { |
+ public: |
+ static PassOwnPtr<ScheduledSuspendContainer> create(double, PassRefPtrWillBeRawPtr<ScriptPromiseResolver>); |
+ ~ScheduledSuspendContainer(); |
+ PassRefPtrWillBeRawPtr<ScriptPromiseResolver> resolver() { return m_resolver; } |
+ bool shouldBeSuspendedNow(double currentTime) const; |
Raymond Toy
2015/05/19 22:04:45
Add comment on what this is supposed to do.
hongchan
2015/05/20 22:09:41
Done.
|
+ |
+ DECLARE_TRACE(); |
+ |
+ private: |
+ ScheduledSuspendContainer(double, PassRefPtrWillBeRawPtr<ScriptPromiseResolver>); |
+ |
+ double m_when; |
+ RefPtrWillBeMember<ScriptPromiseResolver> m_resolver; |
+ }; |
+ |
+ void suspendAndResolveOnMainThread(unsigned); |
+ |
+ // Unlike the design of real-time audio context, we keep suspend/resume |
Raymond Toy
2015/05/19 22:04:45
This comment is wrong now since we're not using ju
|
+ // promises in separate two vectors. This is because suspend() accompanies |
+ // the timing information whereas resume() resolves when it is actually |
+ // called. |
+ WillBeHeapVector<OwnPtrWillBeMember<ScheduledSuspendContainer>> m_scheduledSuspends; |
+ WillBeHeapVector<RefPtrWillBeMember<ScriptPromiseResolver>> m_resumeResolvers; |
}; |
} // namespace blink |