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 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 } | 134 } |
| 135 | 135 |
| 136 bool MediaElementAudioSourceHandler::passesCurrentSrcCORSAccessCheck(const KURL& currentSrc) | 136 bool MediaElementAudioSourceHandler::passesCurrentSrcCORSAccessCheck(const KURL& currentSrc) |
| 137 { | 137 { |
| 138 ASSERT(isMainThread()); | 138 ASSERT(isMainThread()); |
| 139 return context()->securityOrigin() && context()->securityOrigin()->canReques t(currentSrc); | 139 return context()->securityOrigin() && context()->securityOrigin()->canReques t(currentSrc); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void MediaElementAudioSourceHandler::printCORSMessage(const String& message) | 142 void MediaElementAudioSourceHandler::printCORSMessage(const String& message) |
| 143 { | 143 { |
| 144 context()->executionContext()->addConsoleMessage( | 144 if (context()->executionContext()) { |
|
hongchan
2015/06/16 16:12:10
What happens if executionContext() does not exist?
| |
| 145 ConsoleMessage::create(SecurityMessageSource, InfoMessageLevel, | 145 context()->executionContext()->addConsoleMessage( |
| 146 "MediaElementAudioSource outputs zeroes due to CORS access restricti ons for " + message)); | 146 ConsoleMessage::create(SecurityMessageSource, InfoMessageLevel, |
| 147 "MediaElementAudioSource outputs zeroes due to CORS access restr ictions for " + message)); | |
| 148 } | |
| 147 } | 149 } |
| 148 | 150 |
| 149 void MediaElementAudioSourceHandler::process(size_t numberOfFrames) | 151 void MediaElementAudioSourceHandler::process(size_t numberOfFrames) |
| 150 { | 152 { |
| 151 AudioBus* outputBus = output(0).bus(); | 153 AudioBus* outputBus = output(0).bus(); |
| 152 | 154 |
| 153 if (!mediaElement() || !m_sourceNumberOfChannels || !m_sourceSampleRate) { | 155 if (!mediaElement() || !m_sourceNumberOfChannels || !m_sourceSampleRate) { |
| 154 outputBus->zero(); | 156 outputBus->zero(); |
| 155 return; | 157 return; |
| 156 } | 158 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 } | 252 } |
| 251 | 253 |
| 252 void MediaElementAudioSourceNode::unlock() | 254 void MediaElementAudioSourceNode::unlock() |
| 253 { | 255 { |
| 254 mediaElementAudioSourceHandler().unlock(); | 256 mediaElementAudioSourceHandler().unlock(); |
| 255 } | 257 } |
| 256 | 258 |
| 257 } // namespace blink | 259 } // namespace blink |
| 258 | 260 |
| 259 #endif // ENABLE(WEB_AUDIO) | 261 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |