QmlProfiler: Process remaining events if connection drops

When the connection drops while receiving a trace we can easily process
the buffered events. The trace client test case has some traces with
trailing open ranges that can be recovered this way.

Change-Id: I8b2ecc135b0cabff18923fbc8f3f14b5cb3a96ee
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Ulf Hermann
2018-01-04 11:10:58 +01:00
parent 098fc76b63
commit 5bd0ee0b4c
3 changed files with 19 additions and 10 deletions

View File

@@ -60,12 +60,14 @@ void QmlProfilerTraceClientTest::testMessageReceived()
QByteArray trace;
inStream >> trace;
traceClient.stateChanged(QmlDebug::QmlDebugClient::Enabled);
QmlDebug::QPacket packet(QDataStream::Qt_4_7, trace);
while (!packet.atEnd()) {
QByteArray content;
packet >> content;
traceClient.messageReceived(content);
}
traceClient.stateChanged(QmlDebug::QmlDebugClient::NotConnected);
modelManager.replayEvents(-1, -1, [&](const QmlEvent &event, const QmlEventType &type) {
qint64 timestamp;