| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "modules/webaudio/AudioContext.h" | 6 #include "modules/webaudio/AudioContext.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ExceptionMessages.h" | 8 #include "bindings/core/v8/ExceptionMessages.h" |
| 9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
| 10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // Save the resolver which will get resolved when the destination node start
s pulling on the | 123 // Save the resolver which will get resolved when the destination node start
s pulling on the |
| 124 // graph again. | 124 // graph again. |
| 125 { | 125 { |
| 126 AutoLocker locker(this); | 126 AutoLocker locker(this); |
| 127 m_resumeResolvers.append(resolver); | 127 m_resumeResolvers.append(resolver); |
| 128 } | 128 } |
| 129 | 129 |
| 130 return promise; | 130 return promise; |
| 131 } | 131 } |
| 132 | 132 |
| 133 ScriptPromise AudioContext::suspendContext(ScriptState* scriptState, double susp
endTime) |
| 134 { |
| 135 // This CANNOT be called on AudioContext; it is to implement the pure |
| 136 // virtual interface from AbstractAudioContext. |
| 137 RELEASE_ASSERT_NOT_REACHED(); |
| 138 |
| 139 return ScriptPromise::rejectWithDOMException( |
| 140 scriptState, |
| 141 DOMException::create(InvalidStateError, |
| 142 "Only offline audio context can be suspended at the specified time."
)); |
| 143 } |
| 144 |
| 133 ScriptPromise AudioContext::closeContext(ScriptState* scriptState) | 145 ScriptPromise AudioContext::closeContext(ScriptState* scriptState) |
| 134 { | 146 { |
| 135 if (isContextClosed()) { | 147 if (isContextClosed()) { |
| 136 // We've already closed the context previously, but it hasn't yet been r
esolved, so just | 148 // We've already closed the context previously, but it hasn't yet been r
esolved, so just |
| 137 // create a new promise and reject it. | 149 // create a new promise and reject it. |
| 138 return ScriptPromise::rejectWithDOMException( | 150 return ScriptPromise::rejectWithDOMException( |
| 139 scriptState, | 151 scriptState, |
| 140 DOMException::create(InvalidStateError, | 152 DOMException::create(InvalidStateError, |
| 141 "Cannot close a context that is being closed or has already been
closed.")); | 153 "Cannot close a context that is being closed or has already been
closed.")); |
| 142 } | 154 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 if (contextState() == Running) { | 191 if (contextState() == Running) { |
| 180 destination()->audioDestinationHandler().stopRendering(); | 192 destination()->audioDestinationHandler().stopRendering(); |
| 181 setContextState(Suspended); | 193 setContextState(Suspended); |
| 182 deferredTaskHandler().clearHandlersToBeDeleted(); | 194 deferredTaskHandler().clearHandlersToBeDeleted(); |
| 183 } | 195 } |
| 184 } | 196 } |
| 185 | 197 |
| 186 } // namespace blink | 198 } // namespace blink |
| 187 | 199 |
| 188 #endif // ENABLE(WEB_AUDIO) | 200 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |