summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkreplyhttpimpl.cpp
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2011-07-12 12:45:02 +0200
committerQt by Nokia <qt-info@nokia.com>2011-07-12 13:57:14 +0200
commit37be55a86f78da6d177e387b79cbc5d2aacef773 (patch)
treee9afbd285268e09aee3898326176a6c534c24acd /src/network/access/qnetworkreplyhttpimpl.cpp
parente11fac22c41f5f796bbfabc5088ff8a1cee3cd3b (diff)
QNAM HTTP: Do zero-copy for small HTTP replies by default
Task-Number: QTBUG-19046 Change-Id: I34bf432c81d94787524124b7d110a00305a660c1 Reviewed-on: http://codereview.qt.nokia.com/1516 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com> Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
Diffstat (limited to 'src/network/access/qnetworkreplyhttpimpl.cpp')
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index df0a32dd6c..52cbaae5e0 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -777,8 +777,16 @@ void QNetworkReplyHttpImplPrivate::postRequest()
if (!synchronous) {
// Tell our zerocopy policy to the delegate
- delegate->downloadBufferMaximumSize =
- request.attribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute).toLongLong();
+ QVariant downloadBufferMaximumSizeAttribute = request.attribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute);
+ if (downloadBufferMaximumSizeAttribute.isValid()) {
+ delegate->downloadBufferMaximumSize = downloadBufferMaximumSizeAttribute.toLongLong();
+ } else {
+ // If there is no MaximumDownloadBufferSizeAttribute set (which is for the majority
+ // of QNetworkRequest) then we can assume we'll do it anyway for small HTTP replies.
+ // This helps with performance and memory fragmentation.
+ delegate->downloadBufferMaximumSize = 128*1024;
+ }
+
// These atomic integers are used for signal compression
delegate->pendingDownloadData = pendingDownloadDataEmissions;