diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-01-18 15:45:56 +0100 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-01-21 01:51:20 +0100 |
commit | b292928e35b9864c2c3a023f79b892f40b08cd86 (patch) | |
tree | f961dc90ad54bcf452bd9bcf393d73236df492d0 /src/corelib/thread/qfutureinterface.cpp | |
parent | afdae3618a08da9f2c41b7c4ea57219f444ee324 (diff) |
Optimize ContinuationWrapper used for support of move-only continuations
After QFuture continuations became non-copyable (see earlier commits),
we have to always use ContinuationWrapper to save the continuations
inside std::function, since it requires the callable to be copyable.
Optimize the wrapper, by storing the callable directly (instead of using
a ref-counted QSharedPointer) and introducing a fake copy-constructor
that makes sure that it's never called.
Pick-to: 6.3 6.2
Change-Id: I0ed5f90ad62ede3b5c6d6e56ef58eb6377122920
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/thread/qfutureinterface.cpp')
-rw-r--r-- | src/corelib/thread/qfutureinterface.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/thread/qfutureinterface.cpp b/src/corelib/thread/qfutureinterface.cpp index dfc905e828..cad6111ab9 100644 --- a/src/corelib/thread/qfutureinterface.cpp +++ b/src/corelib/thread/qfutureinterface.cpp @@ -837,7 +837,7 @@ void QFutureInterfaceBasePrivate::setState(QFutureInterfaceBase::State newState) void QFutureInterfaceBase::setContinuation(std::function<void(const QFutureInterfaceBase &)> func) { - setContinuation(func, nullptr); + setContinuation(std::move(func), nullptr); } void QFutureInterfaceBase::setContinuation(std::function<void(const QFutureInterfaceBase &)> func, |