Skip to content

Commit

Permalink
Inline old QNetworkAccessManager transferTimeout int overloads
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Juha Vuolle committed Feb 14, 2024
1 parent 6c21365 commit 2514d2c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/network/access/qnetworkaccessmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1425,29 +1425,23 @@ 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.
\sa setTransferTimeout(std::chrono::milliseconds),
transferTimeout(), transferTimeoutAsDuration()
*/
void QNetworkAccessManager::setTransferTimeout(int timeout)
{
setTransferTimeout(std::chrono::milliseconds(timeout));
}

/*!
\since 6.7
Expand Down
14 changes: 14 additions & 0 deletions src/network/access/qnetworkaccessmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ class Q_NETWORK_EXPORT QNetworkAccessManager: public QObject
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;
Expand Down Expand Up @@ -153,6 +155,18 @@ protected Q_SLOTS:
#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

0 comments on commit 2514d2c

Please sign in to comment.