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..d5326b7be7a11246501bd2b2d2fdd26a71e7db35 100644 |
--- a/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.cpp |
+++ b/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.cpp |
@@ -225,6 +225,7 @@ void AudioScheduledSourceHandler::notifyEnded() |
AudioScheduledSourceNode::AudioScheduledSourceNode(AbstractAudioContext& context) |
: AudioSourceNode(context) |
+ , m_isReleasedFromContext(false) |
{ |
} |
@@ -233,22 +234,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 +264,23 @@ void AudioScheduledSourceNode::setOnended(PassRefPtrWillBeRawPtr<EventListener> |
setAttributeEventListener(EventTypeNames::ended, listener); |
} |
+void AudioScheduledSourceNode::releaseFromContext() |
+{ |
+ m_isReleasedFromContext = true; |
+} |
+ |
+bool AudioScheduledSourceNode::hasPendingActivity() const |
+{ |
+ // AudioScheduledSourceNodes (i.e. Oscillator and BufferSource) are marked |
+ // as following: |
+ // - if released from the context: do GC. |
+ // - when playing or scheduled: has pending activity, do not GC. |
+ // - when unscheduled or finished: no pending activity, do GC. |
+ if (m_isReleasedFromContext) |
+ return false; |
+ |
+ return audioScheduledSourceHandler().isPlayingOrScheduled(); |
+} |
+ |
} // namespace blink |