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

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: Rebase Created 5 years, 10 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 | « Source/core/frame/UseCounter.cpp ('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 13 matching lines...) Expand all
24 24
25 #include "config.h" 25 #include "config.h"
26 26
27 #if ENABLE(WEB_AUDIO) 27 #if ENABLE(WEB_AUDIO)
28 28
29 #include "modules/webaudio/AudioBufferSourceNode.h" 29 #include "modules/webaudio/AudioBufferSourceNode.h"
30 30
31 #include "bindings/core/v8/ExceptionMessages.h" 31 #include "bindings/core/v8/ExceptionMessages.h"
32 #include "bindings/core/v8/ExceptionState.h" 32 #include "bindings/core/v8/ExceptionState.h"
33 #include "core/dom/ExceptionCode.h" 33 #include "core/dom/ExceptionCode.h"
34 #include "core/frame/UseCounter.h"
34 #include "platform/audio/AudioUtilities.h" 35 #include "platform/audio/AudioUtilities.h"
35 #include "modules/webaudio/AudioContext.h" 36 #include "modules/webaudio/AudioContext.h"
36 #include "modules/webaudio/AudioNodeOutput.h" 37 #include "modules/webaudio/AudioNodeOutput.h"
37 #include "platform/FloatConversion.h" 38 #include "platform/FloatConversion.h"
38 #include "wtf/MainThread.h" 39 #include "wtf/MainThread.h"
39 #include "wtf/MathExtras.h" 40 #include "wtf/MathExtras.h"
40 #include <algorithm> 41 #include <algorithm>
41 42
42 namespace blink { 43 namespace blink {
43 44
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 m_virtualReadIndex = virtualReadIndex; 335 m_virtualReadIndex = virtualReadIndex;
335 336
336 return true; 337 return true;
337 } 338 }
338 339
339 340
340 void AudioBufferSourceNode::setBuffer(AudioBuffer* buffer, ExceptionState& excep tionState) 341 void AudioBufferSourceNode::setBuffer(AudioBuffer* buffer, ExceptionState& excep tionState)
341 { 342 {
342 ASSERT(isMainThread()); 343 ASSERT(isMainThread());
343 344
345 if (m_buffer) {
346 // Setting the buffer more than once is deprecated. Change this to a DO M exception in M45
347 // or so.
348 UseCounter::countDeprecation(context()->executionContext(), UseCounter:: AudioBufferSourceBufferOnce);
349 }
350
344 // The context must be locked since changing the buffer can re-configure the number of channels that are output. 351 // The context must be locked since changing the buffer can re-configure the number of channels that are output.
345 AudioContext::AutoLocker contextLocker(context()); 352 AudioContext::AutoLocker contextLocker(context());
346 353
347 // This synchronizes with process(). 354 // This synchronizes with process().
348 MutexLocker processLocker(m_processLock); 355 MutexLocker processLocker(m_processLock);
349 356
350 if (buffer) { 357 if (buffer) {
351 // Do any necesssary re-configuration to the buffer's number of channels . 358 // Do any necesssary re-configuration to the buffer's number of channels .
352 unsigned numberOfChannels = buffer->numberOfChannels(); 359 unsigned numberOfChannels = buffer->numberOfChannels();
353 360
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 { 532 {
526 visitor->trace(m_buffer); 533 visitor->trace(m_buffer);
527 visitor->trace(m_playbackRate); 534 visitor->trace(m_playbackRate);
528 visitor->trace(m_pannerNode); 535 visitor->trace(m_pannerNode);
529 AudioScheduledSourceNode::trace(visitor); 536 AudioScheduledSourceNode::trace(visitor);
530 } 537 }
531 538
532 } // namespace blink 539 } // namespace blink
533 540
534 #endif // ENABLE(WEB_AUDIO) 541 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/core/frame/UseCounter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698