summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ã…dahl <jadahl@gmail.com>2022-10-12 22:30:07 +0200
committerMarge Bot <marge-bot@gnome.org>2022-11-01 21:04:21 +0000
commitca2057da9a392110c3fa8fa83af5b0b678391f45 (patch)
tree162414acd150e4a1053baaa351fdbdf03b40ed9b
parent50288d1eadba3bc51144463753a54797bf86cb2c (diff)
downloadmutter-ca2057da9a392110c3fa8fa83af5b0b678391f45.tar.gz
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>
-rw-r--r--po/POTFILES.in2
-rw-r--r--src/backends/meta-backend.c16
-rw-r--r--src/core/meta-context.c16
-rw-r--r--src/core/meta-profiler.c (renamed from src/backends/meta-profiler.c)2
-rw-r--r--src/core/meta-profiler.h (renamed from src/backends/meta-profiler.h)0
-rw-r--r--src/meson.build4
6 files changed, 20 insertions, 20 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1eec8f38a..ebafa966e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -10,7 +10,6 @@ data/org.gnome.mutter.wayland.gschema.xml.in
src/backends/meta-input-settings.c
src/backends/meta-monitor.c
src/backends/meta-monitor-manager.c
-src/backends/meta-profiler.c
src/backends/x11/meta-clutter-backend-x11.c
src/compositor/compositor.c
src/compositor/meta-background.c
@@ -19,6 +18,7 @@ src/core/display.c
src/core/keybindings.c
src/core/meta-context-main.c
src/core/meta-pad-action-mapper.c
+src/core/meta-profiler.c
src/core/mutter.c
src/core/prefs.c
src/core/util.c
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index 614d1909c..c4be97b2f 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -74,10 +74,6 @@
#include "meta/meta-enum-types.h"
#include "meta/util.h"
-#ifdef HAVE_PROFILER
-#include "backends/meta-profiler.h"
-#endif
-
#ifdef HAVE_REMOTE_DESKTOP
#include "backends/meta-dbus-session-watcher.h"
#include "backends/meta-remote-access-controller-private.h"
@@ -158,10 +154,6 @@ struct _MetaBackendPrivate
MetaRemoteDesktop *remote_desktop;
#endif
-#ifdef HAVE_PROFILER
- MetaProfiler *profiler;
-#endif
-
#ifdef HAVE_LIBWACOM
WacomDeviceDatabase *wacom_db;
#endif
@@ -262,10 +254,6 @@ meta_backend_dispose (GObject *object)
g_clear_object (&priv->settings);
-#ifdef HAVE_PROFILER
- g_clear_object (&priv->profiler);
-#endif
-
g_clear_pointer (&priv->default_seat, clutter_seat_destroy);
g_clear_pointer (&priv->stage, clutter_actor_destroy);
g_clear_pointer (&priv->idle_manager, meta_idle_manager_free);
@@ -1220,10 +1208,6 @@ meta_backend_initable_init (GInitable *initable,
system_bus_gotten_cb,
backend);
-#ifdef HAVE_PROFILER
- priv->profiler = meta_profiler_new ();
-#endif
-
if (!init_clutter (backend, error))
return FALSE;
diff --git a/src/core/meta-context.c b/src/core/meta-context.c
index d50956b9c..9647f5b70 100644
--- a/src/core/meta-context.c
+++ b/src/core/meta-context.c
@@ -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");
diff --git a/src/backends/meta-profiler.c b/src/core/meta-profiler.c
index 7a18b85ce..f4484a2ae 100644
--- a/src/backends/meta-profiler.c
+++ b/src/core/meta-profiler.c
@@ -19,7 +19,7 @@
#include "config.h"
-#include "src/backends/meta-profiler.h"
+#include "src/core/meta-profiler.h"
#include <glib-unix.h>
#include <glib/gi18n.h>
diff --git a/src/backends/meta-profiler.h b/src/core/meta-profiler.h
index aa0d72640..aa0d72640 100644
--- a/src/backends/meta-profiler.h
+++ b/src/core/meta-profiler.h
diff --git a/src/meson.build b/src/meson.build
index f4d5c78df..6790efa16 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -877,8 +877,8 @@ mutter_built_sources += dbus_input_mapping_built_sources
if have_profiler
mutter_sources += [
- 'backends/meta-profiler.c',
- 'backends/meta-profiler.h',
+ 'core/meta-profiler.c',
+ 'core/meta-profiler.h',
]
if sysprof_dep.type_name() == 'pkgconfig'