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..fcf51b2d73fc8f80704a4fb540e68346f39c1f83 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_isMarkedForGC(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::markForGC() |
+{ |
+ m_isMarkedForGC = 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_isMarkedForGC) |
haraken
2016/02/19 17:46:00
Instead of introducing m_isMarkedForGC, can we do
hongchan
2016/02/19 18:13:48
Good idea. Done.
|
+ return false; |
+ |
+ return audioScheduledSourceHandler().isPlayingOrScheduled(); |
+} |
+ |
} // namespace blink |