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

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

Issue 386343004: WebAudio: Use references instead of pointers in AudioNodeInput and AudioNodeOutput. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | « no previous file | Source/modules/webaudio/AudioNodeInput.h » ('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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 { 138 {
139 m_nodeType = type; 139 m_nodeType = type;
140 140
141 #if DEBUG_AUDIONODE_REFERENCES 141 #if DEBUG_AUDIONODE_REFERENCES
142 ++s_nodeCount[type]; 142 ++s_nodeCount[type];
143 #endif 143 #endif
144 } 144 }
145 145
146 void AudioNode::addInput() 146 void AudioNode::addInput()
147 { 147 {
148 m_inputs.append(AudioNodeInput::create(this)); 148 m_inputs.append(AudioNodeInput::create(*this));
149 } 149 }
150 150
151 void AudioNode::addOutput(PassOwnPtr<AudioNodeOutput> output) 151 void AudioNode::addOutput(PassOwnPtr<AudioNodeOutput> output)
152 { 152 {
153 m_outputs.append(output); 153 m_outputs.append(output);
154 } 154 }
155 155
156 AudioNodeInput* AudioNode::input(unsigned i) 156 AudioNodeInput* AudioNode::input(unsigned i)
157 { 157 {
158 if (i < m_inputs.size()) 158 if (i < m_inputs.size())
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 196
197 if (context() != destination->context()) { 197 if (context() != destination->context()) {
198 exceptionState.throwDOMException( 198 exceptionState.throwDOMException(
199 SyntaxError, 199 SyntaxError,
200 "cannot connect to a destination belonging to a different audio cont ext."); 200 "cannot connect to a destination belonging to a different audio cont ext.");
201 return; 201 return;
202 } 202 }
203 203
204 AudioNodeInput* input = destination->input(inputIndex); 204 AudioNodeInput* input = destination->input(inputIndex);
205 AudioNodeOutput* output = this->output(outputIndex); 205 input->connect(*output(outputIndex));
206 input->connect(output);
207 206
208 // Let context know that a connection has been made. 207 // Let context know that a connection has been made.
209 context()->incrementConnectionCount(); 208 context()->incrementConnectionCount();
210 } 209 }
211 210
212 void AudioNode::connect(AudioParam* param, unsigned outputIndex, ExceptionState& exceptionState) 211 void AudioNode::connect(AudioParam* param, unsigned outputIndex, ExceptionState& exceptionState)
213 { 212 {
214 ASSERT(isMainThread()); 213 ASSERT(isMainThread());
215 AudioContext::AutoLocker locker(context()); 214 AudioContext::AutoLocker locker(context());
216 215
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 // it cannot be reattached. Therefore, the reference count 595 // it cannot be reattached. Therefore, the reference count
597 // will not go above zero again. 596 // will not go above zero again.
598 ASSERT(m_keepAlive); 597 ASSERT(m_keepAlive);
599 m_keepAlive = nullptr; 598 m_keepAlive = nullptr;
600 } 599 }
601 #endif 600 #endif
602 601
603 } // namespace WebCore 602 } // namespace WebCore
604 603
605 #endif // ENABLE(WEB_AUDIO) 604 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioNodeInput.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698