Changeset 248853 in webkit


Ignore:
Timestamp:
Aug 19, 2019 8:46:04 AM (5 years ago)
Author:
youenn@apple.com
Message:

Stop MediaDevices timer when stopping MediaDevices
https://bugs.webkit.org/show_bug.cgi?id=200880

Reviewed by Eric Carlson.

No change of behavior.
Stop timer when stopping MediaDevices and check for MediaDevices being stopped before scheduling the timer.

  • Modules/mediastream/MediaDevices.cpp:

(WebCore::MediaDevices::stop):
Remove document/controller check since at that point,
the document should not be null and the controller should be there.
(WebCore::MediaDevices::scheduledEventTimerFired):
(WebCore::MediaDevices::listenForDeviceChanges):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r248851 r248853  
     12019-08-19  Youenn Fablet  <youenn@apple.com>
     2
     3        Stop MediaDevices timer when stopping MediaDevices
     4        https://bugs.webkit.org/show_bug.cgi?id=200880
     5
     6        Reviewed by Eric Carlson.
     7
     8        No change of behavior.
     9        Stop timer when stopping MediaDevices and check for MediaDevices being stopped before scheduling the timer.
     10
     11        * Modules/mediastream/MediaDevices.cpp:
     12        (WebCore::MediaDevices::stop):
     13        Remove document/controller check since at that point,
     14        the document should not be null and the controller should be there.
     15        (WebCore::MediaDevices::scheduledEventTimerFired):
     16        (WebCore::MediaDevices::listenForDeviceChanges):
     17
    1182019-08-19  Yusuke Suzuki  <ysuzuki@apple.com>
    219
  • trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp

    r248847 r248853  
    7474{
    7575    if (m_deviceChangeToken) {
    76         auto* document = this->document();
    77         auto* controller = document ? UserMediaController::from(document->page()) : nullptr;
    78         if (document && controller)
    79             controller->removeDeviceChangeObserver(m_deviceChangeToken);
     76        auto* controller = UserMediaController::from(document()->page());
     77        controller->removeDeviceChangeObserver(m_deviceChangeToken);
    8078    }
    8179    m_devices.clear();
     80    m_scheduledEventTimer.stop();
    8281}
    8382
     
    207206void MediaDevices::scheduledEventTimerFired()
    208207{
    209     if (isContextStopped())
    210         return;
    211 
     208    ASSERT(!isContextStopped());
    212209    dispatchEvent(Event::create(eventNames().devicechangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
    213210}
     
    241238
    242239    m_deviceChangeToken = controller->addDeviceChangeObserver([weakThis = makeWeakPtr(*this), this]() {
    243         if (!weakThis || m_scheduledEventTimer.isActive())
     240        if (!weakThis || isContextStopped() || m_scheduledEventTimer.isActive())
    244241            return;
    245242
Note: See TracChangeset for help on using the changeset viewer.