Inline old QNetworkAccessManager transferTimeout int overloads

Qt 6.7 introduced new std::chrono variants of the transfer
timeout functions. We can now inline the old 'int milliseconds'
functions to reduce the  number of DLL entry points when one
isn't needed.

Task-number: QTBUG-122023
Change-Id: I18e0ed424fa4da1dde67c811e0f3744edf24b5f8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
bb10
Juha Vuolle 2024-02-12 16:48:20 +02:00
parent 6c213653d0
commit 2514d2cc1b
2 changed files with 16 additions and 8 deletions

View File

@ -1425,18 +1425,16 @@ void QNetworkAccessManager::setAutoDeleteReplies(bool shouldAutoDelete)
}
/*!
\fn int QNetworkAccessManager::transferTimeout() const
\since 5.15
Returns the timeout used for transfers, in milliseconds.
\sa setTransferTimeout()
*/
int QNetworkAccessManager::transferTimeout() const
{
return int(d_func()->transferTimeout.count());
}
/*!
\fn void QNetworkAccessManager::setTransferTimeout(int timeout)
\since 5.15
Sets \a timeout as the transfer timeout in milliseconds.
@ -1444,10 +1442,6 @@ int QNetworkAccessManager::transferTimeout() const
\sa setTransferTimeout(std::chrono::milliseconds),
transferTimeout(), transferTimeoutAsDuration()
*/
void QNetworkAccessManager::setTransferTimeout(int timeout)
{
setTransferTimeout(std::chrono::milliseconds(timeout));
}
/*!
\since 6.7

View File

@ -111,7 +111,9 @@ public:
bool autoDeleteReplies() const;
void setAutoDeleteReplies(bool autoDelete);
QT_NETWORK_INLINE_SINCE(6, 8)
int transferTimeout() const;
QT_NETWORK_INLINE_SINCE(6, 8)
void setTransferTimeout(int timeout);
std::chrono::milliseconds transferTimeoutAsDuration() const;
@ -153,6 +155,18 @@ private:
#endif
};
#if QT_NETWORK_INLINE_IMPL_SINCE(6, 8)
int QNetworkAccessManager::transferTimeout() const
{
return int(transferTimeoutAsDuration().count());
}
void QNetworkAccessManager::setTransferTimeout(int timeout)
{
setTransferTimeout(std::chrono::milliseconds(timeout));
}
#endif // INLINE_SINCE 6.8
QT_END_NAMESPACE
#endif