diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-12-03 08:46:12 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2010-01-12 13:01:43 (GMT) |
commit | b958102dfa36a3554911adb8fdb21375f0ecb48c (patch) | |
tree | 3bc39f33faf1e4c7707dc7500cb174d3631866d0 /src/network/access/qnetworkrequest.cpp | |
parent | 0e6abffa2843bae594195b9ba56d5c5264837288 (diff) | |
download | Qt-b958102dfa36a3554911adb8fdb21375f0ecb48c.zip Qt-b958102dfa36a3554911adb8fdb21375f0ecb48c.tar.gz Qt-b958102dfa36a3554911adb8fdb21375f0ecb48c.tar.bz2 |
QNAM: Add priority to the API and use it for HTTP
QHttpNetworkRequest and other classes already knew about the
priority. Change QNetworkRequest to export this as API. It
will be used in WebKit to tag high priority html, javascript
and css files as such.
Reviewed-By: Markus Goetz
Diffstat (limited to 'src/network/access/qnetworkrequest.cpp')
-rw-r--r-- | src/network/access/qnetworkrequest.cpp | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index 923f2e3..55643e4 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -218,8 +218,9 @@ class QNetworkRequestPrivate: public QSharedData, public QNetworkHeadersPrivate { public: inline QNetworkRequestPrivate() + : priority(QNetworkRequest::NormalPriority) #ifndef QT_NO_OPENSSL - : sslConfiguration(0) + , sslConfiguration(0) #endif { qRegisterMetaType<QNetworkRequest>(); } ~QNetworkRequestPrivate() @@ -234,6 +235,7 @@ public: : QSharedData(other), QNetworkHeadersPrivate(other) { url = other.url; + priority = other.priority; #ifndef QT_NO_OPENSSL sslConfiguration = 0; @@ -245,12 +247,14 @@ public: inline bool operator==(const QNetworkRequestPrivate &other) const { return url == other.url && + priority == other.priority && rawHeaders == other.rawHeaders && attributes == other.attributes; // don't compare cookedHeaders } QUrl url; + QNetworkRequest::Priority priority; #ifndef QT_NO_OPENSSL mutable QSslConfiguration *sslConfiguration; #endif @@ -516,6 +520,34 @@ QObject *QNetworkRequest::originatingObject() const return d->originatingObject.data(); } +/*! + \since 4.7 + + Return the priority of this request. + + \sa setPriority() +*/ +QNetworkRequest::Priority QNetworkRequest::priority() const +{ + return d->priority; +} + +/*! + \since 4.7 + + Set the priority of this request. + + \note The priority is only a hint to the network access manager. + It can use it or not. Currently it is used for HTTP to + decide which request should be sent first to a server. + + \sa priority() +*/ +void QNetworkRequest::setPriority(Priority priority) +{ + d->priority = priority; +} + static QByteArray headerName(QNetworkRequest::KnownHeaders header) { switch (header) { |