[gnome-software: 12/18] gs-plugin-loader: Move ODRS refine functionality into the plugin loader
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 12/18] gs-plugin-loader: Move ODRS refine functionality into the plugin loader
- Date: Wed, 9 Jun 2021 13:45:49 +0000 (UTC)
commit d0dbf4932a4f5873f7039f76485c9517411643cd
Author: Philip Withnall <pwithnall endlessos org>
Date: Wed May 19 12:02:56 2021 +0100
gs-plugin-loader: Move ODRS refine functionality into the plugin loader
This is another step towards removing the ODRS plugin, with the overall
aim of making plugins only produce data, not also consume or modify data
from other plugins. By eliminating interaction between plugins, the
threading model for them can be changed more easily, which should help
us to eliminate multi-thread deadlocks where `GTask` thread pool limits
are reached.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
lib/gs-plugin-loader.c | 13 +++++++++++++
plugins/odrs/gs-plugin-odrs.c | 12 ------------
2 files changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 466daae9d..6a35a96a0 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -842,6 +842,15 @@ gs_plugin_loader_run_refine_filter (GsPluginLoaderHelper *helper,
gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_FINISHED);
}
+ /* Add ODRS data if needed */
+ if (plugin_loader->odrs_provider != NULL) {
+ if (refine_flags == GS_PLUGIN_REFINE_FLAGS_DEFAULT)
+ refine_flags = gs_plugin_job_get_refine_flags (helper->plugin_job);
+
+ if (!gs_odrs_provider_refine (plugin_loader->odrs_provider,
+ list, refine_flags, cancellable, error))
+ return FALSE;
+ }
/* filter any wildcard apps left in the list */
gs_app_list_filter (list, gs_plugin_loader_app_is_non_wildcard, NULL);
@@ -1097,10 +1106,14 @@ gs_plugin_loader_run_results (GsPluginLoaderHelper *helper,
GError **error)
{
GsPluginLoader *plugin_loader = helper->plugin_loader;
+ GsPluginAction action = gs_plugin_job_get_action (helper->plugin_job);
#ifdef HAVE_SYSPROF
gint64 begin_time_nsec G_GNUC_UNUSED = SYSPROF_CAPTURE_CURRENT_TIME;
#endif
+ /* Refining is done separately as it’s a special action */
+ g_assert (action != GS_PLUGIN_ACTION_REFINE);
+
/* run each plugin */
for (guint i = 0; i < plugin_loader->plugins->len; i++) {
GsPlugin *plugin = g_ptr_array_index (plugin_loader->plugins, i);
diff --git a/plugins/odrs/gs-plugin-odrs.c b/plugins/odrs/gs-plugin-odrs.c
index 921167abd..af733100e 100644
--- a/plugins/odrs/gs-plugin-odrs.c
+++ b/plugins/odrs/gs-plugin-odrs.c
@@ -109,15 +109,3 @@ gs_plugin_destroy (GsPlugin *plugin)
g_clear_object (&priv->provider);
}
-
-gboolean
-gs_plugin_refine (GsPlugin *plugin,
- GsAppList *list,
- GsPluginRefineFlags flags,
- GCancellable *cancellable,
- GError **error)
-{
- GsPluginData *priv = gs_plugin_get_data (plugin);
-
- return gs_odrs_provider_refine (priv->provider, list, flags, cancellable, error);
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]