Chromium Code Reviews| 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" | |
| 29 #include "core/dom/TaskRunnerHelper.h" | 28 #include "core/dom/TaskRunnerHelper.h" |
| 30 #include "core/html/HTMLMediaElement.h" | 29 #include "core/html/HTMLMediaElement.h" |
| 31 #include "core/inspector/ConsoleMessage.h" | 30 #include "core/inspector/ConsoleMessage.h" |
| 32 #include "modules/webaudio/AudioNodeOutput.h" | 31 #include "modules/webaudio/AudioNodeOutput.h" |
| 33 #include "modules/webaudio/BaseAudioContext.h" | 32 #include "modules/webaudio/BaseAudioContext.h" |
| 34 #include "modules/webaudio/MediaElementAudioSourceOptions.h" | 33 #include "modules/webaudio/MediaElementAudioSourceOptions.h" |
| 34 #include "platform/CrossThreadFunctional.h" | |
| 35 #include "platform/audio/AudioUtilities.h" | 35 #include "platform/audio/AudioUtilities.h" |
| 36 #include "platform/weborigin/SecurityOrigin.h" | 36 #include "platform/weborigin/SecurityOrigin.h" |
| 37 #include "wtf/Locker.h" | 37 #include "wtf/Locker.h" |
| 38 #include "wtf/PtrUtil.h" | 38 #include "wtf/PtrUtil.h" |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 MediaElementAudioSourceHandler::MediaElementAudioSourceHandler( | 42 MediaElementAudioSourceHandler::MediaElementAudioSourceHandler( |
| 43 AudioNode& node, | 43 AudioNode& node, |
| 44 HTMLMediaElement& mediaElement) | 44 HTMLMediaElement& mediaElement) |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 DCHECK_EQ(m_sourceSampleRate, context()->sampleRate()); | 189 DCHECK_EQ(m_sourceSampleRate, context()->sampleRate()); |
| 190 provider.provideInput(outputBus, numberOfFrames); | 190 provider.provideInput(outputBus, numberOfFrames); |
| 191 } | 191 } |
| 192 // Output silence if we don't have access to the element. | 192 // Output silence if we don't have access to the element. |
| 193 if (!passesCORSAccessCheck()) { | 193 if (!passesCORSAccessCheck()) { |
| 194 if (m_maybePrintCORSMessage) { | 194 if (m_maybePrintCORSMessage) { |
| 195 // Print a CORS message, but just once for each change in the current | 195 // Print a CORS message, but just once for each change in the current |
| 196 // media element source, and only if we have a document to print to. | 196 // media element source, and only if we have a document to print to. |
| 197 m_maybePrintCORSMessage = false; | 197 m_maybePrintCORSMessage = false; |
| 198 if (context()->getExecutionContext()) { | 198 if (context()->getExecutionContext()) { |
| 199 context()->getExecutionContext()->postTask( | 199 TaskRunnerHelper::get(TaskType::MediaElementEvent, |
| 200 TaskType::MediaElementEvent, BLINK_FROM_HERE, | 200 context()->getExecutionContext()) |
| 201 createCrossThreadTask( | 201 ->postTask(BLINK_FROM_HERE, |
| 202 &MediaElementAudioSourceHandler::printCORSMessage, | 202 crossThreadBind( |
| 203 PassRefPtr<MediaElementAudioSourceHandler>(this), | 203 &MediaElementAudioSourceHandler::printCORSMessage, |
| 204 m_currentSrcString)); | 204 RefPtr<MediaElementAudioSourceHandler>(this), |
|
tzik
2017/03/10 00:15:43
wrapPassRefPtr?
yuryu
2017/03/10 07:49:32
Done.
| |
| 205 m_currentSrcString)); | |
| 205 } | 206 } |
| 206 } | 207 } |
| 207 outputBus->zero(); | 208 outputBus->zero(); |
| 208 } | 209 } |
| 209 } else { | 210 } else { |
| 210 // We failed to acquire the lock. | 211 // We failed to acquire the lock. |
| 211 outputBus->zero(); | 212 outputBus->zero(); |
| 212 } | 213 } |
| 213 } | 214 } |
| 214 | 215 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 | 300 |
| 300 void MediaElementAudioSourceNode::lock() { | 301 void MediaElementAudioSourceNode::lock() { |
| 301 mediaElementAudioSourceHandler().lock(); | 302 mediaElementAudioSourceHandler().lock(); |
| 302 } | 303 } |
| 303 | 304 |
| 304 void MediaElementAudioSourceNode::unlock() { | 305 void MediaElementAudioSourceNode::unlock() { |
| 305 mediaElementAudioSourceHandler().unlock(); | 306 mediaElementAudioSourceHandler().unlock(); |
| 306 } | 307 } |
| 307 | 308 |
| 308 } // namespace blink | 309 } // namespace blink |
| OLD | NEW |