From a416650f6bf7bf54e23dcc49ec71cb2449d1bb5f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 19 Aug 2020 16:26:51 -0400 Subject: [PATCH] application: Drop support for profiler activation Drop support for the org.gnome.Sysprof3.Profiler D-Bus interface. It is not really used, and if we don't expose it, we can simplify our profiler infrastructure. --- gtk/gtkapplication.c | 132 ------------------------------------------- 1 file changed, 132 deletions(-) diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c index 62e83fe7ac..4a5c473685 100644 --- a/gtk/gtkapplication.c +++ b/gtk/gtkapplication.c @@ -157,7 +157,6 @@ typedef struct GtkActionMuxer *muxer; GtkBuilder *menus_builder; char *help_overlay_path; - guint profiler_id; } GtkApplicationPrivate; G_DEFINE_TYPE_WITH_PRIVATE (GtkApplication, gtk_application, G_TYPE_APPLICATION) @@ -502,135 +501,6 @@ gtk_application_finalize (GObject *object) G_OBJECT_CLASS (gtk_application_parent_class)->finalize (object); } -#ifdef G_OS_UNIX - -static const char org_gnome_Sysprof3_Profiler_xml[] = - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - ""; - -static GDBusInterfaceInfo *org_gnome_Sysprof3_Profiler; - -static void -sysprof_profiler_method_call (GDBusConnection *connection, - const char *sender, - const char *object_path, - const char *interface_name, - const char *method_name, - GVariant *parameters, - GDBusMethodInvocation *invocation, - gpointer user_data) -{ - if (strcmp (method_name, "Start") == 0) - { - GDBusMessage *message; - GUnixFDList *fd_list; - GVariant *options; - int fd = -1; - int idx; - - if (GDK_PROFILER_IS_RUNNING) - { - g_dbus_method_invocation_return_error (invocation, - G_DBUS_ERROR, - G_DBUS_ERROR_FAILED, - "Profiler already running"); - return; - } - - g_variant_get (parameters, "(@a{sv}h)", &options, &idx); - - message = g_dbus_method_invocation_get_message (invocation); - fd_list = g_dbus_message_get_unix_fd_list (message); - if (fd_list) - fd = g_unix_fd_list_get (fd_list, idx, NULL); - - gdk_profiler_start (fd); - - g_variant_unref (options); - } - else if (strcmp (method_name, "Stop") == 0) - { - if (!GDK_PROFILER_IS_RUNNING) - { - g_dbus_method_invocation_return_error (invocation, - G_DBUS_ERROR, - G_DBUS_ERROR_FAILED, - "Profiler not running"); - return; - } - - gdk_profiler_stop (); - } - else - { - g_dbus_method_invocation_return_error (invocation, - G_DBUS_ERROR, - G_DBUS_ERROR_UNKNOWN_METHOD, - "Unknown method"); - return; - } - - g_dbus_method_invocation_return_value (invocation, NULL); -} - -static gboolean -gtk_application_dbus_register (GApplication *application, - GDBusConnection *connection, - const char *object_path, - GError **error) -{ - GtkApplicationPrivate *priv = gtk_application_get_instance_private (GTK_APPLICATION (application)); - GDBusInterfaceVTable vtable = { - sysprof_profiler_method_call, - NULL, - NULL - }; - - if (org_gnome_Sysprof3_Profiler == NULL) - { - GDBusNodeInfo *info; - - info = g_dbus_node_info_new_for_xml (org_gnome_Sysprof3_Profiler_xml, error); - if (info == NULL) - return FALSE; - - org_gnome_Sysprof3_Profiler = g_dbus_node_info_lookup_interface (info, "org.gnome.Sysprof3.Profiler"); - g_dbus_interface_info_ref (org_gnome_Sysprof3_Profiler); - g_dbus_node_info_unref (info); - } - - priv->profiler_id = g_dbus_connection_register_object (connection, - "/org/gtk/Profiler", - org_gnome_Sysprof3_Profiler, - &vtable, - NULL, - NULL, - error); - - return TRUE; -} - -static void -gtk_application_dbus_unregister (GApplication *application, - GDBusConnection *connection, - const char *object_path) -{ - GtkApplicationPrivate *priv = gtk_application_get_instance_private (GTK_APPLICATION (application)); - - g_dbus_connection_unregister_object (connection, priv->profiler_id); -} - -#else - static gboolean gtk_application_dbus_register (GApplication *application, GDBusConnection *connection, @@ -647,8 +517,6 @@ gtk_application_dbus_unregister (GApplication *application, { } -#endif - static void gtk_application_class_init (GtkApplicationClass *class) {