| Index: Source/modules/webaudio/AudioContext.cpp
|
| diff --git a/Source/modules/webaudio/AudioContext.cpp b/Source/modules/webaudio/AudioContext.cpp
|
| index e92fae7bc331226efa5a5c1436b738bfd4a1752e..6dfaf19110190531c53355ed8f5d4312b2b3eca8 100644
|
| --- a/Source/modules/webaudio/AudioContext.cpp
|
| +++ b/Source/modules/webaudio/AudioContext.cpp
|
| @@ -77,6 +77,29 @@ DEFINE_TRACE(AudioContext)
|
| AbstractAudioContext::trace(visitor);
|
| }
|
|
|
| +ScriptPromise AudioContext::closeContext(ScriptState* scriptState)
|
| +{
|
| + if (isContextClosed()) {
|
| + // We've already closed the context previously, but it hasn't yet been resolved, so just
|
| + // create a new promise and reject it.
|
| + return ScriptPromise::rejectWithDOMException(
|
| + scriptState,
|
| + DOMException::create(InvalidStateError,
|
| + "Cannot close a context that is being closed or has already been closed."));
|
| + }
|
| +
|
| + m_closeResolver = ScriptPromiseResolver::create(scriptState);
|
| + ScriptPromise promise = m_closeResolver->promise();
|
| +
|
| + // Stop the audio context. This will stop the destination node from pulling audio anymore. And
|
| + // since we have disconnected the destination from the audio graph, and thus has no references,
|
| + // the destination node can GCed if JS has no references. uninitialize() will also resolve the Promise
|
| + // created here.
|
| + uninitialize();
|
| +
|
| + return promise;
|
| +}
|
| +
|
| ScriptPromise AudioContext::suspendContext(ScriptState* scriptState)
|
| {
|
| ASSERT(isMainThread());
|
| @@ -101,6 +124,11 @@ ScriptPromise AudioContext::suspendContext(ScriptState* scriptState)
|
| return promise;
|
| }
|
|
|
| +ScriptPromise AudioContext::suspendContext(ScriptState* scriptState, double suspendTime)
|
| +{
|
| + ASSERT_NOT_REACHED();
|
| +}
|
| +
|
| ScriptPromise AudioContext::resumeContext(ScriptState* scriptState)
|
| {
|
| ASSERT(isMainThread());
|
| @@ -123,36 +151,13 @@ ScriptPromise AudioContext::resumeContext(ScriptState* scriptState)
|
| // Save the resolver which will get resolved when the destination node starts pulling on the
|
| // graph again.
|
| {
|
| - AutoLocker locker(this);
|
| + AutoLocker(this);
|
| m_resumeResolvers.append(resolver);
|
| }
|
|
|
| return promise;
|
| }
|
|
|
| -ScriptPromise AudioContext::closeContext(ScriptState* scriptState)
|
| -{
|
| - if (isContextClosed()) {
|
| - // We've already closed the context previously, but it hasn't yet been resolved, so just
|
| - // create a new promise and reject it.
|
| - return ScriptPromise::rejectWithDOMException(
|
| - scriptState,
|
| - DOMException::create(InvalidStateError,
|
| - "Cannot close a context that is being closed or has already been closed."));
|
| - }
|
| -
|
| - m_closeResolver = ScriptPromiseResolver::create(scriptState);
|
| - ScriptPromise promise = m_closeResolver->promise();
|
| -
|
| - // Stop the audio context. This will stop the destination node from pulling audio anymore. And
|
| - // since we have disconnected the destination from the audio graph, and thus has no references,
|
| - // the destination node can GCed if JS has no references. uninitialize() will also resolve the Promise
|
| - // created here.
|
| - uninitialize();
|
| -
|
| - return promise;
|
| -}
|
| -
|
| void AudioContext::didClose()
|
| {
|
| // This is specific to AudioContexts. OfflineAudioContexts
|
|
|