Chromium Code Reviews| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 resolver->resolve(); | 109 resolver->resolve(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 return promise; | 112 return promise; |
| 113 } | 113 } |
| 114 | 114 |
| 115 ScriptPromise AudioContext::resumeContext(ScriptState* scriptState) | 115 ScriptPromise AudioContext::resumeContext(ScriptState* scriptState) |
| 116 { | 116 { |
| 117 ASSERT(isMainThread()); | 117 ASSERT(isMainThread()); |
| 118 | 118 |
| 119 recordUserGesture(); | |
|
Raymond Toy
2016/06/03 17:57:52
I think you probably want to do this around line 1
mlamouri (slow - plz ping)
2016/06/05 14:44:57
Done.
| |
| 120 | |
| 119 if (isContextClosed()) { | 121 if (isContextClosed()) { |
| 120 return ScriptPromise::rejectWithDOMException( | 122 return ScriptPromise::rejectWithDOMException( |
| 121 scriptState, | 123 scriptState, |
| 122 DOMException::create( | 124 DOMException::create( |
| 123 InvalidAccessError, | 125 InvalidAccessError, |
| 124 "cannot resume a closed AudioContext")); | 126 "cannot resume a closed AudioContext")); |
| 125 } | 127 } |
| 126 | 128 |
| 127 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; | 129 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; |
| 128 ScriptPromise promise = resolver->promise(); | 130 ScriptPromise promise = resolver->promise(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 ASSERT(destination()); | 193 ASSERT(destination()); |
| 192 | 194 |
| 193 if (contextState() == Running) { | 195 if (contextState() == Running) { |
| 194 destination()->audioDestinationHandler().stopRendering(); | 196 destination()->audioDestinationHandler().stopRendering(); |
| 195 setContextState(Suspended); | 197 setContextState(Suspended); |
| 196 deferredTaskHandler().clearHandlersToBeDeleted(); | 198 deferredTaskHandler().clearHandlersToBeDeleted(); |
| 197 } | 199 } |
| 198 } | 200 } |
| 199 | 201 |
| 200 } // namespace blink | 202 } // namespace blink |
| 201 | |
| OLD | NEW |