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 /tests/auto/qml/debugger/qqmldebugjs | |
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 'tests/auto/qml/debugger/qqmldebugjs')
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp index d6facc4200..13674fdb61 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp +++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp @@ -37,6 +37,7 @@ #include <private/qqmldebugclient_p.h> #include <private/qqmldebugconnection_p.h> +#include <private/qpacket_p.h> #include <QtTest/qtest.h> #include <QtCore/qprocess.h> @@ -559,11 +560,9 @@ void QJSDebugClient::setBreakpoint(QString type, QString target, int line, int c // } if (type == QLatin1String(EVENT)) { - QByteArray reply; - QDataStream rs(&reply, QIODevice::WriteOnly); + QPacket rs(connection()->currentDataStreamVersion()); rs << target.toUtf8() << enabled; - sendMessage(packMessage(QByteArray("breakonsignal"), reply)); - + sendMessage(packMessage(QByteArray("breakonsignal"), rs.data())); } else { VARIANTMAPINIT; jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(SETBREAKPOINT))); @@ -711,7 +710,7 @@ void QJSDebugClient::stateChanged(State state) void QJSDebugClient::messageReceived(const QByteArray &data) { - QDataStream ds(data); + QPacket ds(connection()->currentDataStreamVersion(), data); QByteArray command; ds >> command; @@ -796,11 +795,10 @@ void QJSDebugClient::flushSendBuffer() QByteArray QJSDebugClient::packMessage(const QByteArray &type, const QByteArray &message) { - QByteArray reply; - QDataStream rs(&reply, QIODevice::WriteOnly); + QPacket rs(connection()->currentDataStreamVersion()); QByteArray cmd = "V8DEBUG"; rs << cmd << type << message; - return reply; + return rs.data(); } void tst_QQmlDebugJS::initTestCase() |