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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp

Issue 2283053002: Fix BaseAudioContext::hasPendingActivity() to make it GCed correctly (Closed)
Patch Set: Created 4 years, 3 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
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 clear(); 206 clear();
207 } 207 }
208 208
209 void BaseAudioContext::stop() 209 void BaseAudioContext::stop()
210 { 210 {
211 uninitialize(); 211 uninitialize();
212 } 212 }
213 213
214 bool BaseAudioContext::hasPendingActivity() const 214 bool BaseAudioContext::hasPendingActivity() const
215 { 215 {
216 // There's no pending activity if the audio context has been cleared. 216 // If the destination node (handler) has any active connection and the audio
217 return !m_isCleared; 217 // graph needs to be rendered, we mark the context as 'hasPendingActivity'.
218 // This keeps this node from getting GCed.
219 return destination()->hasConnection();
218 } 220 }
219 221
220 AudioDestinationNode* BaseAudioContext::destination() const 222 AudioDestinationNode* BaseAudioContext::destination() const
221 { 223 {
222 // Cannot be called from the audio thread because this method touches object s managed by Oilpan, 224 // Cannot be called from the audio thread because this method touches object s managed by Oilpan,
223 // and the audio thread is not managed by Oilpan. 225 // and the audio thread is not managed by Oilpan.
224 DCHECK(!isAudioThread()); 226 DCHECK(!isAudioThread());
225 return m_destinationNode; 227 return m_destinationNode;
226 } 228 }
227 229
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 833
832 SecurityOrigin* BaseAudioContext::getSecurityOrigin() const 834 SecurityOrigin* BaseAudioContext::getSecurityOrigin() const
833 { 835 {
834 if (getExecutionContext()) 836 if (getExecutionContext())
835 return getExecutionContext()->getSecurityOrigin(); 837 return getExecutionContext()->getSecurityOrigin();
836 838
837 return nullptr; 839 return nullptr;
838 } 840 }
839 841
840 } // namespace blink 842 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698