diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-09-16 13:23:19 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-10-15 08:23:15 +0000 |
commit | 2f03049d4cabfac822bcf6b5886b078d70064968 (patch) | |
tree | e79c7cdc5e300d8889d0525d0a3b1f5582921aa1 /src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp | |
parent | 1a123472ba0e56d1fd772db430e6d4532f672a6e (diff) |
Put QPacketProtocol into its own static library
We need it in 3 places in qtdeclarative and we could also use it in
QtCreator. We don't want to bundle it with the debug client code as it
is also necessary for the server.
QPacket replaces QQmlDebugStream as it has the same purpose. This
also fixes the inconsitent handling of data stream versions.
Change-Id: I650fae353f267511c551b427d9169f4d718aa7f2
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp')
-rw-r--r-- | src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp index 65b99ef7ca..2ce5610c7e 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp @@ -36,6 +36,7 @@ #include "qqmlprofileradapter.h" #include "qqmlprofilerservicefactory.h" #include <private/qqmlengine_p.h> +#include <private/qpacket_p.h> #include <QtCore/qdatastream.h> #include <QtCore/qurl.h> @@ -202,8 +203,7 @@ void QQmlProfilerServiceImpl::startProfiling(QQmlEngine *engine, quint64 feature { QMutexLocker lock(&m_configMutex); - QByteArray message; - QQmlDebugStream d(&message, QIODevice::WriteOnly); + QPacket d; d << m_timer.nsecsElapsed() << (int)Event << (int)StartTrace; bool startedAny = false; @@ -239,7 +239,7 @@ void QQmlProfilerServiceImpl::startProfiling(QQmlEngine *engine, quint64 feature emit startFlushTimer(); } - emit messageToClient(name(), message); + emit messageToClient(name(), d.data()); } /*! @@ -299,10 +299,8 @@ void QQmlProfilerServiceImpl::sendMessages() { QList<QByteArray> messages; - QByteArray data; - + QPacket traceEnd; if (m_waitingForStop) { - QQmlDebugStream traceEnd(&data, QIODevice::WriteOnly); traceEnd << m_timer.nsecsElapsed() << (int)Event << (int)EndTrace; QSet<QQmlEngine *> seen; @@ -331,12 +329,11 @@ void QQmlProfilerServiceImpl::sendMessages() if (m_waitingForStop) { //indicate completion - messages << data; - data.clear(); + messages << traceEnd.data(); - QQmlDebugStream ds(&data, QIODevice::WriteOnly); + QPacket ds; ds << (qint64)-1 << (int)Complete; - messages << data; + messages << ds.data(); m_waitingForStop = false; } @@ -369,8 +366,7 @@ void QQmlProfilerServiceImpl::messageReceived(const QByteArray &message) { QMutexLocker lock(&m_configMutex); - QByteArray rwData = message; - QQmlDebugStream stream(&rwData, QIODevice::ReadOnly); + QPacket stream(message); int engineId = -1; quint64 features = std::numeric_limits<quint64>::max(); |