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

Unified Diff: third_party/WebKit/Source/modules/webaudio/AbstractAudioContext.cpp

Issue 1593763002: Keep AudioSourceNode from premature GC with ScriptWrappable::hasPendingActivity() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added [DependentLifetime] Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
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 9c27d38a878f0101b55878311a927ab82e69fc61..b31dadf93f2368a2418db767ede7ad8bcf3f01bd 100644
--- a/third_party/WebKit/Source/modules/webaudio/AbstractAudioContext.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AbstractAudioContext.cpp
@@ -790,8 +790,18 @@ void AbstractAudioContext::notifySourceNodeStartedProcessing(AudioNode* node)
void AbstractAudioContext::releaseActiveSourceNodes()
{
ASSERT(isMainThread());
- for (auto& sourceNode : m_activeSourceNodes)
+ AutoLocker locker(this);
+
+ for (AudioNode* sourceNode : m_activeSourceNodes) {
+
+ // NOTE: this check makes the renderer crash.
hongchan 2016/02/19 00:46:47 It is necessary to half the active source node. Ot
+ if (sourceNode->handler().nodeType() == AudioHandler::NodeTypeOscillator || AudioHandler::NodeTypeAudioBufferSource) {
+ AudioScheduledSourceNode* scheduledSourceNode = static_cast<AudioScheduledSourceNode*>(sourceNode);
+ scheduledSourceNode->releaseFromContext();
+ }
+
sourceNode->handler().breakConnection();
+ }
m_activeSourceNodes.clear();
}

Powered by Google App Engine
This is Rietveld 408576698