Changeset 98005 in webkit


Ignore:
Timestamp:
Oct 20, 2011 11:26:15 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Playing HTMLAudioElement can be garbage collected
https://bugs.webkit.org/show_bug.cgi?id=66878

Patch by Eugene Nalimov <enal@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:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r98002 r98005  
     12011-10-20  Eugene Nalimov  <enal@chromium.org>
     2
     3        Playing HTMLAudioElement can be garbage collected
     4        https://bugs.webkit.org/show_bug.cgi?id=66878
     5
     6        Reviewed by Adam Barth.
     7
     8        Make HTMLAudioElement an 'active' one, meaning that it cannot be
     9        garbage collected if it has panding activity. Had to make
     10        HTMLMediaElement::hasPendingActivity() and
     11        HTMLAudioElement::hasPendingActivity() public, otherwise automatically
     12        generated code would not compile.
     13
     14        Test: no test, as automatic test is blocked by
     15        https://bugs.webkit.org/show_bug.cgi?id=70421
     16        You don't want to sit down and listen if audio stream played completely,
     17        and cannot rely on 'ended' event because events are lost when events
     18        listener is collected.
     19
     20        * html/HTMLAudioElement.idl:
     21        * html/HTMLAudioElement.h:
     22        (WebCore::HTMLAudioElement::hasPendingActivity):
     23        * html/HTMLMediaElement.h:
     24
    1252011-10-20  Mark Hahnenberg  <mhahnenberg@apple.com>
    226
  • trunk/Source/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp

    r97929 r98005  
    4848namespace WebCore {
    4949
    50 WrapperTypeInfo V8HTMLAudioElementConstructor::info = { V8HTMLAudioElementConstructor::GetTemplate, 0, 0, 0 };
     50WrapperTypeInfo V8HTMLAudioElementConstructor::info = { V8HTMLAudioElementConstructor::GetTemplate, V8HTMLAudioElement::derefObject, V8HTMLAudioElement::toActiveDOMObject, 0 };
    5151
    5252static v8::Handle<v8::Value> v8HTMLAudioElementConstructorCallback(const v8::Arguments& args)
     
    7272    toV8(document);
    7373
    74 
    7574    String src;
    7675    if (args.Length() > 0)
     
    8079    V8DOMWrapper::setDOMWrapper(args.Holder(), &V8HTMLAudioElementConstructor::info, audio.get());
    8180    audio->ref();
    82     V8DOMWrapper::setJSWrapperForDOMNode(audio.get(), v8::Persistent<v8::Object>::New(args.Holder()));
     81    V8DOMWrapper::setJSWrapperForActiveDOMObject(audio.get(), v8::Persistent<v8::Object>::New(args.Holder()));
    8382    return args.Holder();
    8483}
  • trunk/Source/WebCore/html/HTMLAudioElement.h

    r74812 r98005  
    4141    static PassRefPtr<HTMLAudioElement> createForJSConstructor(Document*, const String& src);
    4242
     43    virtual bool hasPendingActivity() const { return isPlaying() || HTMLMediaElement::hasPendingActivity(); }
     44
    4345private:
    4446    HTMLAudioElement(const QualifiedName&, Document*);
  • trunk/Source/WebCore/html/HTMLAudioElement.idl

    r92327 r98005  
    2626module html {
    2727    interface [
     28        ActiveDOMObject,
    2829        Conditional=VIDEO
    2930    ] HTMLAudioElement : HTMLMediaElement {
    30    
     31
    3132    };
    3233}
  • trunk/Source/WebCore/html/HTMLMediaElement.h

    r97926 r98005  
    6666// no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement.
    6767
    68 class HTMLMediaElement : public HTMLElement, public MediaPlayerClient, private MediaCanStartListener, private ActiveDOMObject
     68class HTMLMediaElement : public HTMLElement, public MediaPlayerClient, private MediaCanStartListener, public ActiveDOMObject
    6969#if ENABLE(VIDEO_TRACK)
    7070    , private TextTrackClient
     
    221221    bool isPlaying() const { return m_playing; }
    222222
     223    virtual bool hasPendingActivity() const;
     224
    223225#if ENABLE(WEB_AUDIO)
    224226    MediaElementAudioSourceNode* audioSourceNode() { return m_audioSourceNode; }
     
    284286    virtual void resume();
    285287    virtual void stop();
    286     virtual bool hasPendingActivity() const;
    287288   
    288289    virtual void mediaVolumeDidChange();
Note: See TracChangeset for help on using the changeset viewer.