⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 245357 in webkit


Ignore:
Timestamp:
May 15, 2019, 2:45:08 PM (7 years ago)
Author:
Alan Coon
Message:

Apply patch. rdar://problem/50352476

Location:
branches/safari-607-branch/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-607-branch/Source/WebCore/ChangeLog

    r245354 r245357  
     12019-05-15  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Apply patch. rdar://problem/50352476
     4
     5    2019-05-15  Youenn Fablet  <youenn@apple.com>
     6
     7            Make Document audio producers use WeakPtr
     8            https://bugs.webkit.org/show_bug.cgi?id=197382
     9
     10            Reviewed by Eric Carlson.
     11
     12            Move from a hash set of raw pointers to a hash set of weak pointers.
     13            This helps make the code cleaner.
     14            No observable change of behavior.
     15
     16            * Modules/mediastream/MediaStreamTrack.h:
     17            * dom/Document.cpp:
     18            (WebCore::Document::addAudioProducer):
     19            (WebCore::Document::removeAudioProducer):
     20            (WebCore::Document::updateIsPlayingMedia):
     21            (WebCore::Document::pageMutedStateDidChange):
     22            * dom/Document.h:
     23            * html/HTMLMediaElement.cpp:
     24            (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
     25            * html/HTMLMediaElement.h:
     26            * page/MediaProducer.h:
     27
    1282019-05-14  Kocsen Chung  <kocsen_chung@apple.com>
    229
  • branches/safari-607-branch/Source/WebCore/Modules/mediastream/MediaStreamTrack.h

    r239427 r245357  
    5151    public ActiveDOMObject,
    5252    public EventTargetWithInlineData,
    53     public CanMakeWeakPtr<MediaStreamTrack>,
    54     private MediaProducer,
     53    public MediaProducer,
    5554    private MediaStreamTrackPrivate::Observer {
    5655public:
  • branches/safari-607-branch/Source/WebCore/dom/Document.cpp

    r245346 r245357  
    39813981void Document::addAudioProducer(MediaProducer* audioProducer)
    39823982{
    3983     m_audioProducers.add(audioProducer);
     3983    m_audioProducers.add(audioProducer, makeWeakPtr(audioProducer));
    39843984    updateIsPlayingMedia();
    39853985}
     
    40064006{
    40074007    MediaProducer::MediaStateFlags state = MediaProducer::IsNotPlaying;
    4008     for (auto* audioProducer : m_audioProducers)
    4009         state |= audioProducer->mediaState();
     4008    for (auto& audioProducer : m_audioProducers.values()) {
     4009        if (audioProducer)
     4010            state |= audioProducer.get()->mediaState();
     4011    }
     4012    m_audioProducers.removeIf([](auto iterator) {
     4013        return !iterator.value;
     4014    });
    40104015
    40114016#if ENABLE(MEDIA_SESSION)
     
    40484053void Document::pageMutedStateDidChange()
    40494054{
    4050     for (auto* audioProducer : m_audioProducers)
    4051         audioProducer->pageMutedStateDidChange();
     4055    for (auto& audioProducer : m_audioProducers.values()) {
     4056        if (audioProducer)
     4057            audioProducer.get()->pageMutedStateDidChange();
     4058    }
     4059    m_audioProducers.removeIf([](auto iterator) {
     4060        return !iterator.value;
     4061    });
    40524062}
    40534063
  • branches/safari-607-branch/Source/WebCore/dom/Document.h

    r245346 r245357  
    19091909    Ref<CSSFontSelector> m_fontSelector;
    19101910
    1911     HashSet<MediaProducer*> m_audioProducers;
     1911    HashMap<MediaProducer*, WeakPtr<MediaProducer>> m_audioProducers;
    19121912
    19131913    HashSet<ShadowRoot*> m_inDocumentShadowRoots;
  • branches/safari-607-branch/Source/WebCore/html/HTMLMediaElement.cpp

    r241162 r245357  
    17731773                return;
    17741774
    1775             auto currentMediaTime = weakThis->currentMediaTime();
     1775            auto currentMediaTime = this->currentMediaTime();
    17761776            INFO_LOG(LOGIDENTIFIER, " - lambda, currentMediaTime:", currentMediaTime);
    1777             weakThis->updateActiveTextTrackCues(currentMediaTime);
     1777            this->updateActiveTextTrackCues(currentMediaTime);
    17781778        }, nextInterestingTime);
    17791779    }
  • branches/safari-607-branch/Source/WebCore/html/HTMLMediaElement.h

    r241058 r245357  
    127127    , public ActiveDOMObject
    128128    , public MediaControllerInterface
    129     , public CanMakeWeakPtr<HTMLMediaElement>
    130129    , public PlatformMediaSessionClient
    131130    , private MediaCanStartListener
    132131    , private MediaPlayerClient
    133     , private MediaProducer
     132    , public MediaProducer
    134133    , private VisibilityChangeClient
    135134    , private ApplicationStateChangeListener
  • branches/safari-607-branch/Source/WebCore/page/MediaProducer.h

    r223728 r245357  
    2626#pragma once
    2727
     28#include <wtf/WeakPtr.h>
     29
    2830namespace WebCore {
    2931
    30 class MediaProducer {
     32class MediaProducer : public CanMakeWeakPtr<MediaProducer> {
    3133public:
    3234    enum MediaState {
Note: See TracChangeset for help on using the changeset viewer.