| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 output.addInput(*this); | 53 output.addInput(*this); |
| 54 m_outputs.insert(&output); | 54 m_outputs.insert(&output); |
| 55 changedOutputs(); | 55 changedOutputs(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void AudioNodeInput::disconnect(AudioNodeOutput& output) { | 58 void AudioNodeInput::disconnect(AudioNodeOutput& output) { |
| 59 ASSERT(deferredTaskHandler().isGraphOwner()); | 59 ASSERT(deferredTaskHandler().isGraphOwner()); |
| 60 | 60 |
| 61 // First try to disconnect from "active" connections. | 61 // First try to disconnect from "active" connections. |
| 62 if (m_outputs.contains(&output)) { | 62 if (m_outputs.contains(&output)) { |
| 63 m_outputs.remove(&output); | 63 m_outputs.erase(&output); |
| 64 changedOutputs(); | 64 changedOutputs(); |
| 65 output.removeInput(*this); | 65 output.removeInput(*this); |
| 66 // Note: it's important to return immediately after removeInput() calls | 66 // Note: it's important to return immediately after removeInput() calls |
| 67 // since the node may be deleted. | 67 // since the node may be deleted. |
| 68 return; | 68 return; |
| 69 } | 69 } |
| 70 | 70 |
| 71 // Otherwise, try to disconnect from disabled connections. | 71 // Otherwise, try to disconnect from disabled connections. |
| 72 if (m_disabledOutputs.contains(&output)) { | 72 if (m_disabledOutputs.contains(&output)) { |
| 73 m_disabledOutputs.remove(&output); | 73 m_disabledOutputs.erase(&output); |
| 74 output.removeInput(*this); | 74 output.removeInput(*this); |
| 75 // Note: it's important to return immediately after all removeInput() calls | 75 // Note: it's important to return immediately after all removeInput() calls |
| 76 // since the node may be deleted. | 76 // since the node may be deleted. |
| 77 return; | 77 return; |
| 78 } | 78 } |
| 79 | 79 |
| 80 ASSERT_NOT_REACHED(); | 80 ASSERT_NOT_REACHED(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void AudioNodeInput::disable(AudioNodeOutput& output) { | 83 void AudioNodeInput::disable(AudioNodeOutput& output) { |
| 84 ASSERT(deferredTaskHandler().isGraphOwner()); | 84 ASSERT(deferredTaskHandler().isGraphOwner()); |
| 85 DCHECK(m_outputs.contains(&output)); | 85 DCHECK(m_outputs.contains(&output)); |
| 86 | 86 |
| 87 m_disabledOutputs.insert(&output); | 87 m_disabledOutputs.insert(&output); |
| 88 m_outputs.remove(&output); | 88 m_outputs.erase(&output); |
| 89 changedOutputs(); | 89 changedOutputs(); |
| 90 | 90 |
| 91 // Propagate disabled state to outputs. | 91 // Propagate disabled state to outputs. |
| 92 handler().disableOutputsIfNecessary(); | 92 handler().disableOutputsIfNecessary(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void AudioNodeInput::enable(AudioNodeOutput& output) { | 95 void AudioNodeInput::enable(AudioNodeOutput& output) { |
| 96 ASSERT(deferredTaskHandler().isGraphOwner()); | 96 ASSERT(deferredTaskHandler().isGraphOwner()); |
| 97 | 97 |
| 98 // Move output from disabled list to active list. | 98 // Move output from disabled list to active list. |
| 99 m_outputs.insert(&output); | 99 m_outputs.insert(&output); |
| 100 if (m_disabledOutputs.size() > 0) { | 100 if (m_disabledOutputs.size() > 0) { |
| 101 DCHECK(m_disabledOutputs.contains(&output)); | 101 DCHECK(m_disabledOutputs.contains(&output)); |
| 102 m_disabledOutputs.remove(&output); | 102 m_disabledOutputs.erase(&output); |
| 103 } | 103 } |
| 104 changedOutputs(); | 104 changedOutputs(); |
| 105 | 105 |
| 106 // Propagate enabled state to outputs. | 106 // Propagate enabled state to outputs. |
| 107 handler().enableOutputsIfNecessary(); | 107 handler().enableOutputsIfNecessary(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void AudioNodeInput::didUpdate() { | 110 void AudioNodeInput::didUpdate() { |
| 111 handler().checkNumberOfChannelsForInput(this); | 111 handler().checkNumberOfChannelsForInput(this); |
| 112 } | 112 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 return internalSummingBus; | 216 return internalSummingBus; |
| 217 } | 217 } |
| 218 | 218 |
| 219 // Handle multiple connections case. | 219 // Handle multiple connections case. |
| 220 sumAllConnections(internalSummingBus, framesToProcess); | 220 sumAllConnections(internalSummingBus, framesToProcess); |
| 221 | 221 |
| 222 return internalSummingBus; | 222 return internalSummingBus; |
| 223 } | 223 } |
| 224 | 224 |
| 225 } // namespace blink | 225 } // namespace blink |
| OLD | NEW |