- Revision
- 98005
- Author
- commit-qu...@webkit.org
- Date
- 2011-10-20 11:26:15 -0700 (Thu, 20 Oct 2011)
Log Message
Playing HTMLAudioElement can be garbage collected
https://bugs.webkit.org/show_bug.cgi?id=66878
Patch by Eugene Nalimov <e...@chromium.org> on 2011-10-20
Reviewed by Adam Barth.
Make HTMLAudioElement an 'active' one, meaning that it cannot be
garbage collected if it has panding activity. Had to make
HTMLMediaElement::hasPendingActivity() and
HTMLAudioElement::hasPendingActivity() public, otherwise automatically
generated code would not compile.
Test: no test, as automatic test is blocked by
https://bugs.webkit.org/show_bug.cgi?id=70421
You don't want to sit down and listen if audio stream played completely,
and cannot rely on 'ended' event because events are lost when events
listener is collected.
* html/HTMLAudioElement.idl:
* html/HTMLAudioElement.h:
(WebCore::HTMLAudioElement::hasPendingActivity):
* html/HTMLMediaElement.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (98004 => 98005)
--- trunk/Source/WebCore/ChangeLog 2011-10-20 18:25:21 UTC (rev 98004)
+++ trunk/Source/WebCore/ChangeLog 2011-10-20 18:26:15 UTC (rev 98005)
@@ -1,3 +1,27 @@
+2011-10-20 Eugene Nalimov <e...@chromium.org>
+
+ Playing HTMLAudioElement can be garbage collected
+ https://bugs.webkit.org/show_bug.cgi?id=66878
+
+ Reviewed by Adam Barth.
+
+ Make HTMLAudioElement an 'active' one, meaning that it cannot be
+ garbage collected if it has panding activity. Had to make
+ HTMLMediaElement::hasPendingActivity() and
+ HTMLAudioElement::hasPendingActivity() public, otherwise automatically
+ generated code would not compile.
+
+ Test: no test, as automatic test is blocked by
+ https://bugs.webkit.org/show_bug.cgi?id=70421
+ You don't want to sit down and listen if audio stream played completely,
+ and cannot rely on 'ended' event because events are lost when events
+ listener is collected.
+
+ * html/HTMLAudioElement.idl:
+ * html/HTMLAudioElement.h:
+ (WebCore::HTMLAudioElement::hasPendingActivity):
+ * html/HTMLMediaElement.h:
+
2011-10-20 Mark Hahnenberg <mhahnenb...@apple.com>
Rename static deleteProperty to deletePropertyByIndex
Modified: trunk/Source/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp (98004 => 98005)
--- trunk/Source/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp 2011-10-20 18:25:21 UTC (rev 98004)
+++ trunk/Source/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp 2011-10-20 18:26:15 UTC (rev 98005)
@@ -47,7 +47,7 @@
namespace WebCore {
-WrapperTypeInfo V8HTMLAudioElementConstructor::info = { V8HTMLAudioElementConstructor::GetTemplate, 0, 0, 0 };
+WrapperTypeInfo V8HTMLAudioElementConstructor::info = { V8HTMLAudioElementConstructor::GetTemplate, V8HTMLAudioElement::derefObject, V8HTMLAudioElement::toActiveDOMObject, 0 };
static v8::Handle<v8::Value> v8HTMLAudioElementConstructorCallback(const v8::Arguments& args)
{
@@ -71,7 +71,6 @@
// may end up being the only node in the map and get garbage-collected prematurely.
toV8(document);
-
String src;
if (args.Length() > 0)
src = ""
@@ -79,7 +78,7 @@
V8DOMWrapper::setDOMWrapper(args.Holder(), &V8HTMLAudioElementConstructor::info, audio.get());
audio->ref();
- V8DOMWrapper::setJSWrapperForDOMNode(audio.get(), v8::Persistent<v8::Object>::New(args.Holder()));
+ V8DOMWrapper::setJSWrapperForActiveDOMObject(audio.get(), v8::Persistent<v8::Object>::New(args.Holder()));
return args.Holder();
}
Modified: trunk/Source/WebCore/html/HTMLAudioElement.h (98004 => 98005)
--- trunk/Source/WebCore/html/HTMLAudioElement.h 2011-10-20 18:25:21 UTC (rev 98004)
+++ trunk/Source/WebCore/html/HTMLAudioElement.h 2011-10-20 18:26:15 UTC (rev 98005)
@@ -40,6 +40,8 @@
static PassRefPtr<HTMLAudioElement> create(const QualifiedName&, Document*);
static PassRefPtr<HTMLAudioElement> createForJSConstructor(Document*, const String& src);
+ virtual bool hasPendingActivity() const { return isPlaying() || HTMLMediaElement::hasPendingActivity(); }
+
private:
HTMLAudioElement(const QualifiedName&, Document*);
Modified: trunk/Source/WebCore/html/HTMLAudioElement.idl (98004 => 98005)
--- trunk/Source/WebCore/html/HTMLAudioElement.idl 2011-10-20 18:25:21 UTC (rev 98004)
+++ trunk/Source/WebCore/html/HTMLAudioElement.idl 2011-10-20 18:26:15 UTC (rev 98005)
@@ -25,8 +25,9 @@
module html {
interface [
+ ActiveDOMObject,
Conditional=VIDEO
] HTMLAudioElement : HTMLMediaElement {
-
+
};
}
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (98004 => 98005)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2011-10-20 18:25:21 UTC (rev 98004)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2011-10-20 18:26:15 UTC (rev 98005)
@@ -65,7 +65,7 @@
// But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so it
// no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement.
-class HTMLMediaElement : public HTMLElement, public MediaPlayerClient, private MediaCanStartListener, private ActiveDOMObject
+class HTMLMediaElement : public HTMLElement, public MediaPlayerClient, private MediaCanStartListener, public ActiveDOMObject
#if ENABLE(VIDEO_TRACK)
, private TextTrackClient
#endif
@@ -220,6 +220,8 @@
bool isPlaying() const { return m_playing; }
+ virtual bool hasPendingActivity() const;
+
#if ENABLE(WEB_AUDIO)
MediaElementAudioSourceNode* audioSourceNode() { return m_audioSourceNode; }
void setAudioSourceNode(MediaElementAudioSourceNode*);
@@ -283,7 +285,6 @@
virtual void suspend(ReasonForSuspension);
virtual void resume();
virtual void stop();
- virtual bool hasPendingActivity() const;
virtual void mediaVolumeDidChange();