QFutureInterface: mark the unused setContinuation() overloads as removed
This is a cleanup after the previous patch that introduced the new setContinuation() overloads. The old API cannot be used correctly with the new approach that requires to always set a continuation type, so let's mark it as removed. Technically, this change is SiC. However, QFutureInterfaceBase was never documented as a public class, so users are not supposed to derive from it and should not use setContinuation() methods directly. Task-number: QTBUG-130662 Change-Id: Idf3d9f5de00a7c4ac34ee3dde1d58902e3a27904 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
b0e82f5981
commit
3164746eb0
@ -1380,6 +1380,46 @@ QUuid::Version QUuid::version() const noexcept
|
|||||||
|
|
||||||
#if QT_CORE_REMOVED_SINCE(6, 10)
|
#if QT_CORE_REMOVED_SINCE(6, 10)
|
||||||
|
|
||||||
|
#if QT_CONFIG(future)
|
||||||
|
#include "qfuture.h" // for ContinuationWrapper
|
||||||
|
#include "qfutureinterface.h"
|
||||||
|
|
||||||
|
void QtPrivate::watchContinuationImpl(const QObject *context,
|
||||||
|
QtPrivate::QSlotObjectBase *slotObj,
|
||||||
|
QFutureInterfaceBase &fi)
|
||||||
|
{
|
||||||
|
Q_ASSERT(context);
|
||||||
|
Q_ASSERT(slotObj);
|
||||||
|
|
||||||
|
auto slot = QtPrivate::SlotObjUniquePtr(slotObj);
|
||||||
|
|
||||||
|
// That is now a double-inderection, because the setContinuation() overload
|
||||||
|
// also uses QSlotObjectBase approach. But that's a solution for backwards
|
||||||
|
// compatibility, so should be fine.
|
||||||
|
// We pass a default-constructed QVariant() and an Unknown type, because
|
||||||
|
// that's effectively the same as passing a nullptr continuationData, and
|
||||||
|
// that's what the old code was doing.
|
||||||
|
fi.setContinuation(context, QtPrivate::ContinuationWrapper([slot = std::move(slot)]()
|
||||||
|
{
|
||||||
|
void *args[] = { nullptr }; // for `void` return value
|
||||||
|
slot->call(nullptr, args);
|
||||||
|
}), QVariant(), QFutureInterfaceBase::ContinuationType::Unknown);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QFutureInterfaceBase::setContinuation(std::function<void(const QFutureInterfaceBase &)> func)
|
||||||
|
{
|
||||||
|
setContinuation(std::move(func), nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QFutureInterfaceBase::setContinuation(std::function<void(const QFutureInterfaceBase &)> func,
|
||||||
|
QFutureInterfaceBasePrivate *continuationFutureData)
|
||||||
|
{
|
||||||
|
// Backwards compatibility - the continuation data was used for
|
||||||
|
// then-continuations
|
||||||
|
setContinuation(std::move(func), continuationFutureData, ContinuationType::Then);
|
||||||
|
}
|
||||||
|
#endif // QT_CONFIG(future)
|
||||||
|
|
||||||
#include "qlogging.h"
|
#include "qlogging.h"
|
||||||
|
|
||||||
QNoDebug QMessageLogger::noDebug() const noexcept
|
QNoDebug QMessageLogger::noDebug() const noexcept
|
||||||
|
@ -55,27 +55,6 @@ signals:
|
|||||||
void run();
|
void run();
|
||||||
};
|
};
|
||||||
|
|
||||||
void QtPrivate::watchContinuationImpl(const QObject *context, QSlotObjectBase *slotObj,
|
|
||||||
QFutureInterfaceBase &fi)
|
|
||||||
{
|
|
||||||
Q_ASSERT(context);
|
|
||||||
Q_ASSERT(slotObj);
|
|
||||||
|
|
||||||
auto slot = SlotObjUniquePtr(slotObj);
|
|
||||||
|
|
||||||
// That is now a double-inderection, because the setContinuation() overload
|
|
||||||
// also uses QSlotObjectBase approach. But that's a solution for backwards
|
|
||||||
// compatibility, so should be fine.
|
|
||||||
// We pass a default-constructed QVariant() and an Unknown type, because
|
|
||||||
// that's effectively the same as passing a nullptr continuationData, and
|
|
||||||
// that's what the old code was doing.
|
|
||||||
fi.setContinuation(context, ContinuationWrapper([slot = std::move(slot)]()
|
|
||||||
{
|
|
||||||
void *args[] = { nullptr }; // for `void` return value
|
|
||||||
slot->call(nullptr, args);
|
|
||||||
}), QVariant(), QFutureInterfaceBase::ContinuationType::Unknown);
|
|
||||||
}
|
|
||||||
|
|
||||||
QFutureCallOutInterface::~QFutureCallOutInterface()
|
QFutureCallOutInterface::~QFutureCallOutInterface()
|
||||||
= default;
|
= default;
|
||||||
|
|
||||||
@ -846,19 +825,6 @@ void QFutureInterfaceBasePrivate::setState(QFutureInterfaceBase::State newState)
|
|||||||
state.storeRelaxed(newState);
|
state.storeRelaxed(newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFutureInterfaceBase::setContinuation(std::function<void(const QFutureInterfaceBase &)> func)
|
|
||||||
{
|
|
||||||
setContinuation(std::move(func), nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QFutureInterfaceBase::setContinuation(std::function<void(const QFutureInterfaceBase &)> func,
|
|
||||||
QFutureInterfaceBasePrivate *continuationFutureData)
|
|
||||||
{
|
|
||||||
// Backwards compatibility - the continuation data was used for
|
|
||||||
// then-continuations
|
|
||||||
setContinuation(std::move(func), continuationFutureData, ContinuationType::Then);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QFutureInterfaceBase::setContinuation(std::function<void (const QFutureInterfaceBase &)> func,
|
void QFutureInterfaceBase::setContinuation(std::function<void (const QFutureInterfaceBase &)> func,
|
||||||
void *continuationFutureData, ContinuationType type)
|
void *continuationFutureData, ContinuationType type)
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <QtCore/qmutex.h>
|
#include <QtCore/qmutex.h>
|
||||||
#include <QtCore/qresultstore.h>
|
#include <QtCore/qresultstore.h>
|
||||||
|
#include <QtCore/qtcoreexports.h>
|
||||||
#ifndef QT_NO_EXCEPTIONS
|
#ifndef QT_NO_EXCEPTIONS
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#endif
|
#endif
|
||||||
@ -40,9 +41,11 @@ template<class Function, class ResultType>
|
|||||||
class FailureHandler;
|
class FailureHandler;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if QT_CORE_REMOVED_SINCE(6, 10)
|
||||||
void Q_CORE_EXPORT watchContinuationImpl(const QObject *context,
|
void Q_CORE_EXPORT watchContinuationImpl(const QObject *context,
|
||||||
QtPrivate::QSlotObjectBase *slotObj,
|
QtPrivate::QSlotObjectBase *slotObj,
|
||||||
QFutureInterfaceBase &fi);
|
QFutureInterfaceBase &fi);
|
||||||
|
#endif // QT_CORE_REMOVED_SINCE(6, 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Q_CORE_EXPORT QFutureInterfaceBase
|
class Q_CORE_EXPORT QFutureInterfaceBase
|
||||||
@ -182,8 +185,10 @@ private:
|
|||||||
friend class QtPrivate::FailureHandler;
|
friend class QtPrivate::FailureHandler;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if QT_CORE_REMOVED_SINCE(6, 10)
|
||||||
friend Q_CORE_EXPORT void QtPrivate::watchContinuationImpl(
|
friend Q_CORE_EXPORT void QtPrivate::watchContinuationImpl(
|
||||||
const QObject *context, QtPrivate::QSlotObjectBase *slotObj, QFutureInterfaceBase &fi);
|
const QObject *context, QtPrivate::QSlotObjectBase *slotObj, QFutureInterfaceBase &fi);
|
||||||
|
#endif // QT_CORE_REMOVED_SINCE(6, 10)
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
friend class QPromise;
|
friend class QPromise;
|
||||||
@ -197,9 +202,11 @@ protected:
|
|||||||
OnCanceled,
|
OnCanceled,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if QT_CORE_REMOVED_SINCE(6, 10)
|
||||||
void setContinuation(std::function<void(const QFutureInterfaceBase &)> func);
|
void setContinuation(std::function<void(const QFutureInterfaceBase &)> func);
|
||||||
void setContinuation(std::function<void(const QFutureInterfaceBase &)> func,
|
void setContinuation(std::function<void(const QFutureInterfaceBase &)> func,
|
||||||
QFutureInterfaceBasePrivate *continuationFutureData);
|
QFutureInterfaceBasePrivate *continuationFutureData);
|
||||||
|
#endif // QT_CORE_REMOVED_SINCE(6, 10)
|
||||||
void setContinuation(std::function<void(const QFutureInterfaceBase &)> func,
|
void setContinuation(std::function<void(const QFutureInterfaceBase &)> func,
|
||||||
void *continuationFutureData, ContinuationType type);
|
void *continuationFutureData, ContinuationType type);
|
||||||
void setContinuation(const QObject *context, std::function<void()> func,
|
void setContinuation(const QObject *context, std::function<void()> func,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user