Changeset 226664 in webkit


Ignore:
Timestamp:
Jan 9, 2018 3:47:37 PM (6 years ago)
Author:
jer.noble@apple.com
Message:

Many CVDisplayLink threads created and destroyed while watching a YouTube video
https://bugs.webkit.org/show_bug.cgi?id=181396

Reviewed by Simon Fraser.

When watching some YouTube videos (or any video with default controls), event handlers for
the "timeupdate" event which use rAF will cause the underlying platform objects to be
destroyed in between "timeupdate" events being fired, since they occur every 250ms, and rAF
objects are destroyed every 166ms (or 10/60hz). Update this constant to destroy the
underlying objects every 333ms (or 20/60hz) so that this common pattern doesn't lead to
excessive rAF platform object turnover.

  • platform/Logging.h:
  • platform/graphics/DisplayRefreshMonitor.h:

(WebCore::DisplayRefreshMonitor::shouldBeTerminated const):

  • platform/graphics/DisplayRefreshMonitor.cpp:

(WebCore::DisplayRefreshMonitor::displayDidRefresh):

  • platform/graphics/DisplayRefreshMonitorManager.cpp:

(WebCore::DisplayRefreshMonitorManager::createMonitorForClient):
(WebCore::DisplayRefreshMonitorManager::displayDidRefresh):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r226660 r226664  
     12018-01-09  Jer Noble  <jer.noble@apple.com>
     2
     3        Many CVDisplayLink threads created and destroyed while watching a YouTube video
     4        https://bugs.webkit.org/show_bug.cgi?id=181396
     5
     6        Reviewed by Simon Fraser.
     7
     8        When watching some YouTube videos (or any video with default controls), event handlers for
     9        the "timeupdate" event which use rAF will cause the underlying platform objects to be
     10        destroyed in between "timeupdate" events being fired, since they occur every 250ms, and rAF
     11        objects are destroyed every 166ms (or 10/60hz). Update this constant to destroy the
     12        underlying objects every 333ms (or 20/60hz) so that this common pattern doesn't lead to
     13        excessive rAF platform object turnover.
     14
     15        * platform/Logging.h:
     16        * platform/graphics/DisplayRefreshMonitor.h:
     17        (WebCore::DisplayRefreshMonitor::shouldBeTerminated const):
     18        * platform/graphics/DisplayRefreshMonitor.cpp:
     19        (WebCore::DisplayRefreshMonitor::displayDidRefresh):
     20        * platform/graphics/DisplayRefreshMonitorManager.cpp:
     21        (WebCore::DisplayRefreshMonitorManager::createMonitorForClient):
     22        (WebCore::DisplayRefreshMonitorManager::displayDidRefresh):
     23
    1242018-01-09  Zalan Bujtas  <zalan@apple.com>
    225
  • trunk/Source/WebCore/platform/Logging.h

    r225449 r226664  
    7979    M(Progress) \
    8080    M(RemoteInspector) \
     81    M(RequestAnimationFrame) \
    8182    M(ResourceLoading) \
    8283    M(ResourceLoadObserver) \
  • trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp

    r225509 r226664  
    8686    {
    8787        LockHolder lock(m_mutex);
     88        LOG(RequestAnimationFrame, "DisplayRefreshMonitor::displayDidRefresh(%p) - m_scheduled(%d), m_unscheduledFireCount(%d)", this, m_scheduled, m_unscheduledFireCount);
    8889        if (!m_scheduled)
    8990            ++m_unscheduledFireCount;
  • trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h

    r224797 r226664  
    5757    bool shouldBeTerminated() const
    5858    {
    59         const int maxInactiveFireCount = 10;
     59        const int maxInactiveFireCount = 20;
    6060        return !m_scheduled && m_unscheduledFireCount > maxInactiveFireCount;
    6161    }
  • trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp

    r223728 r226664  
    3131#include "DisplayRefreshMonitor.h"
    3232#include "DisplayRefreshMonitorClient.h"
     33#include "Logging.h"
    3334#include <wtf/CurrentTime.h>
    3435
     
    5758        return nullptr;
    5859
     60    LOG(RequestAnimationFrame, "DisplayRefreshMonitorManager::createMonitorForClient() - created monitor %p", monitor.get());
    5961    monitor->addClient(client);
    6062    DisplayRefreshMonitor* result = monitor.get();
     
    106108    if (!monitor.shouldBeTerminated())
    107109        return;
     110    LOG(RequestAnimationFrame, "DisplayRefreshMonitorManager::displayDidRefresh() - destroying monitor %p", &monitor);
    108111
    109112    size_t monitorIndex = m_monitors.find(&monitor);
Note: See TracChangeset for help on using the changeset viewer.