Index: third_party/WebKit/Source/modules/webaudio/AbstractAudioContext.cpp |
diff --git a/third_party/WebKit/Source/modules/webaudio/AbstractAudioContext.cpp b/third_party/WebKit/Source/modules/webaudio/AbstractAudioContext.cpp |
index 5d358fe5508515dce8591cba94e688ab038d3a70..15e4c6f0c516cfb0e0b87d80b1762a422c29a266 100644 |
--- a/third_party/WebKit/Source/modules/webaudio/AbstractAudioContext.cpp |
+++ b/third_party/WebKit/Source/modules/webaudio/AbstractAudioContext.cpp |
@@ -787,10 +787,12 @@ void AbstractAudioContext::releaseFinishedSourceNodes() |
ASSERT(isAudioThread()); |
bool didRemove = false; |
for (AudioHandler* handler : m_finishedSourceHandlers) { |
- for (unsigned i = 0; i < m_activeSourceNodes.size(); ++i) { |
- if (handler == &m_activeSourceNodes[i]->handler()) { |
+ for (AudioNode* node : m_activeSourceNodes) { |
+ if (m_finishedSourceNodes.contains(node)) |
+ continue; |
+ if (handler == &node->handler()) { |
handler->breakConnection(); |
- m_finishedSourceNodes.append(m_activeSourceNodes[i]); |
+ m_finishedSourceNodes.add(node); |
didRemove = true; |
break; |
} |
@@ -826,6 +828,8 @@ void AbstractAudioContext::handleStoppableSourceNodes() |
// Find AudioBufferSourceNodes to see if we can stop playing them. |
for (AudioNode* node : m_activeSourceNodes) { |
+ if (m_finishedSourceNodes.contains(node)) |
Raymond Toy
2016/05/10 16:04:20
Can you add a comment here why you're skipping act
sof
2016/05/10 19:09:09
Added comment, let's see if it makes sense in 6 mo
Raymond Toy
2016/05/10 19:54:57
Excellent! At least I'll have some understanding
|
+ continue; |
if (node->handler().getNodeType() == AudioHandler::NodeTypeAudioBufferSource) { |
AudioBufferSourceNode* sourceNode = static_cast<AudioBufferSourceNode*>(node); |
sourceNode->audioBufferSourceHandler().handleStoppableSourceNode(); |
@@ -975,4 +979,3 @@ SecurityOrigin* AbstractAudioContext::getSecurityOrigin() const |
} |
} // namespace blink |
- |