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

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

Issue 1762103002: Keep ScriptProcessorNode from premature GC with ScriptWrappable::hasPendingActivity() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed the manual test and fixed the exisiting automated test Created 4 years, 9 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 return nullptr; 287 return nullptr;
288 288
289 return new ScriptProcessorNode(context, sampleRate, bufferSize, numberOfInpu tChannels, numberOfOutputChannels); 289 return new ScriptProcessorNode(context, sampleRate, bufferSize, numberOfInpu tChannels, numberOfOutputChannels);
290 } 290 }
291 291
292 size_t ScriptProcessorNode::bufferSize() const 292 size_t ScriptProcessorNode::bufferSize() const
293 { 293 {
294 return static_cast<ScriptProcessorHandler&>(handler()).bufferSize(); 294 return static_cast<ScriptProcessorHandler&>(handler()).bufferSize();
295 } 295 }
296 296
297 bool ScriptProcessorNode::hasPendingActivity() const
298 {
299 // To prevent the node from leaking after the context is closed.
300 if (context()->isContextClosed())
301 return false;
302
303 // If |onaudioprocess| event handler is defined, the node should not be
304 // GCed even if it is out of scope.
305 if (hasEventListeners(EventTypeNames::audioprocess))
306 return true;
307
308 return false;
309 }
310
297 } // namespace blink 311 } // namespace blink
298 312
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698