Avoid heavy weight function object

Also, by switching to template we can avoid the cost of converting to some specific type and
perfectly forward the parameter to the final function.

PR #21572.
This commit is contained in:
Chocobo1 2024-10-12 15:15:39 +08:00 committed by GitHub
parent ac646f47a2
commit 21b0367629
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 11 deletions

View file

@ -71,7 +71,6 @@
#include <QRegularExpression>
#include <QString>
#include <QThread>
#include <QThreadPool>
#include <QTimer>
#include <QUuid>
@ -3013,11 +3012,6 @@ void SessionImpl::removeMappedPorts(const QSet<quint16> &ports)
});
}
void SessionImpl::invokeAsync(std::function<void ()> func)
{
m_asyncWorker->start(std::move(func));
}
// Add a torrent to libtorrent session in hidden mode
// and force it to download its metadata
bool SessionImpl::downloadMetadata(const TorrentDescriptor &torrentDescr)