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

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

Issue 802593004: WebAudio: Fix AudioNode leak in a case that AudioNode is not disconnected from the graph explicitly. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 5 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 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 void AudioNode::dispose() 98 void AudioNode::dispose()
99 { 99 {
100 ASSERT(isMainThread()); 100 ASSERT(isMainThread());
101 ASSERT(context()->isGraphOwner()); 101 ASSERT(context()->isGraphOwner());
102 102
103 context()->removeChangedChannelCountMode(this); 103 context()->removeChangedChannelCountMode(this);
104 context()->removeAutomaticPullNode(this); 104 context()->removeAutomaticPullNode(this);
105 context()->disposeOutputs(*this); 105 context()->disposeOutputs(*this);
106 for (unsigned i = 0; i < m_outputs.size(); ++i) 106 for (unsigned i = 0; i < m_outputs.size(); ++i)
107 output(i)->disconnectAll(); 107 output(i)->disconnectAll();
108
109 if (context()->contextState() != AudioContext::Running)
110 return;
111 ThreadState::current()->markAsZombie(this);
112 context()->setLastZombie(this);
108 } 113 }
109 114
110 String AudioNode::nodeTypeName() const 115 String AudioNode::nodeTypeName() const
111 { 116 {
112 switch (m_nodeType) { 117 switch (m_nodeType) {
113 case NodeTypeDestination: 118 case NodeTypeDestination:
114 return "AudioDestinationNode"; 119 return "AudioDestinationNode";
115 case NodeTypeOscillator: 120 case NodeTypeOscillator:
116 return "OscillatorNode"; 121 return "OscillatorNode";
117 case NodeTypeAudioBufferSource: 122 case NodeTypeAudioBufferSource:
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 608
604 void AudioNode::updateChannelCountMode() 609 void AudioNode::updateChannelCountMode()
605 { 610 {
606 m_channelCountMode = m_newChannelCountMode; 611 m_channelCountMode = m_newChannelCountMode;
607 updateChannelsForInputs(); 612 updateChannelsForInputs();
608 } 613 }
609 614
610 } // namespace blink 615 } // namespace blink
611 616
612 #endif // ENABLE(WEB_AUDIO) 617 #endif // ENABLE(WEB_AUDIO)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698