Title: [260567] trunk/Source/WebCore
- Revision
- 260567
- Author
- [email protected]
- Date
- 2020-04-23 07:33:24 -0700 (Thu, 23 Apr 2020)
Log Message
[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: trunk/Source/WebCore/ChangeLog (260566 => 260567)
--- trunk/Source/WebCore/ChangeLog 2020-04-23 11:36:20 UTC (rev 260566)
+++ trunk/Source/WebCore/ChangeLog 2020-04-23 14:33:24 UTC (rev 260567)
@@ -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-23 Youenn Fablet <[email protected]>
getDisplayMedia is not respecting aspect ratio with max constraints
Modified: trunk/Source/WebCore/platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp (260566 => 260567)
--- trunk/Source/WebCore/platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp 2020-04-23 11:36:20 UTC (rev 260566)
+++ trunk/Source/WebCore/platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp 2020-04-23 14:33:24 UTC (rev 260567)
@@ -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