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

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

Issue 14628008: Require use of AudioBus::create() to avoid ref-counting issues (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Require use of Created 7 years, 7 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
« no previous file with comments | « Source/modules/webaudio/AudioNodeInput.cpp ('k') | Source/modules/webaudio/AudioParam.cpp » ('j') | 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 29 matching lines...) Expand all
40 : m_node(node) 40 : m_node(node)
41 , m_numberOfChannels(numberOfChannels) 41 , m_numberOfChannels(numberOfChannels)
42 , m_desiredNumberOfChannels(numberOfChannels) 42 , m_desiredNumberOfChannels(numberOfChannels)
43 , m_isInPlace(false) 43 , m_isInPlace(false)
44 , m_isEnabled(true) 44 , m_isEnabled(true)
45 , m_renderingFanOutCount(0) 45 , m_renderingFanOutCount(0)
46 , m_renderingParamFanOutCount(0) 46 , m_renderingParamFanOutCount(0)
47 { 47 {
48 ASSERT(numberOfChannels <= AudioContext::maxNumberOfChannels()); 48 ASSERT(numberOfChannels <= AudioContext::maxNumberOfChannels());
49 49
50 m_internalBus = adoptRef(new AudioBus(numberOfChannels, AudioNode::Processin gSizeInFrames)); 50 m_internalBus = AudioBus::create(numberOfChannels, AudioNode::ProcessingSize InFrames);
51 } 51 }
52 52
53 void AudioNodeOutput::setNumberOfChannels(unsigned numberOfChannels) 53 void AudioNodeOutput::setNumberOfChannels(unsigned numberOfChannels)
54 { 54 {
55 ASSERT(numberOfChannels <= AudioContext::maxNumberOfChannels()); 55 ASSERT(numberOfChannels <= AudioContext::maxNumberOfChannels());
56 ASSERT(context()->isGraphOwner()); 56 ASSERT(context()->isGraphOwner());
57 57
58 m_desiredNumberOfChannels = numberOfChannels; 58 m_desiredNumberOfChannels = numberOfChannels;
59 59
60 if (context()->isAudioThread()) { 60 if (context()->isAudioThread()) {
61 // If we're in the audio thread then we can take care of it right away ( we should be at the very start or end of a rendering quantum). 61 // If we're in the audio thread then we can take care of it right away ( we should be at the very start or end of a rendering quantum).
62 updateNumberOfChannels(); 62 updateNumberOfChannels();
63 } else { 63 } else {
64 // Let the context take care of it in the audio thread in the pre and po st render tasks. 64 // Let the context take care of it in the audio thread in the pre and po st render tasks.
65 context()->markAudioNodeOutputDirty(this); 65 context()->markAudioNodeOutputDirty(this);
66 } 66 }
67 } 67 }
68 68
69 void AudioNodeOutput::updateInternalBus() 69 void AudioNodeOutput::updateInternalBus()
70 { 70 {
71 if (numberOfChannels() == m_internalBus->numberOfChannels()) 71 if (numberOfChannels() == m_internalBus->numberOfChannels())
72 return; 72 return;
73 73
74 m_internalBus = adoptRef(new AudioBus(numberOfChannels(), AudioNode::Process ingSizeInFrames)); 74 m_internalBus = AudioBus::create(numberOfChannels(), AudioNode::ProcessingSi zeInFrames);
75 } 75 }
76 76
77 void AudioNodeOutput::updateRenderingState() 77 void AudioNodeOutput::updateRenderingState()
78 { 78 {
79 updateNumberOfChannels(); 79 updateNumberOfChannels();
80 m_renderingFanOutCount = fanOutCount(); 80 m_renderingFanOutCount = fanOutCount();
81 m_renderingParamFanOutCount = paramFanOutCount(); 81 m_renderingParamFanOutCount = paramFanOutCount();
82 } 82 }
83 83
84 void AudioNodeOutput::updateNumberOfChannels() 84 void AudioNodeOutput::updateNumberOfChannels()
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 AudioNodeInput* input = *i; 247 AudioNodeInput* input = *i;
248 input->enable(this); 248 input->enable(this);
249 } 249 }
250 m_isEnabled = true; 250 m_isEnabled = true;
251 } 251 }
252 } 252 }
253 253
254 } // namespace WebCore 254 } // namespace WebCore
255 255
256 #endif // ENABLE(WEB_AUDIO) 256 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/AudioNodeInput.cpp ('k') | Source/modules/webaudio/AudioParam.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698