| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 327 |
| 328 m_virtualReadIndex = virtualReadIndex; | 328 m_virtualReadIndex = virtualReadIndex; |
| 329 | 329 |
| 330 return true; | 330 return true; |
| 331 } | 331 } |
| 332 | 332 |
| 333 | 333 |
| 334 void AudioBufferSourceNode::setBuffer(AudioBuffer* buffer, ExceptionState& excep
tionState) | 334 void AudioBufferSourceNode::setBuffer(AudioBuffer* buffer, ExceptionState& excep
tionState) |
| 335 { | 335 { |
| 336 ASSERT(isMainThread()); | 336 ASSERT(isMainThread()); |
| 337 // FIXME: It does not look like we should throw if the buffer is null as | |
| 338 // the attribute is nullable in the specification. | |
| 339 if (!buffer) { | |
| 340 exceptionState.throwTypeError("buffer cannot be null"); | |
| 341 return; | |
| 342 } | |
| 343 | 337 |
| 344 // The context must be locked since changing the buffer can re-configure the
number of channels that are output. | 338 // The context must be locked since changing the buffer can re-configure the
number of channels that are output. |
| 345 AudioContext::AutoLocker contextLocker(context()); | 339 AudioContext::AutoLocker contextLocker(context()); |
| 346 | 340 |
| 347 // This synchronizes with process(). | 341 // This synchronizes with process(). |
| 348 MutexLocker processLocker(m_processLock); | 342 MutexLocker processLocker(m_processLock); |
| 349 | 343 |
| 350 if (buffer) { | 344 if (buffer) { |
| 351 // Do any necesssary re-configuration to the buffer's number of channels
. | 345 // Do any necesssary re-configuration to the buffer's number of channels
. |
| 352 unsigned numberOfChannels = buffer->numberOfChannels(); | 346 unsigned numberOfChannels = buffer->numberOfChannels(); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 void AudioBufferSourceNode::finish() | 485 void AudioBufferSourceNode::finish() |
| 492 { | 486 { |
| 493 clearPannerNode(); | 487 clearPannerNode(); |
| 494 ASSERT(!m_pannerNode); | 488 ASSERT(!m_pannerNode); |
| 495 AudioScheduledSourceNode::finish(); | 489 AudioScheduledSourceNode::finish(); |
| 496 } | 490 } |
| 497 | 491 |
| 498 } // namespace WebCore | 492 } // namespace WebCore |
| 499 | 493 |
| 500 #endif // ENABLE(WEB_AUDIO) | 494 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |