| 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 | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 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 "modules/webaudio/MediaElementAudioSourceNode.h" | 25 #include "modules/webaudio/MediaElementAudioSourceNode.h" | 
| 26 | 26 | 
| 27 #include "core/dom/ExecutionContextTask.h" | 27 #include "core/dom/ExecutionContextTask.h" | 
| 28 #include "core/html/HTMLMediaElement.h" | 28 #include "core/html/HTMLMediaElement.h" | 
| 29 #include "core/inspector/ConsoleMessage.h" | 29 #include "core/inspector/ConsoleMessage.h" | 
| 30 #include "modules/webaudio/AudioNodeOutput.h" | 30 #include "modules/webaudio/AudioNodeOutput.h" | 
| 31 #include "modules/webaudio/BaseAudioContext.h" | 31 #include "modules/webaudio/BaseAudioContext.h" | 
|  | 32 #include "modules/webaudio/MediaElementAudioSourceOptions.h" | 
| 32 #include "platform/audio/AudioUtilities.h" | 33 #include "platform/audio/AudioUtilities.h" | 
| 33 #include "platform/weborigin/SecurityOrigin.h" | 34 #include "platform/weborigin/SecurityOrigin.h" | 
| 34 #include "wtf/Locker.h" | 35 #include "wtf/Locker.h" | 
| 35 #include "wtf/PtrUtil.h" | 36 #include "wtf/PtrUtil.h" | 
| 36 | 37 | 
| 37 namespace blink { | 38 namespace blink { | 
| 38 | 39 | 
| 39 MediaElementAudioSourceHandler::MediaElementAudioSourceHandler(AudioNode& node, 
     HTMLMediaElement& mediaElement) | 40 MediaElementAudioSourceHandler::MediaElementAudioSourceHandler(AudioNode& node, 
     HTMLMediaElement& mediaElement) | 
| 40     : AudioHandler(NodeTypeMediaElementAudioSource, node, node.context()->sample
     Rate()) | 41     : AudioHandler(NodeTypeMediaElementAudioSource, node, node.context()->sample
     Rate()) | 
| 41     , m_mediaElement(mediaElement) | 42     , m_mediaElement(mediaElement) | 
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 228 | 229 | 
| 229     if (node) { | 230     if (node) { | 
| 230         mediaElement.setAudioSourceNode(node); | 231         mediaElement.setAudioSourceNode(node); | 
| 231         // context keeps reference until node is disconnected | 232         // context keeps reference until node is disconnected | 
| 232         context.notifySourceNodeStartedProcessing(node); | 233         context.notifySourceNodeStartedProcessing(node); | 
| 233     } | 234     } | 
| 234 | 235 | 
| 235     return node; | 236     return node; | 
| 236 } | 237 } | 
| 237 | 238 | 
|  | 239 MediaElementAudioSourceNode* MediaElementAudioSourceNode::create(BaseAudioContex
     t* context, const MediaElementAudioSourceOptions& options, ExceptionState& excep
     tionState) | 
|  | 240 { | 
|  | 241     if (!options.hasMediaElement()) { | 
|  | 242         exceptionState.throwDOMException( | 
|  | 243             NotFoundError, | 
|  | 244             "mediaElement member is required."); | 
|  | 245         return nullptr; | 
|  | 246     } | 
|  | 247 | 
|  | 248     return create(*context, *options.mediaElement(), exceptionState); | 
|  | 249 } | 
|  | 250 | 
| 238 DEFINE_TRACE(MediaElementAudioSourceNode) | 251 DEFINE_TRACE(MediaElementAudioSourceNode) | 
| 239 { | 252 { | 
| 240     AudioSourceProviderClient::trace(visitor); | 253     AudioSourceProviderClient::trace(visitor); | 
| 241     AudioSourceNode::trace(visitor); | 254     AudioSourceNode::trace(visitor); | 
| 242 } | 255 } | 
| 243 | 256 | 
| 244 MediaElementAudioSourceHandler& MediaElementAudioSourceNode::mediaElementAudioSo
     urceHandler() const | 257 MediaElementAudioSourceHandler& MediaElementAudioSourceNode::mediaElementAudioSo
     urceHandler() const | 
| 245 { | 258 { | 
| 246     return static_cast<MediaElementAudioSourceHandler&>(handler()); | 259     return static_cast<MediaElementAudioSourceHandler&>(handler()); | 
| 247 } | 260 } | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 266     mediaElementAudioSourceHandler().lock(); | 279     mediaElementAudioSourceHandler().lock(); | 
| 267 } | 280 } | 
| 268 | 281 | 
| 269 void MediaElementAudioSourceNode::unlock() | 282 void MediaElementAudioSourceNode::unlock() | 
| 270 { | 283 { | 
| 271     mediaElementAudioSourceHandler().unlock(); | 284     mediaElementAudioSourceHandler().unlock(); | 
| 272 } | 285 } | 
| 273 | 286 | 
| 274 } // namespace blink | 287 } // namespace blink | 
| 275 | 288 | 
| OLD | NEW | 
|---|