Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(854)

Unified Diff: third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.h

Issue 1593763002: Keep AudioSourceNode from premature GC with ScriptWrappable::hasPendingActivity() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Error fixed in releaseActiveSourceNodes() Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.h
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.h b/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.h
index ed6a5300de45d6b370c3d958f7d13e75e6beef13..2b7d1d7f6aa515d2fd3798aae931ed52366f0914 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.h
+++ b/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.h
@@ -122,17 +122,32 @@ private:
class AudioScheduledSourceNode : public AudioSourceNode {
public:
- void start(ExceptionState&);
- void start(double when, ExceptionState&);
- void stop(ExceptionState&);
- void stop(double when, ExceptionState&);
+ void startNode(ExceptionState&);
+ void startNode(double when, ExceptionState&);
+ void stopNode(ExceptionState&);
+ void stopNode(double when, ExceptionState&);
EventListener* onended();
void setOnended(PassRefPtrWillBeRawPtr<EventListener>);
+ // ScriptWrappable
+ bool hasPendingActivity() const final;
+
+ // 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
+ // when the execution context is tearing down because |hasPendingActivity|
+ // returns true.
+ //
+ // So we call |markForGC| to mark the node as 'available for GC' regardless
+ // of its playback state.
+ void markForGC();
+
protected:
explicit AudioScheduledSourceNode(AbstractAudioContext&);
AudioScheduledSourceHandler& audioScheduledSourceHandler() const;
+
+private:
+ bool m_isMarkedForGC;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698