QmlDebug: Unify QPacket and QmlDebugStream and remove unused code

There is no point in having both as they serve the same purpose. Also,
most of the packet protocol API was never used or tested, and wrapping
each byte to be sent into a QPacket is wasteful and unnecessary.

Change-Id: Ia421eae33b644fe86a53bcd04092a84ea3000f0d
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2015-11-16 16:46:51 +01:00
parent 55afbb59e1
commit a3e4a28bee
8 changed files with 115 additions and 330 deletions

View File

@@ -31,6 +31,7 @@
#include "qmlprofilertraceclient.h"
#include "qmlenginecontrolclient.h"
#include "qdebugmessageclient.h"
#include "qpacketprotocol.h"
namespace QmlDebug {
@@ -76,12 +77,11 @@ static const int GAP_TIME = 150;
void QmlProfilerTraceClientPrivate::sendRecordingStatus(int engineId)
{
QByteArray ba;
QmlDebugStream stream(&ba, QIODevice::WriteOnly);
QPacket stream(q->connection()->currentDataStreamVersion());
stream << recording << engineId; // engineId -1 is OK. It means "all of them"
if (recording)
stream << requestedFeatures << flushInterval;
q->sendMessage(ba);
q->sendMessage(stream.data());
}
QmlProfilerTraceClient::QmlProfilerTraceClient(QmlDebugConnection *client, quint64 features)
@@ -201,8 +201,7 @@ void QmlProfilerTraceClient::stateChanged(State /*status*/)
void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
{
QByteArray rwData = data;
QmlDebugStream stream(&rwData, QIODevice::ReadOnly);
QPacket stream(connection()->currentDataStreamVersion(), data);
qint64 time;
int messageType;