Title: [226664] trunk/Source/WebCore
Revision
226664
Author
[email protected]
Date
2018-01-09 15:47:37 -0800 (Tue, 09 Jan 2018)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (226663 => 226664)


--- trunk/Source/WebCore/ChangeLog	2018-01-09 23:46:48 UTC (rev 226663)
+++ trunk/Source/WebCore/ChangeLog	2018-01-09 23:47:37 UTC (rev 226664)
@@ -1,3 +1,26 @@
+2018-01-09  Jer Noble  <[email protected]>
+
+        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):
+
 2018-01-09  Zalan Bujtas  <[email protected]>
 
         [RenderTreeBuilder] Move RenderElement addChild mutation logic to RenderTreeBuilder

Modified: trunk/Source/WebCore/platform/Logging.h (226663 => 226664)


--- trunk/Source/WebCore/platform/Logging.h	2018-01-09 23:46:48 UTC (rev 226663)
+++ trunk/Source/WebCore/platform/Logging.h	2018-01-09 23:47:37 UTC (rev 226664)
@@ -78,6 +78,7 @@
     M(PopupBlocking) \
     M(Progress) \
     M(RemoteInspector) \
+    M(RequestAnimationFrame) \
     M(ResourceLoading) \
     M(ResourceLoadObserver) \
     M(ResourceLoadStatistics) \

Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp (226663 => 226664)


--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp	2018-01-09 23:46:48 UTC (rev 226663)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp	2018-01-09 23:47:37 UTC (rev 226664)
@@ -85,6 +85,7 @@
 {
     {
         LockHolder lock(m_mutex);
+        LOG(RequestAnimationFrame, "DisplayRefreshMonitor::displayDidRefresh(%p) - m_scheduled(%d), m_unscheduledFireCount(%d)", this, m_scheduled, m_unscheduledFireCount);
         if (!m_scheduled)
             ++m_unscheduledFireCount;
         else

Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h (226663 => 226664)


--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h	2018-01-09 23:46:48 UTC (rev 226663)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h	2018-01-09 23:47:37 UTC (rev 226664)
@@ -56,7 +56,7 @@
 
     bool shouldBeTerminated() const
     {
-        const int maxInactiveFireCount = 10;
+        const int maxInactiveFireCount = 20;
         return !m_scheduled && m_unscheduledFireCount > maxInactiveFireCount;
     }
 

Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp (226663 => 226664)


--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp	2018-01-09 23:46:48 UTC (rev 226663)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp	2018-01-09 23:47:37 UTC (rev 226664)
@@ -30,6 +30,7 @@
 
 #include "DisplayRefreshMonitor.h"
 #include "DisplayRefreshMonitorClient.h"
+#include "Logging.h"
 #include <wtf/CurrentTime.h>
 
 namespace WebCore {
@@ -56,6 +57,7 @@
     if (!monitor)
         return nullptr;
 
+    LOG(RequestAnimationFrame, "DisplayRefreshMonitorManager::createMonitorForClient() - created monitor %p", monitor.get());
     monitor->addClient(client);
     DisplayRefreshMonitor* result = monitor.get();
     m_monitors.append(WTFMove(monitor));
@@ -105,6 +107,7 @@
 {
     if (!monitor.shouldBeTerminated())
         return;
+    LOG(RequestAnimationFrame, "DisplayRefreshMonitorManager::displayDidRefresh() - destroying monitor %p", &monitor);
 
     size_t monitorIndex = m_monitors.find(&monitor);
     if (monitorIndex != notFound)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to