Changeset 187712 in webkit


Ignore:
Timestamp:
Jul 31, 2015 11:39:36 PM (9 years ago)
Author:
mrajca@apple.com
Message:

Media Session: give media elements unique IDs https://bugs.webkit.org/show_bug.cgi?id=147322

Reviewed by Eric Carlson.

  • html/HTMLMediaElement.cpp:

(WebCore::elementIDsToElements): Create a global map of element IDs to elements.
(WebCore::HTMLMediaElement::elementWithID): Retrieve the element with the given ID.
(WebCore::HTMLMediaElement::HTMLMediaElement): Give the element a unique ID.
(WebCore::HTMLMediaElement::playInternal): Removed whitespace.
(WebCore::HTMLMediaElement::pauseInternal): Ditto.

  • html/HTMLMediaElement.h:

(WebCore::HTMLMediaElement::elementID):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r187709 r187712  
     12015-07-27  Matt Rajca  <mrajca@apple.com>
     2
     3        Media Session: give media elements unique IDs
     4        https://bugs.webkit.org/show_bug.cgi?id=147322
     5
     6        Reviewed by Eric Carlson.
     7
     8        * html/HTMLMediaElement.cpp:
     9        (WebCore::elementIDsToElements): Create a global map of element IDs to elements.
     10        (WebCore::HTMLMediaElement::elementWithID): Retrieve the element with the given ID.
     11        (WebCore::HTMLMediaElement::HTMLMediaElement): Give the element a unique ID.
     12        (WebCore::HTMLMediaElement::playInternal): Removed whitespace.
     13        (WebCore::HTMLMediaElement::pauseInternal): Ditto.
     14        * html/HTMLMediaElement.h:
     15        (WebCore::HTMLMediaElement::elementID):
     16
    1172015-07-31  Myles C. Maxfield  <mmaxfield@apple.com>
    218
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r187688 r187712  
    289289}
    290290
     291#if ENABLE(MEDIA_SESSION)
     292typedef HashMap<uint64_t, HTMLMediaElement*> IDToElementMap;
     293
     294static IDToElementMap& elementIDsToElements()
     295{
     296    static NeverDestroyed<IDToElementMap> map;
     297    return map;
     298}
     299
     300HTMLMediaElement* HTMLMediaElement::elementWithID(uint64_t id)
     301{
     302    return elementIDsToElements().get(id);
     303}
     304
     305static uint64_t nextElementID()
     306{
     307    static uint64_t elementID = 0;
     308    return ++elementID;
     309}
     310#endif
     311
    291312HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& document, bool createdByParser)
    292313    : HTMLElement(tagName, document)
     
    417438
    418439#if ENABLE(MEDIA_SESSION)
     440    m_elementID = nextElementID();
     441    elementIDsToElements().add(m_elementID, this);
     442
    419443    setSessionInternal(document.defaultMediaSession());
    420444#endif
     
    28542878        return;
    28552879    }
    2856    
     2880
    28572881    // 4.8.10.9. Playing the media resource
    28582882    if (!m_player || m_networkState == NETWORK_EMPTY)
     
    29202944        return;
    29212945    }
    2922    
     2946
    29232947    // 4.8.10.9. Playing the media resource
    29242948    if (!m_player || m_networkState == NETWORK_EMPTY) {
  • trunk/Source/WebCore/html/HTMLMediaElement.h

    r187655 r187712  
    430430
    431431    void setShouldDuck(bool);
     432
     433    static HTMLMediaElement* elementWithID(uint64_t);
     434    uint64_t elementID() const { return m_elementID; }
    432435#endif
    433436
     
    831834    RefPtr<MediaSession> m_session;
    832835    bool m_shouldDuck { false };
     836    uint64_t m_elementID;
    833837#endif
    834838
Note: See TracChangeset for help on using the changeset viewer.