From d14b1b34bafc7cc82383e8032f3adb626747849b Mon Sep 17 00:00:00 2001 From: Arttu Tarkiainen Date: Tue, 1 Mar 2022 17:54:22 +0200 Subject: Add support for parallel extraction of component archives Introduce ConcurrentOperationRunner class used for running installer operations concurrently in the global thread pool. Add execution groups for operations; Unpack operations are run concurrently for all components requesting installation, operations belonging to Install group are run sequentially for sorted components one at a time as before. From the default registered operations the Extract op is moved to Unpack group. Move the previously on-the-fly backup steps of Extract operation to the ExtractArchiveOperation::backup(), so that backups are done before any archives are extracted, and that we know if any of the archives requires administrator privileges to unpack. Reparent QInstaller::Error to QException to support throwing and catching exceptions across thread boundaries. Use RAII for the server-side objects of the classes supporting the remote client-server protocol of installer framework. The concurrent extraction revealed that it was still possible that the local socket was disconnected and thus the RemoteServer- Connection thread finished before receiving and processing the final "Destroy" command packet, leaking the dynamically allocated objects. Task-number: QTIFW-2566 Change-Id: Ib8c2928b9405b7b3465c731018df73acb51e949f Reviewed-by: Leena Miettinen Reviewed-by: Katja Marttila --- src/libs/installer/component.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/libs/installer/component.cpp') diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp index d4750cee9..87ec3e4bf 100644 --- a/src/libs/installer/component.cpp +++ b/src/libs/installer/component.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2021 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -48,6 +48,7 @@ #include #include +#include #include @@ -1053,8 +1054,10 @@ QStringList Component::stopProcessForUpdateRequests() const /*! Returns the operations needed to install this component. If autoCreateOperations() is \c true, createOperations() is called if no operations have been automatically created yet. + + The \a mask parameter filters the returned operations by their group. */ -OperationList Component::operations() const +OperationList Component::operations(const Operation::OperationGroups &mask) const { if (d->m_autoCreateOperations && !d->m_operationsCreated) { const_cast(this)->createOperations(); @@ -1081,7 +1084,11 @@ OperationList Component::operations() const d->m_operations.append(d->m_licenseOperation); } } - return d->m_operations; + OperationList operations = d->m_operations; + QtConcurrent::blockingFilter(operations, [&](const Operation *op) { + return mask.testFlag(op->group()); + }); + return operations; } /*! -- cgit v1.2.3