[gnome-shell/wip/chergert/3-28-perf-fixes: 11/11] ShellAppSystem: use ShellAppCache to access GAppInfo
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/chergert/3-28-perf-fixes: 11/11] ShellAppSystem: use ShellAppCache to access GAppInfo
- Date: Thu, 27 Feb 2020 07:49:00 +0000 (UTC)
commit b5b65c33ea9ed5ebc221ec7307e7507ecb05681c
Author: Christian Hergert <chergert redhat com>
Date: Wed Feb 26 23:26:32 2020 -0800
ShellAppSystem: use ShellAppCache to access GAppInfo
Instead of accessing the application information using GAppInfo directly,
we want to access the cached version from ShellAppCache to ensure that we
do not perform disk I/O from the compositor thread.
src/shell-app-system.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/src/shell-app-system.c b/src/shell-app-system.c
index 8edf757a90..da8699581a 100644
--- a/src/shell-app-system.c
+++ b/src/shell-app-system.c
@@ -9,6 +9,7 @@
#include <gio/gio.h>
#include <glib/gi18n.h>
+#include "shell-app-cache.h"
#include "shell-app-private.h"
#include "shell-window-tracker-private.h"
#include "shell-app-system-private.h"
@@ -86,7 +87,7 @@ scan_startup_wm_class_to_id (ShellAppSystem *self)
g_hash_table_remove_all (priv->startup_wm_class_to_id);
- apps = g_app_info_get_all ();
+ apps = shell_app_cache_get_all (NULL);
for (l = apps; l != NULL; l = l->next)
{
GAppInfo *info = l->data;
@@ -119,7 +120,7 @@ app_is_stale (ShellApp *app)
if (shell_app_is_window_backed (app))
return FALSE;
- info = g_desktop_app_info_new (shell_app_get_id (app));
+ info = shell_app_cache_get_info (NULL, shell_app_get_id (app));
if (!info)
return TRUE;
@@ -157,11 +158,9 @@ stale_app_remove_func (gpointer key,
}
static void
-installed_changed (GAppInfoMonitor *monitor,
- gpointer user_data)
+installed_changed (ShellAppCache *app_cache,
+ ShellAppSystem *self)
{
- ShellAppSystem *self = user_data;
-
scan_startup_wm_class_to_id (self);
g_hash_table_foreach_remove (self->priv->id_to_app, stale_app_remove_func, NULL);
@@ -173,7 +172,7 @@ static void
shell_app_system_init (ShellAppSystem *self)
{
ShellAppSystemPrivate *priv;
- GAppInfoMonitor *monitor;
+ ShellAppCache *app_cache;
self->priv = priv = shell_app_system_get_instance_private (self);
@@ -184,9 +183,9 @@ shell_app_system_init (ShellAppSystem *self)
priv->startup_wm_class_to_id = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
- monitor = g_app_info_monitor_get ();
- g_signal_connect (monitor, "changed", G_CALLBACK (installed_changed), self);
- installed_changed (monitor, self);
+ app_cache = shell_app_cache_get_default ();
+ g_signal_connect (app_cache, "changed", G_CALLBACK (installed_changed), self);
+ installed_changed (app_cache, self);
}
static void
@@ -237,7 +236,7 @@ shell_app_system_lookup_app (ShellAppSystem *self,
if (app)
return app;
- info = g_desktop_app_info_new (id);
+ info = shell_app_cache_get_info (NULL, id);
if (!info)
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]