diff options
author | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2022-02-04 13:55:18 +0100 |
---|---|---|
committer | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2022-02-10 07:22:50 +0000 |
commit | 52aba11794f9b6ed45efc5b29dc96fb900213092 (patch) | |
tree | c2af88b9ab48f9d6b22048cd5d0abca5b164b494 | |
parent | 7816994e04c1452ea61a7fd07e8f6ae8fcd4117c (diff) |
Remove conditional code for Qt 5
There is no need to support Qt 5 in dev branch.
Task-number: QTBUG-100478
Change-Id: I5986dd720c7eda8b62e70eafd0251c9108822576
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp>
-rw-r--r-- | src/httpserver/qhttpserverfutureresponse.cpp | 31 | ||||
-rw-r--r-- | src/httpserver/qhttpserverfutureresponse.h | 68 |
2 files changed, 0 insertions, 99 deletions
diff --git a/src/httpserver/qhttpserverfutureresponse.cpp b/src/httpserver/qhttpserverfutureresponse.cpp index 2409e6a..1d94df4 100644 --- a/src/httpserver/qhttpserverfutureresponse.cpp +++ b/src/httpserver/qhttpserverfutureresponse.cpp @@ -61,33 +61,6 @@ QT_BEGIN_NAMESPACE \endcode */ -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - -QHttpServerResponse QFutureInterface<QHttpServerResponse>::takeResult() -{ - if (isCanceled()) { - exceptionStore().throwPossibleException(); - return QHttpServerResponse::StatusCode::NotFound; - } - // Note: we wait for all, this is intentional, - // not to mess with other unready results. - waitForResult(-1); - -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - std::lock_guard<QMutex> locker{*mutex()}; -#else - std::lock_guard<QMutex> locker{mutex(0)}; -#endif - QtPrivate::ResultIteratorBase position = resultStoreBase().resultAt(0); - auto ret = std::move_if_noexcept( - *const_cast<QHttpServerResponse *>(position.pointer<QHttpServerResponse>())); - resultStoreBase().template clear<QHttpServerResponse>(); - - return ret; -} - -#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - struct QResponseWatcher : public QFutureWatcher<QHttpServerResponse> { Q_OBJECT @@ -149,11 +122,7 @@ void QHttpServerFutureResponse::write(QHttpServerResponder &&responder) const QObject::connect(futureWatcher, &QFutureWatcherBase::finished, socket, [futureWatcher] () mutable { -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - auto resp = futureWatcher->future().d.takeResult(); -#else auto resp = futureWatcher->future().takeResult(); -#endif resp.write(std::move(futureWatcher->responder)); futureWatcher->deleteLater(); }); diff --git a/src/httpserver/qhttpserverfutureresponse.h b/src/httpserver/qhttpserverfutureresponse.h index 42af829..9e40d62 100644 --- a/src/httpserver/qhttpserverfutureresponse.h +++ b/src/httpserver/qhttpserverfutureresponse.h @@ -41,74 +41,6 @@ QT_BEGIN_NAMESPACE -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - -template <> -class QFutureInterface<QHttpServerResponse> : public QFutureInterfaceBase -{ -public: - QFutureInterface(State initialState = NoState) - : QFutureInterfaceBase(initialState) - { - refT(); - } - QFutureInterface(const QFutureInterface &other) - : QFutureInterfaceBase(other) - { - refT(); - } - ~QFutureInterface() - { - if (!derefT()) - resultStoreBase().template clear<QHttpServerResponse>(); - } - - static QFutureInterface canceledResult() - { return QFutureInterface(State(Started | Finished | Canceled)); } - - QFutureInterface &operator=(const QFutureInterface &other) - { - other.refT(); - if (!derefT()) - resultStoreBase().template clear<QHttpServerResponse>(); - QFutureInterfaceBase::operator=(other); - return *this; - } - - inline QFuture<QHttpServerResponse> future() - { - return QFuture<QHttpServerResponse>(this); - } - - void reportAndMoveResult(QHttpServerResponse &&result, int index = -1) - { -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - std::lock_guard<QMutex> locker{*mutex()}; -#else - std::lock_guard<QMutex> locker{mutex(0)}; -#endif - if (queryState(Canceled) || queryState(Finished)) - return; - - QtPrivate::ResultStoreBase &store = resultStoreBase(); - - const int oldResultCount = store.count(); - const int insertIndex = store.addResult( - index, static_cast<void *>(new QHttpServerResponse(std::move_if_noexcept(result)))); - if (!store.filterMode() || oldResultCount < store.count()) // Let's make sure it's not in pending results. - reportResultsReady(insertIndex, store.count()); - } - - void reportFinished() - { - QFutureInterfaceBase::reportFinished(); - } - - QHttpServerResponse takeResult(); -}; - -#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - namespace QtConcurrent { template <> |