OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 10 matching lines...) Expand all Loading... |
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 */ | 23 */ |
24 | 24 |
25 #include "config.h" | 25 #include "config.h" |
26 #if ENABLE(WEB_AUDIO) | 26 #if ENABLE(WEB_AUDIO) |
27 #include "modules/webaudio/OfflineAudioContext.h" | 27 #include "modules/webaudio/OfflineAudioContext.h" |
28 | 28 |
29 #include "bindings/core/v8/ExceptionMessages.h" | 29 #include "bindings/core/v8/ExceptionMessages.h" |
30 #include "bindings/core/v8/ExceptionState.h" | 30 #include "bindings/core/v8/ExceptionState.h" |
| 31 #include "bindings/core/v8/ScriptState.h" |
31 #include "core/dom/Document.h" | 32 #include "core/dom/Document.h" |
32 #include "core/dom/ExceptionCode.h" | 33 #include "core/dom/ExceptionCode.h" |
33 #include "core/dom/ExecutionContext.h" | 34 #include "core/dom/ExecutionContext.h" |
34 #include "platform/audio/AudioUtilities.h" | 35 #include "platform/audio/AudioUtilities.h" |
35 | 36 |
36 namespace blink { | 37 namespace blink { |
37 | 38 |
38 OfflineAudioContext* OfflineAudioContext::create(ExecutionContext* context, unsi
gned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionState&
exceptionState) | 39 OfflineAudioContext* OfflineAudioContext::create(ExecutionContext* context, unsi
gned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionState&
exceptionState) |
39 { | 40 { |
40 // FIXME: add support for workers. | 41 // FIXME: add support for workers. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 DOMException::create( | 119 DOMException::create( |
119 InvalidStateError, | 120 InvalidStateError, |
120 "cannot call startRendering more than once")); | 121 "cannot call startRendering more than once")); |
121 } | 122 } |
122 | 123 |
123 m_offlineResolver = ScriptPromiseResolver::create(scriptState); | 124 m_offlineResolver = ScriptPromiseResolver::create(scriptState); |
124 startRendering(); | 125 startRendering(); |
125 return m_offlineResolver->promise(); | 126 return m_offlineResolver->promise(); |
126 } | 127 } |
127 | 128 |
| 129 ScriptPromise OfflineAudioContext::closeContext(ScriptState* scriptState) |
| 130 { |
| 131 return ScriptPromise::rejectWithDOMException( |
| 132 scriptState, |
| 133 DOMException::create(InvalidAccessError, "cannot close an OfflineAudioCo
ntext.")); |
| 134 } |
| 135 |
| 136 ScriptPromise OfflineAudioContext::suspendContext(ScriptState* scriptState) |
| 137 { |
| 138 return ScriptPromise::rejectWithDOMException( |
| 139 scriptState, |
| 140 DOMException::create( |
| 141 InvalidAccessError, |
| 142 "cannot suspend an OfflineAudioContext")); |
| 143 } |
| 144 |
| 145 ScriptPromise OfflineAudioContext::resumeContext(ScriptState* scriptState) |
| 146 { |
| 147 return ScriptPromise::rejectWithDOMException( |
| 148 scriptState, |
| 149 DOMException::create( |
| 150 InvalidAccessError, |
| 151 "cannot resume an OfflineAudioContext")); |
| 152 } |
| 153 |
128 } // namespace blink | 154 } // namespace blink |
129 | 155 |
130 #endif // ENABLE(WEB_AUDIO) | 156 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |