[gnome-software] Do not refine the addons for non-desktop applications



commit 4506006b47f0829d4a946099932824230a191efc
Author: Richard Hughes <richard hughsie com>
Date:   Thu Nov 10 13:53:04 2016 +0000

    Do not refine the addons for non-desktop applications
    
    This speeds up a search operation by about ~8ms by not refining all the addons
    of org.kde.plasmashell (which we don't show anyway).

 src/plugins/gs-appstream.c        |   18 ++++++++++++++++++
 src/plugins/gs-plugin-appstream.c |   13 +++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index ecb7ddd..32a8c0f 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -125,6 +125,17 @@ gs_appstream_refine_add_addons (GsPlugin *plugin, GsApp *app, AsApp *item)
 {
        GPtrArray *addons;
        guint i;
+       g_autoptr(AsProfileTask) ptask = NULL;
+
+       /* we only care about addons to desktop apps */
+       if (gs_app_get_kind (app) != AS_APP_KIND_DESKTOP)
+               return;
+
+       /* search categories for the search term */
+       ptask = as_profile_start (gs_plugin_get_profile (plugin),
+                                 "appstream::refine-addons{%s}",
+                                 gs_app_get_unique_id (app));
+       g_assert (ptask != NULL);
 
        addons = as_app_get_addons (item);
        if (addons == NULL)
@@ -512,6 +523,13 @@ gs_appstream_refine_app (GsPlugin *plugin,
        const gchar *current_desktop;
        const gchar *tmp;
        guint i;
+       g_autoptr(AsProfileTask) ptask = NULL;
+
+       /* search categories for the search term */
+       ptask = as_profile_start (gs_plugin_get_profile (plugin),
+                                 "appstream::refine-app{%s}",
+                                 gs_app_get_unique_id (app));
+       g_assert (ptask != NULL);
 
        /* set the kind to be more precise */
        if (gs_app_get_kind (app) == AS_APP_KIND_UNKNOWN ||
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 3a19a7a..d793a17 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -328,6 +328,13 @@ gs_plugin_refine_from_id (GsPlugin *plugin,
        GsPluginData *priv = gs_plugin_get_data (plugin);
        const gchar *unique_id;
        AsApp *item;
+       g_autoptr(AsProfileTask) ptask = NULL;
+
+       /* search categories for the search term */
+       ptask = as_profile_start (gs_plugin_get_profile (plugin),
+                                 "appstream::refine-from-id{%s}",
+                                 gs_app_get_unique_id (app));
+       g_assert (ptask != NULL);
 
        /* unfound */
        *found = FALSE;
@@ -374,6 +381,12 @@ gs_plugin_refine_from_pkgname (GsPlugin *plugin,
        GPtrArray *sources;
        const gchar *pkgname;
        guint i;
+       g_autoptr(AsProfileTask) ptask = NULL;
+
+       /* search categories for the search term */
+       ptask = as_profile_start_literal (gs_plugin_get_profile (plugin),
+                                         "appstream::refine-from-pkgname");
+       g_assert (ptask != NULL);
 
        /* find anything that matches the ID */
        sources = gs_app_get_sources (app);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]