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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 } | 201 } |
| 202 | 202 |
| 203 // ---------------------------------------------------------------- | 203 // ---------------------------------------------------------------- |
| 204 | 204 |
| 205 MediaElementAudioSourceNode::MediaElementAudioSourceNode(AbstractAudioContext& c ontext, HTMLMediaElement& mediaElement) | 205 MediaElementAudioSourceNode::MediaElementAudioSourceNode(AbstractAudioContext& c ontext, HTMLMediaElement& mediaElement) |
| 206 : AudioSourceNode(context) | 206 : AudioSourceNode(context) |
| 207 { | 207 { |
| 208 setHandler(MediaElementAudioSourceHandler::create(*this, mediaElement)); | 208 setHandler(MediaElementAudioSourceHandler::create(*this, mediaElement)); |
| 209 } | 209 } |
| 210 | 210 |
| 211 MediaElementAudioSourceNode* MediaElementAudioSourceNode::create(AbstractAudioCo ntext& context, HTMLMediaElement& mediaElement) | 211 MediaElementAudioSourceNode* MediaElementAudioSourceNode::create( |
| 212 AbstractAudioContext& context, HTMLMediaElement& mediaElement, ExceptionStat e& exceptionState) | |
| 212 { | 213 { |
| 213 return new MediaElementAudioSourceNode(context, mediaElement); | 214 ASSERT(isMainThread()); |
|
hongchan
2016/05/13 01:20:12
DCHECK.
Raymond Toy
2016/05/20 23:12:00
Done.
| |
| 215 | |
| 216 if (context.isContextClosed()) { | |
| 217 context.throwExceptionForClosedState(exceptionState); | |
| 218 return nullptr; | |
| 219 } | |
| 220 | |
| 221 // First check if this media element already has a source node. | |
| 222 if (mediaElement.audioSourceNode()) { | |
| 223 exceptionState.throwDOMException( | |
| 224 InvalidStateError, | |
| 225 "HTMLMediaElement already connected previously to a different MediaE lementSourceNode."); | |
|
hongchan
2016/05/13 01:20:12
Over 80 cols. Might have to break this into multip
| |
| 226 return nullptr; | |
| 227 } | |
| 228 | |
| 229 MediaElementAudioSourceNode* node = new MediaElementAudioSourceNode(context, mediaElement); | |
| 230 | |
| 231 if (node) { | |
| 232 mediaElement.setAudioSourceNode(node); | |
| 233 // context keeps reference until node is disconnected | |
| 234 context.notifySourceNodeStartedProcessing(node); | |
| 235 } | |
| 236 | |
| 237 return node; | |
| 214 } | 238 } |
| 215 | 239 |
| 216 DEFINE_TRACE(MediaElementAudioSourceNode) | 240 DEFINE_TRACE(MediaElementAudioSourceNode) |
| 217 { | 241 { |
| 218 AudioSourceProviderClient::trace(visitor); | 242 AudioSourceProviderClient::trace(visitor); |
| 219 AudioSourceNode::trace(visitor); | 243 AudioSourceNode::trace(visitor); |
| 220 } | 244 } |
| 221 | 245 |
| 222 MediaElementAudioSourceHandler& MediaElementAudioSourceNode::mediaElementAudioSo urceHandler() const | 246 MediaElementAudioSourceHandler& MediaElementAudioSourceNode::mediaElementAudioSo urceHandler() const |
| 223 { | 247 { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 244 mediaElementAudioSourceHandler().lock(); | 268 mediaElementAudioSourceHandler().lock(); |
| 245 } | 269 } |
| 246 | 270 |
| 247 void MediaElementAudioSourceNode::unlock() | 271 void MediaElementAudioSourceNode::unlock() |
| 248 { | 272 { |
| 249 mediaElementAudioSourceHandler().unlock(); | 273 mediaElementAudioSourceHandler().unlock(); |
| 250 } | 274 } |
| 251 | 275 |
| 252 } // namespace blink | 276 } // namespace blink |
| 253 | 277 |
| OLD | NEW |