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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 | 92 |
93 OfflineAudioContext::OfflineAudioContext(Document* document, unsigned numberOfCh annels, size_t numberOfFrames, float sampleRate) | 93 OfflineAudioContext::OfflineAudioContext(Document* document, unsigned numberOfCh annels, size_t numberOfFrames, float sampleRate) |
94 : AudioContext(document, numberOfChannels, numberOfFrames, sampleRate) | 94 : AudioContext(document, numberOfChannels, numberOfFrames, sampleRate) |
95 { | 95 { |
96 } | 96 } |
97 | 97 |
98 OfflineAudioContext::~OfflineAudioContext() | 98 OfflineAudioContext::~OfflineAudioContext() |
99 { | 99 { |
100 } | 100 } |
101 | 101 |
102 ScriptPromise OfflineAudioContext::startOfflineRendering(ScriptState* scriptStat e) | 102 ScriptPromise OfflineAudioContext::startOfflineRendering(ScriptState* scriptStat e, ExceptionState& exceptionState) |
Raymond Toy
2015/04/29 15:54:42
Why is exceptionState needed here? It doesn't seem
| |
103 { | 103 { |
104 // Calling close() on an OfflineAudioContext is not supported/allowed, | |
105 // but it might well have been stopped by its execution context. | |
106 if (isContextClosed()) { | |
107 return ScriptPromise::rejectWithDOMException( | |
108 scriptState, | |
109 DOMException::create( | |
110 InvalidStateError, | |
111 "cannot call startRendering on an OfflineAudioContext in a stopp ed state.")); | |
112 } | |
113 | |
104 if (m_offlineResolver) { | 114 if (m_offlineResolver) { |
105 // Can't call startRendering more than once. Return a rejected promise now. | 115 // Can't call startRendering more than once. Return a rejected promise now. |
106 return ScriptPromise::rejectWithDOMException( | 116 return ScriptPromise::rejectWithDOMException( |
107 scriptState, | 117 scriptState, |
108 DOMException::create( | 118 DOMException::create( |
109 InvalidStateError, | 119 InvalidStateError, |
110 "cannot call startRendering more than once")); | 120 "cannot call startRendering more than once")); |
111 } | 121 } |
112 | 122 |
113 m_offlineResolver = ScriptPromiseResolver::create(scriptState); | 123 m_offlineResolver = ScriptPromiseResolver::create(scriptState); |
114 startRendering(); | 124 startRendering(); |
115 return m_offlineResolver->promise(); | 125 return m_offlineResolver->promise(); |
116 } | 126 } |
117 | 127 |
118 } // namespace blink | 128 } // namespace blink |
119 | 129 |
120 #endif // ENABLE(WEB_AUDIO) | 130 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |