diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-11-03 14:32:25 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-11-17 18:42:07 +0000 |
commit | 0b67dd7e132d7d618fa538e8c4a275c874543342 (patch) | |
tree | 3c6c7cdf8fbae8c6a7d0d333d96c22d130413980 /src/qmldebug/qqmlprofilerclient.cpp | |
parent | e010b64d38cb8533d779ac0fe8d609f00a6793e7 (diff) |
QmlDebug: Restructure QPacket and QPacketProtocol
We cannot use the same data stream version for the client and server
versions of QPacket and QPacketProtocol should not deal with QPackets
but with simple byte arrays because the underlying QDataStream is hard
to copy.
The new QQmlDebugPacket picks its data stream version from
QQmlDebugConnector now, which adjusts it when connecting. As there can
only ever be one QQmlDebugConnector, we can keep the version static.
The clients need to query the connection for the correct version. We
may connect to several different servers sequentially or we may have a
server running while using a client, and we don't want to confuse the
versions between those.
With this in place, all remaining occurrences of QDataStream are
replaced with QPacket or QQmlDebugPacket.
Change-Id: I3f6ba73fcbfad5e8df917c5feb9308116738a614
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qmldebug/qqmlprofilerclient.cpp')
-rw-r--r-- | src/qmldebug/qqmlprofilerclient.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/qmldebug/qqmlprofilerclient.cpp b/src/qmldebug/qqmlprofilerclient.cpp index 1ac0ba9095..f38884c309 100644 --- a/src/qmldebug/qqmlprofilerclient.cpp +++ b/src/qmldebug/qqmlprofilerclient.cpp @@ -32,8 +32,7 @@ ****************************************************************************/ #include "qqmlprofilerclient_p_p.h" - -#include <QtCore/qdatastream.h> +#include "qqmldebugconnection_p.h" QT_BEGIN_NAMESPACE @@ -63,10 +62,9 @@ void QQmlProfilerClient::sendRecordingStatus(bool record, int engineId, quint32 { Q_D(const QQmlProfilerClient); - QByteArray ba; - QDataStream stream(&ba, QIODevice::WriteOnly); + QPacket stream(d->connection->currentDataStreamVersion()); stream << record << engineId << d->features << flushInterval; - sendMessage(ba); + sendMessage(stream.data()); } void QQmlProfilerClient::traceStarted(qint64 time, int engineId) @@ -172,7 +170,7 @@ void QQmlProfilerClient::unknownEvent(QQmlProfilerDefinitions::Message messageTy Q_UNUSED(detailType); } -void QQmlProfilerClient::unknownData(QDataStream &stream) +void QQmlProfilerClient::unknownData(QPacket &stream) { Q_UNUSED(stream); } @@ -202,8 +200,7 @@ void QQmlProfilerClient::messageReceived(const QByteArray &data) { Q_D(const QQmlProfilerClient); - QByteArray rwData = data; - QDataStream stream(&rwData, QIODevice::ReadOnly); + QPacket stream(d->connection->currentDataStreamVersion(), data); // Force all the 1 << <FLAG> expressions to be done in 64 bit, to silence some warnings const quint64 one = static_cast<quint64>(1); |