Index: third_party/WebKit/Source/modules/webaudio/ScriptProcessorNode.cpp |
diff --git a/third_party/WebKit/Source/modules/webaudio/ScriptProcessorNode.cpp b/third_party/WebKit/Source/modules/webaudio/ScriptProcessorNode.cpp |
index c89091f0dfac76474c1472229371e3b76102f30a..7274ba1d0e680d96cc362cc48ce55a9bd16b0400 100644 |
--- a/third_party/WebKit/Source/modules/webaudio/ScriptProcessorNode.cpp |
+++ b/third_party/WebKit/Source/modules/webaudio/ScriptProcessorNode.cpp |
@@ -294,5 +294,19 @@ size_t ScriptProcessorNode::bufferSize() const |
return static_cast<ScriptProcessorHandler&>(handler()).bufferSize(); |
} |
+bool ScriptProcessorNode::hasPendingActivity() const |
+{ |
+ // To prevent the node from leaking after the context is closed. |
+ if (context()->isContextClosed()) |
+ return false; |
+ |
+ // If |onaudioprocess| event handler is defined, the node should not be |
+ // GCed even if it is out of scope. |
+ if (hasEventListeners(EventTypeNames::audioprocess)) |
+ return true; |
+ |
+ return false; |
+} |
+ |
} // namespace blink |