aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/debugger/qqmlprofiler.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-08-04 11:26:52 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-08-04 13:34:14 +0000
commitef0b5349fb94c5134dc570ca26c30050a3277553 (patch)
tree5249f886f48f6cf733c0ed3431fba8f2e7285dd0 /src/qml/debugger/qqmlprofiler.cpp
parent3cce585f3c05ea4dffa324f10bd99dfbc2577cfe (diff)
Avoid QVector::pop_front()
Change-Id: Id2de4ab8c17f7e0412b44a1d30c6238861464989 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/debugger/qqmlprofiler.cpp')
-rw-r--r--src/qml/debugger/qqmlprofiler.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/qml/debugger/qqmlprofiler.cpp b/src/qml/debugger/qqmlprofiler.cpp
index 6c656f20e0..2fd27617b5 100644
--- a/src/qml/debugger/qqmlprofiler.cpp
+++ b/src/qml/debugger/qqmlprofiler.cpp
@@ -79,7 +79,7 @@ void QQmlProfilerData::toByteArrays(QList<QByteArray> &messages) const
}
QQmlProfilerAdapter::QQmlProfilerAdapter(QQmlProfilerService *service, QQmlEnginePrivate *engine) :
- QQmlAbstractProfilerAdapter(service)
+ QQmlAbstractProfilerAdapter(service), next(0)
{
engine->enableProfiler();
connect(this, SIGNAL(profilingEnabled(quint64)), engine->profiler, SLOT(startProfiling(quint64)));
@@ -97,11 +97,15 @@ QQmlProfilerAdapter::QQmlProfilerAdapter(QQmlProfilerService *service, QQmlEngin
qint64 QQmlProfilerAdapter::sendMessages(qint64 until, QList<QByteArray> &messages)
{
- while (!data.empty() && data.front().time <= until) {
- data.front().toByteArrays(messages);
- data.pop_front();
+ while (next != data.length()) {
+ if (data[next].time > until)
+ return data[next].time;
+ data[next++].toByteArrays(messages);
}
- return data.empty() ? -1 : data.front().time;
+
+ next = 0;
+ data.clear();
+ return -1;
}
void QQmlProfilerAdapter::receiveData(const QVector<QQmlProfilerData> &new_data)