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