| 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 "modules/webaudio/AudioContext.h" | 5 #include "modules/webaudio/AudioContext.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionMessages.h" | 7 #include "bindings/core/v8/ExceptionMessages.h" |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 DCHECK(isMainThread()); | 129 DCHECK(isMainThread()); |
| 130 | 130 |
| 131 if (isContextClosed()) { | 131 if (isContextClosed()) { |
| 132 return ScriptPromise::rejectWithDOMException( | 132 return ScriptPromise::rejectWithDOMException( |
| 133 scriptState, | 133 scriptState, |
| 134 DOMException::create( | 134 DOMException::create( |
| 135 InvalidAccessError, | 135 InvalidAccessError, |
| 136 "cannot resume a closed AudioContext")); | 136 "cannot resume a closed AudioContext")); |
| 137 } | 137 } |
| 138 | 138 |
| 139 recordUserGestureState(); | |
| 140 | |
| 141 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; | 139 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
| 142 ScriptPromise promise = resolver->promise(); | 140 ScriptPromise promise = resolver->promise(); |
| 143 | 141 |
| 144 // Restart the destination node to pull on the audio graph. | 142 // Restart the destination node to pull on the audio graph. |
| 145 if (destination()) | 143 if (destination()) |
| 146 startRendering(); | 144 startRendering(); |
| 147 | 145 |
| 148 // Save the resolver which will get resolved when the destination node start
s pulling on the | 146 // Save the resolver which will get resolved when the destination node start
s pulling on the |
| 149 // graph again. | 147 // graph again. |
| 150 { | 148 { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 DCHECK(destination()); | 203 DCHECK(destination()); |
| 206 | 204 |
| 207 if (contextState() == Running) { | 205 if (contextState() == Running) { |
| 208 destination()->audioDestinationHandler().stopRendering(); | 206 destination()->audioDestinationHandler().stopRendering(); |
| 209 setContextState(Suspended); | 207 setContextState(Suspended); |
| 210 deferredTaskHandler().clearHandlersToBeDeleted(); | 208 deferredTaskHandler().clearHandlersToBeDeleted(); |
| 211 } | 209 } |
| 212 } | 210 } |
| 213 | 211 |
| 214 } // namespace blink | 212 } // namespace blink |
| OLD | NEW |