Index: third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.cpp |
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.cpp b/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.cpp |
index 8823d9dbdba8cc94ef11b5ff2bd0dbb5b946adf1..c7d398a9c0bb203794ec9b5a11b39516b0bdbda8 100644 |
--- a/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.cpp |
+++ b/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.cpp |
@@ -233,22 +233,22 @@ AudioScheduledSourceHandler& AudioScheduledSourceNode::audioScheduledSourceHandl |
return static_cast<AudioScheduledSourceHandler&>(handler()); |
} |
-void AudioScheduledSourceNode::start(ExceptionState& exceptionState) |
+void AudioScheduledSourceNode::startNode(ExceptionState& exceptionState) |
{ |
- start(0, exceptionState); |
+ startNode(0, exceptionState); |
} |
-void AudioScheduledSourceNode::start(double when, ExceptionState& exceptionState) |
+void AudioScheduledSourceNode::startNode(double when, ExceptionState& exceptionState) |
{ |
audioScheduledSourceHandler().start(when, exceptionState); |
} |
-void AudioScheduledSourceNode::stop(ExceptionState& exceptionState) |
+void AudioScheduledSourceNode::stopNode(ExceptionState& exceptionState) |
{ |
- stop(0, exceptionState); |
+ stopNode(0, exceptionState); |
} |
-void AudioScheduledSourceNode::stop(double when, ExceptionState& exceptionState) |
+void AudioScheduledSourceNode::stopNode(double when, ExceptionState& exceptionState) |
{ |
audioScheduledSourceHandler().stop(when, exceptionState); |
} |
@@ -263,5 +263,22 @@ void AudioScheduledSourceNode::setOnended(PassRefPtrWillBeRawPtr<EventListener> |
setAttributeEventListener(EventTypeNames::ended, listener); |
} |
+bool AudioScheduledSourceNode::hasPendingActivity() const |
+{ |
+ // It is possible to play a source node for a very long time or to schedule |
+ // too far in the future; thus infinitely playing/scheduled sources leak |
+ // after the execution context is torn down because |hasPendingActivity| |
+ // still returns true. |
Raymond Toy
2016/02/22 17:43:51
Don't think this comment really adds anything. I
hongchan
2016/02/23 18:01:33
Where is the comment at line 173?
Raymond Toy
2016/02/23 18:12:05
Oops. 273, the lines below.
|
+ // |
+ // To avoid the leak, a node should be collected regardless of its |
+ // playback state if the context is closed. |
+ if (context()->isContextClosed()) |
+ return false; |
+ |
+ // If a node is scheduled or playing, do not collect the node prematurely |
+ // even its reference is out of scope. (and fire onended event if assigned) |
Raymond Toy
2016/02/22 17:43:51
Typo: "(and fire" -> "And fire".
hongchan
2016/02/23 18:01:33
Done.
|
+ return audioScheduledSourceHandler().isPlayingOrScheduled(); |
+} |
+ |
} // namespace blink |