Move MetaProfiler from the backend to core

It's not really a backend thing, and we'll want to profile e.g. loading
the backend too, so create it very early and destroy it very late and
let MetaContextMain own it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2678>
This commit is contained in:
Jonas Ådahl
2022-10-12 22:30:07 +02:00
committed by Marge Bot
parent 50288d1ead
commit ca2057da9a
6 changed files with 20 additions and 20 deletions

View File

@ -31,6 +31,10 @@
#include "core/prefs-private.h"
#include "core/util-private.h"
#ifdef HAVE_PROFILER
#include "core/meta-profiler.h"
#endif
#ifdef HAVE_WAYLAND
#include "wayland/meta-wayland.h"
#endif
@ -81,6 +85,10 @@ typedef struct _MetaContextPrivate
#ifdef RLIMIT_NOFILE
struct rlimit saved_rlimit_nofile;
#endif
#ifdef HAVE_PROFILER
MetaProfiler *profiler;
#endif
} MetaContextPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (MetaContext, meta_context, G_TYPE_OBJECT)
@ -689,6 +697,10 @@ meta_context_finalize (GObject *object)
MetaContext *context = META_CONTEXT (object);
MetaContextPrivate *priv = meta_context_get_instance_private (context);
#ifdef HAVE_PROFILER
g_clear_object (&priv->profiler);
#endif
g_clear_pointer (&priv->gnome_wm_keybindings, g_free);
g_clear_pointer (&priv->plugin_name, g_free);
g_clear_pointer (&priv->name, g_free);
@ -734,6 +746,10 @@ meta_context_init (MetaContext *context)
MetaContextPrivate *priv = meta_context_get_instance_private (context);
g_autoptr (GError) error = NULL;
#ifdef HAVE_PROFILER
priv->profiler = meta_profiler_new ();
#endif
priv->plugin_gtype = G_TYPE_NONE;
priv->gnome_wm_keybindings = g_strdup ("Mutter");