diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-03-11 23:17:56 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-14 13:34:37 +0100 |
commit | 6a0d304a2dbbcabcfb570ec6508f6324ce9906ad (patch) | |
tree | 4fc861ae3bdfb496a663d18464bc34f2ecab18a5 /src/network/access | |
parent | ab0d7f5619bffa87d4ea07f83a144841d49c9e9f (diff) |
QNetworkReplyHttpImpl: optimize QRingBuffer allocation
Use QSharedPointer<T>::create(), which co-locates the refcount with the payload
in a single memory allocation, instead of QSharedPointer<T>(new T), which causes
two allocations.
Change-Id: I280caf861b894f87996a9d3ae783943f55d54ff3
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
Diffstat (limited to 'src/network/access')
-rw-r--r-- | src/network/access/qnetworkreplyhttpimpl.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index de4c8d0964..e29caa9887 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -194,7 +194,7 @@ QNetworkReplyHttpImpl::QNetworkReplyHttpImpl(QNetworkAccessManager* const manage if (d->synchronous && outgoingData) { // The synchronous HTTP is a corner case, we will put all upload data in one big QByteArray in the outgoingDataBuffer. // Yes, this is not the most efficient thing to do, but on the other hand synchronous XHR needs to die anyway. - d->outgoingDataBuffer = QSharedPointer<QRingBuffer>(new QRingBuffer()); + d->outgoingDataBuffer = QSharedPointer<QRingBuffer>::create(); qint64 previousDataSize = 0; do { previousDataSize = d->outgoingDataBuffer->size(); @@ -1715,7 +1715,7 @@ void QNetworkReplyHttpImplPrivate::_q_bufferOutgoingData() if (!outgoingDataBuffer) { // first call, create our buffer - outgoingDataBuffer = QSharedPointer<QRingBuffer>(new QRingBuffer()); + outgoingDataBuffer = QSharedPointer<QRingBuffer>::create(); QObject::connect(outgoingData, SIGNAL(readyRead()), q, SLOT(_q_bufferOutgoingData())); QObject::connect(outgoingData, SIGNAL(readChannelFinished()), q, SLOT(_q_bufferOutgoingDataFinished())); |