OLD | NEW |
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 Loading... |
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 |
OLD | NEW |