Changeset 66895 in webkit


Ignore:
Timestamp:
Sep 7, 2010 11:29:29 AM (14 years ago)
Author:
eric.carlson@apple.com
Message:

2010-09-07 Eric Carlson <eric.carlson@apple.com>

Reviewed by Darin Adler.

Media elements should derive from ActiveDOMObjects
https://bugs.webkit.org/show_bug.cgi?id=45306
<rdar://problem/7929062>

  • html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize ActiveDOMObject (WebCore::HTMLMediaElement::stop): Call suspend, we want to do the same thing in both cases. (WebCore::HTMLMediaElement::suspend): Rename from documentWillBecomeInactive. (WebCore::HTMLMediaElement::resume): Rename from documentDidBecomeActive. (WebCore::HTMLMediaElement::hasPendingActivity): Return true if the event queue is not empty so the element can't be collected before they are sent.
  • html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::canSuspend):
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r66892 r66895  
     12010-09-07  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Media elements should derive from ActiveDOMObjects
     6        https://bugs.webkit.org/show_bug.cgi?id=45306
     7        <rdar://problem/7929062>
     8
     9        * html/HTMLMediaElement.cpp:
     10        (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize ActiveDOMObject
     11        (WebCore::HTMLMediaElement::stop): Call suspend, we want to do the same thing in both cases.
     12        (WebCore::HTMLMediaElement::suspend): Rename from documentWillBecomeInactive.
     13        (WebCore::HTMLMediaElement::resume): Rename from documentDidBecomeActive.
     14        (WebCore::HTMLMediaElement::hasPendingActivity): Return true if the event queue is not empty
     15        so the element can't be collected before they are sent.
     16        * html/HTMLMediaElement.h:
     17        (WebCore::HTMLMediaElement::canSuspend):
     18
    1192010-09-07  Dimitri Glazkov  <dglazkov@chromium.org>
    220
  • trunk/WebCore/html/HTMLMediaElement.cpp

    r66815 r66895  
    3030
    3131#include "Attribute.h"
    32 #include "CSSHelper.h"
    33 #include "CSSPropertyNames.h"
    34 #include "CSSValueKeywords.h"
    3532#include "Chrome.h"
    3633#include "ChromeClient.h"
     
    3835#include "ClientRectList.h"
    3936#include "ContentType.h"
     37#include "CSSHelper.h"
     38#include "CSSPropertyNames.h"
     39#include "CSSValueKeywords.h"
    4040#include "Event.h"
    4141#include "EventNames.h"
     
    4949#include "HTMLSourceElement.h"
    5050#include "HTMLVideoElement.h"
    51 #include "MIMETypeRegistry.h"
    5251#include "MediaDocument.h"
    5352#include "MediaError.h"
     
    5554#include "MediaPlayer.h"
    5655#include "MediaQueryEvaluator.h"
     56#include "MIMETypeRegistry.h"
    5757#include "Page.h"
    5858#include "RenderVideo.h"
     
    8181using namespace HTMLNames;
    8282
    83 HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* doc)
    84     : HTMLElement(tagName, doc)
     83HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* document)
     84    : HTMLElement(tagName, document)
     85    , ActiveDOMObject(document, this)
    8586    , m_loadTimer(this, &HTMLMediaElement::loadTimerFired)
    8687    , m_asyncEventTimer(this, &HTMLMediaElement::asyncEventTimerFired)
     
    133134    , m_completelyLoaded(false)
    134135{
    135     document()->registerForDocumentActivationCallbacks(this);
    136     document()->registerForMediaVolumeCallbacks(this);
     136    document->registerForDocumentActivationCallbacks(this);
     137    document->registerForMediaVolumeCallbacks(this);
    137138}
    138139
     
    18501851}
    18511852
    1852 void HTMLMediaElement::documentWillBecomeInactive()
     1853bool HTMLMediaElement::canSuspend() const
     1854{
     1855    return true;
     1856}
     1857
     1858void HTMLMediaElement::stop()
     1859{
     1860    suspend();
     1861}
     1862
     1863void HTMLMediaElement::suspend()
    18531864{
    18541865    if (m_isFullscreen)
     
    18681879}
    18691880
    1870 void HTMLMediaElement::documentDidBecomeActive()
     1881void HTMLMediaElement::resume()
    18711882{
    18721883    m_inActiveDocument = true;
     
    18861897}
    18871898
     1899bool HTMLMediaElement::hasPendingActivity() const
     1900{
     1901    // Return true when we have pending events so we can't fire events after the JS
     1902    // object gets collected.
     1903    return m_pendingEvents.size();
     1904}
     1905
    18881906void HTMLMediaElement::mediaVolumeDidChange()
    18891907{
  • trunk/WebCore/html/HTMLMediaElement.h

    r66710 r66895  
    3030
    3131#include "HTMLElement.h"
     32#include "ActiveDOMObject.h"
    3233#include "MediaCanStartListener.h"
    3334#include "MediaPlayer.h"
     
    5253// no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement.
    5354
    54 class HTMLMediaElement : public HTMLElement, public MediaPlayerClient, private MediaCanStartListener {
     55class HTMLMediaElement : public HTMLElement, public MediaPlayerClient, private MediaCanStartListener, private ActiveDOMObject {
    5556public:
    5657    MediaPlayer* player() const { return m_player.get(); }
     
    197198    void setTimeOffsetAttribute(const QualifiedName&, float value);
    198199   
    199     virtual void documentWillBecomeInactive();
    200     virtual void documentDidBecomeActive();
     200    // ActiveDOMObject functions.
     201    virtual bool canSuspend() const;
     202    virtual void suspend();
     203    virtual void resume();
     204    virtual void stop();
     205    virtual bool hasPendingActivity() const;
     206   
    201207    virtual void mediaVolumeDidChange();
    202208
Note: See TracChangeset for help on using the changeset viewer.