Name all the GLib timeout sources
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Oct 2013 15:22:29 +0000 (15:22 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Oct 2013 15:22:29 +0000 (15:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=123229

Patch by Bastien Nocera <hadess@hadess.net> on 2013-10-28
Reviewed by Anders Carlsson.

Source/WebCore:

Give a name to GLib timeout sources, this is helpful when
profiling WebKitGTK applications.

No new tests, no change in functionality.

Source/WebKit/gtk:

Give a name to GLib timeout sources, this is helpful when
profiling WebKitGTK applications.

Source/WebKit2:

Give a name to GLib timeout sources, this is helpful when
profiling WebKitGTK applications.

Tools:

Give a name to GLib timeout sources, this is helpful when
profiling WebKitGTK applications.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158110 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp
Source/WebCore/platform/graphics/gtk/FullscreenVideoControllerGtk.cpp
Source/WebCore/platform/gtk/SharedTimerGtk.cpp
Source/WebCore/plugins/gtk/gtk2xtbin.c
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp
Tools/ChangeLog
Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp
Tools/GtkLauncher/main.c
Tools/MiniBrowser/gtk/BrowserWindow.c
Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp
Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp

index 8c043f0..dc7c5a3 100644 (file)
@@ -1,3 +1,15 @@
+2013-10-28  Bastien Nocera <hadess@hadess.net>
+
+        Name all the GLib timeout sources
+        https://bugs.webkit.org/show_bug.cgi?id=123229
+
+        Reviewed by Anders Carlsson.
+
+        Give a name to GLib timeout sources, this is helpful when
+        profiling WebKitGTK applications.
+
+        No new tests, no change in functionality.
+
 2013-10-28  Philippe Normand  <pnormand@igalia.com>
 
         MediaStreamTrackPrivate's m_client uninitialized
index 625e9ed..20bab5e 100644 (file)
@@ -450,6 +450,7 @@ bool MediaPlayerPrivateGStreamer::changePipelineState(GstState newState)
     // See also https://bugs.webkit.org/show_bug.cgi?id=117354
     if (newState == GST_STATE_READY && !m_readyTimerHandler) {
         m_readyTimerHandler = g_timeout_add_seconds(gReadyStateTimerInterval, reinterpret_cast<GSourceFunc>(mediaPlayerPrivateReadyStateTimeoutCallback), this);
+        g_source_set_name_by_id(m_readyTimerHandler, "[WebKit] mediaPlayerPrivateReadyStateTimeoutCallback");
     } else if (newState != GST_STATE_READY && m_readyTimerHandler) {
         g_source_remove(m_readyTimerHandler);
         m_readyTimerHandler = 0;
index 8160469..cfff3d1 100644 (file)
@@ -270,6 +270,7 @@ static GstFlowReturn webkitVideoSinkRender(GstBaseSink* baseSink, GstBuffer* buf
     // See: https://bugzilla.gnome.org/show_bug.cgi?id=610830.
     priv->timeoutId = g_timeout_add_full(G_PRIORITY_DEFAULT, 0, webkitVideoSinkTimeoutCallback,
                                           gst_object_ref(sink), reinterpret_cast<GDestroyNotify>(gst_object_unref));
+    g_source_set_name_by_id(priv->timeoutId, "[WebKit] webkitVideoSinkTimeoutCallback");
 
     g_cond_wait(priv->dataCondition, priv->bufferMutex);
     g_mutex_unlock(priv->bufferMutex);
index a2f08b6..fc46029 100644 (file)
@@ -170,12 +170,16 @@ void FullscreenVideoControllerGtk::showHud(bool autoHide)
     updateHudPosition();
 
     // Start periodic updates of the progress bar.
-    if (!m_progressBarUpdateId)
+    if (!m_progressBarUpdateId) {
         m_progressBarUpdateId = g_timeout_add(PROGRESS_BAR_UPDATE_INTERVAL, reinterpret_cast<GSourceFunc>(progressBarUpdateCallback), this);
+        g_source_set_name_by_id(m_progressBarUpdateId, "[WebKit] progressBarUpdateCallback");
+    }
 
     // Hide the hud in few seconds, if requested.
-    if (autoHide)
+    if (autoHide) {
         m_hudTimeoutId = g_timeout_add(HUD_AUTO_HIDE_INTERVAL, reinterpret_cast<GSourceFunc>(hideHudCallback), this);
+        g_source_set_name_by_id(m_hudTimeoutId, "[WebKit] hideHudCallback");
+    }
 }
 
 void FullscreenVideoControllerGtk::hideHud()
@@ -446,6 +450,7 @@ void FullscreenVideoControllerGtk::createHud()
     gtk_box_pack_start(GTK_BOX(hbox), item, FALSE, TRUE, 0);
 
     m_progressBarUpdateId = g_timeout_add(PROGRESS_BAR_UPDATE_INTERVAL, reinterpret_cast<GSourceFunc>(progressBarUpdateCallback), this);
+    g_source_set_name_by_id(m_progressBarUpdateId, "[WebKit] progressBarUpdateCallback");
 
     playStateChanged();
 }
index 431a352..b69a9b8 100644 (file)
@@ -43,7 +43,7 @@ void setSharedTimerFiredFunction(void (*f)())
     sharedTimerFiredFunction = f;
 }
 
-static gboolean timeout_cb(gpointer)
+static gboolean sharedTimerTimeoutCallback(gpointer)
 {
     if (sharedTimerFiredFunction)
         sharedTimerFiredFunction();
@@ -57,7 +57,8 @@ void setSharedTimerFireInterval(double interval)
     guint intervalInMS = static_cast<guint>(interval * 1000);
 
     stopSharedTimer();
-    sharedTimer = g_timeout_add_full(GDK_PRIORITY_REDRAW, intervalInMS, timeout_cb, 0, 0);
+    sharedTimer = g_timeout_add_full(GDK_PRIORITY_REDRAW, intervalInMS, sharedTimerTimeoutCallback, 0, 0);
+    g_source_set_name_by_id(sharedTimer, "[WebKit] sharedTimerTimeoutCallback");
 }
 
 void stopSharedTimer()
index 6db746c..ef75a1f 100644 (file)
@@ -393,6 +393,7 @@ gtk_xtbin_new (GtkWidget *parent_widget, String *f)
       g_timeout_add(25,
                       (GSourceFunc)xt_event_polling_timer_callback,
                       xtdisplay);
+    g_source_set_name_by_id(xt_polling_timer_id, "[WebKit] xt_event_polling_timer_callback");
   }
 
   /* Bump up our usage count */
index 3f5e7ef..bd02182 100644 (file)
@@ -1,5 +1,15 @@
 2013-10-28  Bastien Nocera <hadess@hadess.net>
 
+        Name all the GLib timeout sources
+        https://bugs.webkit.org/show_bug.cgi?id=123229
+
+        Reviewed by Anders Carlsson.
+
+        Give a name to GLib timeout sources, this is helpful when
+        profiling WebKitGTK applications.
+
+2013-10-28  Bastien Nocera <hadess@hadess.net>
+
         Replace 0 timeouts g_timeout_add() by g_idle_add()
         https://bugs.webkit.org/show_bug.cgi?id=123260
 
index 9e3d3a0..f429960 100644 (file)
@@ -169,6 +169,7 @@ bool AcceleratedCompositingContext::renderLayersToWindow(cairo_t* cr, const IntR
         m_needsExtraFlush = false;
         double nextFlush = std::max((1 / gFramesPerSecond) - (currentTime() - m_lastFlushTime), 0.0);
         m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 1000 * nextFlush, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0);
+        g_source_set_name_by_id(m_layerFlushTimerCallbackId, "[WebKit] layerFlushTimerFiredCallback");
     }
 
     return true;
@@ -269,6 +270,7 @@ void AcceleratedCompositingContext::setRootCompositingLayer(GraphicsLayer* graph
     scheduleLayerFlush();
 
     m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 500, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0);
+    g_source_set_name_by_id(m_layerFlushTimerCallbackId, "[WebKit] layerFlushTimerFiredCallback");
 }
 
 void AcceleratedCompositingContext::setNonCompositedContentsNeedDisplay(const IntRect& rect)
@@ -336,6 +338,7 @@ void AcceleratedCompositingContext::scheduleLayerFlush()
     // starve WebCore timers, which have a lower priority.
     double nextFlush = std::max(gScheduleDelay - (currentTime() - m_lastFlushTime), 0.0);
     m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, nextFlush * 1000, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0);
+    g_source_set_name_by_id(m_layerFlushTimerCallbackId, "[WebKit] layerFlushTimerFiredCallback");
 }
 
 bool AcceleratedCompositingContext::flushPendingLayerChanges()
index ef90949..b604dc0 100644 (file)
@@ -1,3 +1,13 @@
+2013-10-28  Bastien Nocera <hadess@hadess.net>
+
+        Name all the GLib timeout sources
+        https://bugs.webkit.org/show_bug.cgi?id=123229
+
+        Reviewed by Anders Carlsson.
+
+        Give a name to GLib timeout sources, this is helpful when
+        profiling WebKitGTK applications.
+
 2013-10-28  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Unreviewed. Fix make distcheck.
index 33228be..70f6c83 100644 (file)
@@ -304,6 +304,7 @@ void LayerTreeHostGtk::layerFlushTimerFired()
         const double targetFPS = 60;
         double nextFlush = std::max((1 / targetFPS) - (currentTime() - m_lastFlushTime), 0.0);
         m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, nextFlush * 1000.0, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0);
+        g_source_set_name_by_id(m_layerFlushTimerCallbackId, "[WebKit] layerFlushTimerFiredCallback");
     }
 }
 
@@ -402,8 +403,10 @@ void LayerTreeHostGtk::scheduleLayerFlush()
         return;
 
     // We use a GLib timer because otherwise GTK+ event handling during dragging can starve WebCore timers, which have a lower priority.
-    if (!m_layerFlushTimerCallbackId)
+    if (!m_layerFlushTimerCallbackId) {
         m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 0, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0);
+        g_source_set_name_by_id(m_layerFlushTimerCallbackId, "[WebKit] layerFlushTimerFiredCallback");
+    }
 }
 
 void LayerTreeHostGtk::setLayerFlushSchedulingEnabled(bool layerFlushingEnabled)
index 48a61df..535fd7e 100644 (file)
@@ -1,5 +1,15 @@
 2013-10-28  Bastien Nocera <hadess@hadess.net>
 
+        Name all the GLib timeout sources
+        https://bugs.webkit.org/show_bug.cgi?id=123229
+
+        Reviewed by Anders Carlsson.
+
+        Give a name to GLib timeout sources, this is helpful when
+        profiling WebKitGTK applications.
+
+2013-10-28  Bastien Nocera <hadess@hadess.net>
+
         Replace 0 timeouts g_timeout_add() by g_idle_add()
         https://bugs.webkit.org/show_bug.cgi?id=123260
 
index 265fb5c..f6709d5 100644 (file)
@@ -314,8 +314,11 @@ void TestRunner::setWaitToDump(bool waitUntilDone)
     static const int timeoutSeconds = 30;
 
     m_waitToDump = waitUntilDone;
-    if (m_waitToDump && shouldSetWaitToDumpWatchdog())
-        setWaitToDumpWatchdog(g_timeout_add_seconds(timeoutSeconds, waitToDumpWatchdogFired, 0));
+    if (m_waitToDump && shouldSetWaitToDumpWatchdog()) {
+        guint id = g_timeout_add_seconds(timeoutSeconds, waitToDumpWatchdogFired, 0);
+        g_source_set_name_by_id(id, "[WebKit] waitToDumpWatchdogFired");
+        setWaitToDumpWatchdog(id);
+    }
 }
 
 int TestRunner::windowCount()
index cbbfed1..7e9d2cd 100644 (file)
@@ -157,7 +157,8 @@ static gboolean webViewWindowStateEvent(GtkWidget *widget, GdkEventWindowState *
                                                     GTK_BUTTONS_CLOSE,
                                                     "%s is now full screen. Press ESC or f to exit.", uri);
         g_signal_connect_swapped(dialog, "response", G_CALLBACK(gtk_widget_destroy), dialog);
-        g_timeout_add(1500, (GSourceFunc) webViewFullscreenMessageWindowClose, dialog);
+        guint id = g_timeout_add(1500, (GSourceFunc) webViewFullscreenMessageWindowClose, dialog);
+        g_source_set_name_by_id(id, "[WebKit] webViewFullscreenMessageWindowClose");
         gtk_dialog_run(GTK_DIALOG(dialog));
     }
     return TRUE;
index 3efd390..1d3b4fc 100644 (file)
@@ -163,8 +163,10 @@ static void webViewLoadProgressChanged(WebKitWebView *webView, GParamSpec *pspec
 {
     gdouble progress = webkit_web_view_get_estimated_load_progress(webView);
     gtk_entry_set_progress_fraction(GTK_ENTRY(window->uriEntry), progress);
-    if (progress == 1.0)
-        g_timeout_add(500, (GSourceFunc)resetEntryProgress, window->uriEntry);
+    if (progress == 1.0) {
+        guint id = g_timeout_add(500, (GSourceFunc)resetEntryProgress, window->uriEntry);
+        g_source_set_name_by_id(id, "[WebKit] resetEntryProgress");
+    }
 }
 
 static void downloadStarted(WebKitWebContext *webContext, WebKitDownload *download, BrowserWindow *window)
@@ -311,6 +313,7 @@ static gboolean webViewEnterFullScreen(WebKitWebView *webView, BrowserWindow *wi
     gtk_widget_show(window->fullScreenMessageLabel);
 
     window->fullScreenMessageLabelId = g_timeout_add_seconds(2, (GSourceFunc)fullScreenMessageTimeoutCallback, window);
+    g_source_set_name_by_id(window->fullScreenMessageLabelId, "[WebKit] fullScreenMessageTimeoutCallback");
     gtk_widget_hide(window->toolbar);
     window->searchBarVisible = gtk_widget_get_visible(GTK_WIDGET(window->searchBar));
     browser_search_bar_close(window->searchBar);
index b50a332..427cf2e 100644 (file)
@@ -60,6 +60,7 @@ void TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded()
 
     m_waitToDumpWatchdogTimer = g_timeout_add(waitToDumpWatchdogTimerInterval * 1000,
                                               waitToDumpWatchdogTimerCallback, 0);
+    g_source_set_name_by_id(m_waitToDumpWatchdogTimer, "[WebKit] waitToDumpWatchdogTimerCallback");
 }
 
 JSRetainPtr<JSStringRef> TestRunner::pathToLocalResource(JSStringRef url)
index 4aeb65f..639228c 100644 (file)
@@ -68,8 +68,10 @@ static gboolean timeoutCallback(gpointer)
 void TestController::platformRunUntil(bool&, double timeout)
 {
     cancelTimeout();
-    if (timeout != m_noTimeout)
+    if (timeout != m_noTimeout) {
         gTimeoutSourceId = g_timeout_add(timeout * 1000, timeoutCallback, 0);
+        g_source_set_name_by_id(gTimeoutSourceId, "[WebKit] timeoutCallback");
+    }
     gtk_main();
 }