Name unnamed sources

These names show up in GLib traces in sysprof, so let's make sure they
exist.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1928>
This commit is contained in:
Ivan Molodetskikh 2021-07-12 13:54:26 +03:00
parent 2cd9b4775a
commit bcf6ee5e55
9 changed files with 21 additions and 10 deletions

View File

@ -761,7 +761,7 @@ init_frame_clock_source (ClutterFrameClock *frame_clock)
source = g_source_new (&frame_clock_source_funcs, sizeof (ClutterClockSource)); source = g_source_new (&frame_clock_source_funcs, sizeof (ClutterClockSource));
clock_source = (ClutterClockSource *) source; clock_source = (ClutterClockSource *) source;
name = g_strdup_printf ("Clutter frame clock (%p)", frame_clock); name = g_strdup_printf ("[mutter] Clutter frame clock (%p)", frame_clock);
g_source_set_name (source, name); g_source_set_name (source, name);
g_source_set_priority (source, CLUTTER_PRIORITY_REDRAW); g_source_set_priority (source, CLUTTER_PRIORITY_REDRAW);
g_source_set_can_recurse (source, FALSE); g_source_set_can_recurse (source, FALSE);

View File

@ -171,6 +171,7 @@ cogl_glib_renderer_source_new (CoglRenderer *renderer,
source = g_source_new (&cogl_glib_source_funcs, source = g_source_new (&cogl_glib_source_funcs,
sizeof (CoglGLibSource)); sizeof (CoglGLibSource));
g_source_set_name (source, "[mutter] Cogl");
cogl_source = (CoglGLibSource *) source; cogl_source = (CoglGLibSource *) source;
cogl_source->renderer = renderer; cogl_source->renderer = renderer;

View File

@ -1136,6 +1136,7 @@ init_clutter (MetaBackend *backend,
return FALSE; return FALSE;
source = g_source_new (&clutter_source_funcs, sizeof (MetaBackendSource)); source = g_source_new (&clutter_source_funcs, sizeof (MetaBackendSource));
g_source_set_name (source, "[mutter] Backend");
backend_source = (MetaBackendSource *) source; backend_source = (MetaBackendSource *) source;
backend_source->backend = backend; backend_source->backend = backend;
g_source_attach (source, NULL); g_source_attach (source, NULL);

View File

@ -337,6 +337,7 @@ make_watch (MetaIdleMonitor *monitor,
{ {
GSource *source = g_source_new (&idle_monitor_source_funcs, GSource *source = g_source_new (&idle_monitor_source_funcs,
sizeof (GSource)); sizeof (GSource));
g_source_set_name (source, "[mutter] Idle monitor");
g_source_set_callback (source, NULL, watch, NULL); g_source_set_callback (source, NULL, watch, NULL);
if (!monitor->inhibited) if (!monitor->inhibited)

View File

@ -1194,11 +1194,12 @@ static GSourceFuncs pipewire_source_funcs =
static MetaPipeWireSource * static MetaPipeWireSource *
create_pipewire_source (MetaScreenCastStreamSrc *src) create_pipewire_source (MetaScreenCastStreamSrc *src)
{ {
GSource *source;
MetaPipeWireSource *pipewire_source; MetaPipeWireSource *pipewire_source;
pipewire_source = source = g_source_new (&pipewire_source_funcs, sizeof (MetaPipeWireSource));
(MetaPipeWireSource *) g_source_new (&pipewire_source_funcs, g_source_set_name (source, "[mutter] PipeWire");
sizeof (MetaPipeWireSource)); pipewire_source = (MetaPipeWireSource *) source;
pipewire_source->src = src; pipewire_source->src = src;
pipewire_source->pipewire_loop = pw_loop_new (NULL); pipewire_source->pipewire_loop = pw_loop_new (NULL);
if (!pipewire_source->pipewire_loop) if (!pipewire_source->pipewire_loop)

View File

@ -473,6 +473,7 @@ meta_kms_add_source_in_impl (MetaKms *kms,
source = g_source_new (&simple_impl_source_funcs, source = g_source_new (&simple_impl_source_funcs,
sizeof (MetaKmsSimpleImplSource)); sizeof (MetaKmsSimpleImplSource));
g_source_set_name (source, "[mutter] KMS simple impl");
simple_impl_source = (MetaKmsSimpleImplSource *) source; simple_impl_source = (MetaKmsSimpleImplSource *) source;
simple_impl_source->kms = kms; simple_impl_source->kms = kms;
@ -534,6 +535,7 @@ meta_kms_register_fd_in_impl (MetaKms *kms,
meta_assert_in_kms_impl (kms); meta_assert_in_kms_impl (kms);
source = g_source_new (&fd_impl_source_funcs, sizeof (MetaKmsFdImplSource)); source = g_source_new (&fd_impl_source_funcs, sizeof (MetaKmsFdImplSource));
g_source_set_name (source, "[mutter] KMS fd impl");
fd_impl_source = (MetaKmsFdImplSource *) source; fd_impl_source = (MetaKmsFdImplSource *) source;
fd_impl_source->dispatch = dispatch; fd_impl_source->dispatch = dispatch;
fd_impl_source->user_data = user_data; fd_impl_source->user_data = user_data;

View File

@ -1509,6 +1509,7 @@ meta_event_source_new (MetaSeatImpl *seat_impl)
int fd; int fd;
source = g_source_new (&event_funcs, sizeof (MetaEventSource)); source = g_source_new (&event_funcs, sizeof (MetaEventSource));
g_source_set_name (source, "[mutter] Events");
event_source = (MetaEventSource *) source; event_source = (MetaEventSource *) source;
/* setup the source */ /* setup the source */

View File

@ -476,6 +476,7 @@ x_event_source_new (MetaBackend *backend)
XEventSource *x_source; XEventSource *x_source;
source = g_source_new (&x_event_funcs, sizeof (XEventSource)); source = g_source_new (&x_event_funcs, sizeof (XEventSource));
g_source_set_name (source, "[mutter] X events");
x_source = (XEventSource *) source; x_source = (XEventSource *) source;
x_source->backend = backend; x_source->backend = backend;
x_source->event_poll_fd.fd = ConnectionNumber (priv->xdisplay); x_source->event_poll_fd.fd = ConnectionNumber (priv->xdisplay);

View File

@ -117,17 +117,20 @@ static GSourceFuncs wayland_event_source_funcs =
static GSource * static GSource *
wayland_event_source_new (struct wl_display *display) wayland_event_source_new (struct wl_display *display)
{ {
WaylandEventSource *source; GSource *source;
WaylandEventSource *wayland_source;
struct wl_event_loop *loop = wl_display_get_event_loop (display); struct wl_event_loop *loop = wl_display_get_event_loop (display);
source = (WaylandEventSource *) g_source_new (&wayland_event_source_funcs, source = g_source_new (&wayland_event_source_funcs,
sizeof (WaylandEventSource)); sizeof (WaylandEventSource));
source->display = display; g_source_set_name (source, "[mutter] Wayland events");
g_source_add_unix_fd (&source->source, wayland_source = (WaylandEventSource *) source;
wayland_source->display = display;
g_source_add_unix_fd (&wayland_source->source,
wl_event_loop_get_fd (loop), wl_event_loop_get_fd (loop),
G_IO_IN | G_IO_ERR); G_IO_IN | G_IO_ERR);
return &source->source; return &wayland_source->source;
} }
void void