Title: [260630] releases/WebKitGTK/webkit-2.28/Source/WebCore
Revision
260630
Author
[email protected]
Date
2020-04-24 02:20:46 -0700 (Fri, 24 Apr 2020)

Log Message

Merge r260567 - [GTK] excessive wakeups/polling due to gdk_frame_clock_begin_updating
https://bugs.webkit.org/show_bug.cgi?id=210561

Reviewed by Žan Doberšek.

The problem is that we are destroying the display refresh monitor from the frame clock update callback, and GTK
schedules another update from the callback itself in some cases, which ends up happening forever. We were
assuming that destroying the window of immediately destroy the frame clock as well, but the paint source idle
keeps a reference of the frame clock. At the end of the source idle callback the source is scheduled again,
taking a new reference. We need to call gdk_frame_clock_end_updating() to ensure the idle is not scheduled
again.

* platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp:
(WebCore::DisplayRefreshMonitorGtk::~DisplayRefreshMonitorGtk): Disconnect the update signal and call
gdk_frame_clock_end_updating().
(WebCore::DisplayRefreshMonitorGtk::requestRefreshCallback): Toplevel window should always have a frame clock,
so remove the early return and add an assert instead.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.28/Source/WebCore/ChangeLog (260629 => 260630)


--- releases/WebKitGTK/webkit-2.28/Source/WebCore/ChangeLog	2020-04-24 09:20:41 UTC (rev 260629)
+++ releases/WebKitGTK/webkit-2.28/Source/WebCore/ChangeLog	2020-04-24 09:20:46 UTC (rev 260630)
@@ -1,3 +1,23 @@
+2020-04-23  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] excessive wakeups/polling due to gdk_frame_clock_begin_updating
+        https://bugs.webkit.org/show_bug.cgi?id=210561
+
+        Reviewed by Žan Doberšek.
+
+        The problem is that we are destroying the display refresh monitor from the frame clock update callback, and GTK
+        schedules another update from the callback itself in some cases, which ends up happening forever. We were
+        assuming that destroying the window of immediately destroy the frame clock as well, but the paint source idle
+        keeps a reference of the frame clock. At the end of the source idle callback the source is scheduled again,
+        taking a new reference. We need to call gdk_frame_clock_end_updating() to ensure the idle is not scheduled
+        again.
+
+        * platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp:
+        (WebCore::DisplayRefreshMonitorGtk::~DisplayRefreshMonitorGtk): Disconnect the update signal and call
+        gdk_frame_clock_end_updating().
+        (WebCore::DisplayRefreshMonitorGtk::requestRefreshCallback): Toplevel window should always have a frame clock,
+        so remove the early return and add an assert instead.
+
 2020-04-22  Enrique Ocaña González  <[email protected]>
 
         [GStreamer][MSE] Youtube 'live stream'/H264 URLs fail to play, VP8/9 URLs play OK

Modified: releases/WebKitGTK/webkit-2.28/Source/WebCore/platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp (260629 => 260630)


--- releases/WebKitGTK/webkit-2.28/Source/WebCore/platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp	2020-04-24 09:20:41 UTC (rev 260629)
+++ releases/WebKitGTK/webkit-2.28/Source/WebCore/platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp	2020-04-24 09:20:46 UTC (rev 260630)
@@ -40,8 +40,14 @@
 
 DisplayRefreshMonitorGtk::~DisplayRefreshMonitorGtk()
 {
-    if (m_window)
-        gtk_widget_destroy(m_window);
+    if (!m_window)
+        return;
+
+    auto* frameClock = gtk_widget_get_frame_clock(m_window);
+    ASSERT(frameClock);
+    g_signal_handlers_disconnect_matched(frameClock, G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this);
+    gdk_frame_clock_end_updating(frameClock);
+    gtk_widget_destroy(m_window);
 }
 
 static void onFrameClockUpdate(GdkFrameClock*, DisplayRefreshMonitorGtk* monitor)
@@ -60,8 +66,7 @@
         gtk_widget_realize(m_window);
 
         auto* frameClock = gtk_widget_get_frame_clock(m_window);
-        if (!frameClock)
-            return false;
+        ASSERT(frameClock);
 
         g_signal_connect(frameClock, "update", G_CALLBACK(onFrameClockUpdate), this);
         gdk_frame_clock_begin_updating(frameClock);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to