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

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

Issue 349213007: WebAudio: Remove AudioNode::RefType. (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
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 if (!output || !node()) 57 if (!output || !node())
58 return; 58 return;
59 59
60 // Check if we're already connected to this output. 60 // Check if we're already connected to this output.
61 if (m_outputs.contains(output)) 61 if (m_outputs.contains(output))
62 return; 62 return;
63 63
64 output->addInput(this); 64 output->addInput(this);
65 m_outputs.add(output); 65 m_outputs.add(output);
66 changedOutputs(); 66 changedOutputs();
67
68 // Sombody has just connected to us, so count it as a reference.
69 node()->ref(AudioNode::RefTypeConnection);
70 } 67 }
71 68
72 void AudioNodeInput::disconnect(AudioNodeOutput* output) 69 void AudioNodeInput::disconnect(AudioNodeOutput* output)
73 { 70 {
74 ASSERT(context()->isGraphOwner()); 71 ASSERT(context()->isGraphOwner());
75 72
76 ASSERT(output && node()); 73 ASSERT(output && node());
77 if (!output || !node()) 74 if (!output || !node())
78 return; 75 return;
79 76
80 // First try to disconnect from "active" connections. 77 // First try to disconnect from "active" connections.
81 if (m_outputs.contains(output)) { 78 if (m_outputs.contains(output)) {
82 m_outputs.remove(output); 79 m_outputs.remove(output);
83 changedOutputs(); 80 changedOutputs();
84 output->removeInput(this); 81 output->removeInput(this);
85 node()->deref(AudioNode::RefTypeConnection); // Note: it's important to return immediately after all deref() calls since the node may be deleted. 82 // Note: it's important to return immediately after removeInput() calls
83 // since the node may be deleted.
86 return; 84 return;
87 } 85 }
88 86
89 // Otherwise, try to disconnect from disabled connections. 87 // Otherwise, try to disconnect from disabled connections.
90 if (m_disabledOutputs.contains(output)) { 88 if (m_disabledOutputs.contains(output)) {
91 m_disabledOutputs.remove(output); 89 m_disabledOutputs.remove(output);
92 output->removeInput(this); 90 output->removeInput(this);
93 node()->deref(AudioNode::RefTypeConnection); // Note: it's important to return immediately after all deref() calls since the node may be deleted. 91 // Note: it's important to return immediately after all removeInput() ca lls
92 // since the node may be deleted.
94 return; 93 return;
95 } 94 }
96 95
97 ASSERT_NOT_REACHED(); 96 ASSERT_NOT_REACHED();
98 } 97 }
99 98
100 void AudioNodeInput::disable(AudioNodeOutput* output) 99 void AudioNodeInput::disable(AudioNodeOutput* output)
101 { 100 {
102 ASSERT(context()->isGraphOwner()); 101 ASSERT(context()->isGraphOwner());
103 102
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 240
242 // Handle multiple connections case. 241 // Handle multiple connections case.
243 sumAllConnections(internalSummingBus, framesToProcess); 242 sumAllConnections(internalSummingBus, framesToProcess);
244 243
245 return internalSummingBus; 244 return internalSummingBus;
246 } 245 }
247 246
248 } // namespace WebCore 247 } // namespace WebCore
249 248
250 #endif // ENABLE(WEB_AUDIO) 249 #endif // ENABLE(WEB_AUDIO)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698