[gnome-software/wip/hughsie/vnd.flatpak.ref: 14/16] trivial: Don't call gs_plugin_refine_item_metadata() multiple times
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/hughsie/vnd.flatpak.ref: 14/16] trivial: Don't call gs_plugin_refine_item_metadata() multiple times
- Date: Tue, 20 Sep 2016 11:35:35 +0000 (UTC)
commit 46c38cfcdaa3e50900ed2968c4ebed146a8ee53a
Author: Richard Hughes <richard hughsie com>
Date: Tue Sep 20 10:43:58 2016 +0100
trivial: Don't call gs_plugin_refine_item_metadata() multiple times
Also, add some profiling as it's kinda expensive...
src/plugins/gs-flatpak.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index 41afdba..2ae5a29 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -1357,22 +1357,33 @@ gs_flatpak_set_app_metadata (GsFlatpak *self,
static gboolean
gs_plugin_refine_item_metadata (GsFlatpak *self,
- GsApp *app,
- GCancellable *cancellable,
- GError **error)
+ GsApp *app,
+ GCancellable *cancellable,
+ GError **error)
{
const gchar *str;
gsize len = 0;
g_autofree gchar *contents = NULL;
g_autofree gchar *installation_path_str = NULL;
g_autofree gchar *install_path = NULL;
+ g_autoptr(AsProfileTask) ptask = NULL;
g_autoptr(GBytes) data = NULL;
g_autoptr(GFile) installation_path = NULL;
+ /* profile */
+ ptask = as_profile_start (gs_plugin_get_profile (self->plugin),
+ "flatpak::refine-metadata{%s}",
+ gs_app_get_id (app));
+ g_assert (ptask != NULL);
+
/* not applicable */
if (gs_app_get_flatpak_kind (app) != FLATPAK_REF_KIND_APP)
return TRUE;
+ /* already done */
+ if (gs_app_has_kudo (app, GS_APP_KUDO_SANDBOXED))
+ return TRUE;
+
/* this is quicker than doing network IO */
installation_path = flatpak_installation_get_path (self->installation);
installation_path_str = g_file_get_path (installation_path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]