OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND |
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
16 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE | 16 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE |
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | 19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
20 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 20 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
23 * DAMAGE. | 23 * DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "modules/webaudio/MediaElementAudioSourceNode.h" | 26 #include "modules/webaudio/MediaElementAudioSourceNode.h" |
27 | 27 |
28 #include "core/dom/ExecutionContextTask.h" | 28 #include "core/dom/ExecutionContextTask.h" |
| 29 #include "core/dom/TaskRunnerHelper.h" |
29 #include "core/html/HTMLMediaElement.h" | 30 #include "core/html/HTMLMediaElement.h" |
30 #include "core/inspector/ConsoleMessage.h" | 31 #include "core/inspector/ConsoleMessage.h" |
31 #include "modules/webaudio/AudioNodeOutput.h" | 32 #include "modules/webaudio/AudioNodeOutput.h" |
32 #include "modules/webaudio/BaseAudioContext.h" | 33 #include "modules/webaudio/BaseAudioContext.h" |
33 #include "modules/webaudio/MediaElementAudioSourceOptions.h" | 34 #include "modules/webaudio/MediaElementAudioSourceOptions.h" |
34 #include "platform/audio/AudioUtilities.h" | 35 #include "platform/audio/AudioUtilities.h" |
35 #include "platform/weborigin/SecurityOrigin.h" | 36 #include "platform/weborigin/SecurityOrigin.h" |
36 #include "wtf/Locker.h" | 37 #include "wtf/Locker.h" |
37 #include "wtf/PtrUtil.h" | 38 #include "wtf/PtrUtil.h" |
38 | 39 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 provider.provideInput(outputBus, numberOfFrames); | 186 provider.provideInput(outputBus, numberOfFrames); |
186 } | 187 } |
187 // Output silence if we don't have access to the element. | 188 // Output silence if we don't have access to the element. |
188 if (!passesCORSAccessCheck()) { | 189 if (!passesCORSAccessCheck()) { |
189 if (m_maybePrintCORSMessage) { | 190 if (m_maybePrintCORSMessage) { |
190 // Print a CORS message, but just once for each change in the current | 191 // Print a CORS message, but just once for each change in the current |
191 // media element source, and only if we have a document to print to. | 192 // media element source, and only if we have a document to print to. |
192 m_maybePrintCORSMessage = false; | 193 m_maybePrintCORSMessage = false; |
193 if (context()->getExecutionContext()) { | 194 if (context()->getExecutionContext()) { |
194 context()->getExecutionContext()->postTask( | 195 context()->getExecutionContext()->postTask( |
195 BLINK_FROM_HERE, | 196 TaskType::MediaElementEvent, BLINK_FROM_HERE, |
196 createCrossThreadTask( | 197 createCrossThreadTask( |
197 &MediaElementAudioSourceHandler::printCORSMessage, | 198 &MediaElementAudioSourceHandler::printCORSMessage, |
198 PassRefPtr<MediaElementAudioSourceHandler>(this), | 199 PassRefPtr<MediaElementAudioSourceHandler>(this), |
199 m_currentSrcString)); | 200 m_currentSrcString)); |
200 } | 201 } |
201 } | 202 } |
202 outputBus->zero(); | 203 outputBus->zero(); |
203 } | 204 } |
204 } else { | 205 } else { |
205 // We failed to acquire the lock. | 206 // We failed to acquire the lock. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 295 |
295 void MediaElementAudioSourceNode::lock() { | 296 void MediaElementAudioSourceNode::lock() { |
296 mediaElementAudioSourceHandler().lock(); | 297 mediaElementAudioSourceHandler().lock(); |
297 } | 298 } |
298 | 299 |
299 void MediaElementAudioSourceNode::unlock() { | 300 void MediaElementAudioSourceNode::unlock() { |
300 mediaElementAudioSourceHandler().unlock(); | 301 mediaElementAudioSourceHandler().unlock(); |
301 } | 302 } |
302 | 303 |
303 } // namespace blink | 304 } // namespace blink |
OLD | NEW |