Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: Source/modules/webaudio/AudioBufferSourceNode.cpp

Issue 825603005: AudioBufferSourceNode.buffer can only be set once. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Capitalize buffer Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/webaudio/dom-exceptions-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 m_virtualReadIndex = virtualReadIndex; 333 m_virtualReadIndex = virtualReadIndex;
334 334
335 return true; 335 return true;
336 } 336 }
337 337
338 338
339 void AudioBufferSourceNode::setBuffer(AudioBuffer* buffer, ExceptionState& excep tionState) 339 void AudioBufferSourceNode::setBuffer(AudioBuffer* buffer, ExceptionState& excep tionState)
340 { 340 {
341 ASSERT(isMainThread()); 341 ASSERT(isMainThread());
342 342
343 if (m_buffer) {
344 exceptionState.throwDOMException(
345 InvalidStateError,
346 "Buffer can only be set once");
347 return;
348 }
349
343 // The context must be locked since changing the buffer can re-configure the number of channels that are output. 350 // The context must be locked since changing the buffer can re-configure the number of channels that are output.
Ken Russell (switch to Gerrit) 2015/01/20 21:26:16 This comment, and probably later ones, should be u
Raymond Toy 2015/01/20 21:35:03 I believe this is still true. On creation without
344 AudioContext::AutoLocker contextLocker(context()); 351 AudioContext::AutoLocker contextLocker(context());
345 352
346 // This synchronizes with process(). 353 // This synchronizes with process().
347 MutexLocker processLocker(m_processLock); 354 MutexLocker processLocker(m_processLock);
348 355
349 if (buffer) { 356 if (buffer) {
350 // Do any necesssary re-configuration to the buffer's number of channels . 357 // Do any necesssary re-configuration to the buffer's number of channels .
351 unsigned numberOfChannels = buffer->numberOfChannels(); 358 unsigned numberOfChannels = buffer->numberOfChannels();
352 359
353 if (numberOfChannels > AudioContext::maxNumberOfChannels()) { 360 if (numberOfChannels > AudioContext::maxNumberOfChannels()) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 { 523 {
517 visitor->trace(m_buffer); 524 visitor->trace(m_buffer);
518 visitor->trace(m_playbackRate); 525 visitor->trace(m_playbackRate);
519 visitor->trace(m_pannerNode); 526 visitor->trace(m_pannerNode);
520 AudioScheduledSourceNode::trace(visitor); 527 AudioScheduledSourceNode::trace(visitor);
521 } 528 }
522 529
523 } // namespace blink 530 } // namespace blink
524 531
525 #endif // ENABLE(WEB_AUDIO) 532 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « LayoutTests/webaudio/dom-exceptions-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698