QmlProfiler: Fix traceTime updates

If the trace time hasn't been set yet, decreaseStartTime and
increaseEndTime should still do something.

Change-Id: I626c0df66a5d7327708ada77c78546ad4aafc52b
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2015-11-13 17:54:08 +01:00
parent 9f857880a7
commit 131c8027da

View File

@@ -101,16 +101,24 @@ void QmlProfilerTraceTime::setTime(qint64 startTime, qint64 endTime)
void QmlProfilerTraceTime::decreaseStartTime(qint64 time)
{
if (m_startTime > time) {
if (m_startTime > time || m_startTime == -1) {
m_startTime = time;
if (m_endTime == -1)
m_endTime = m_startTime;
else
QTC_ASSERT(m_endTime >= m_startTime, m_endTime = m_startTime);
emit timeChanged(time, m_endTime);
}
}
void QmlProfilerTraceTime::increaseEndTime(qint64 time)
{
if (m_endTime < time) {
if (m_endTime < time || m_endTime == -1) {
m_endTime = time;
if (m_startTime == -1)
m_startTime = m_endTime;
else
QTC_ASSERT(m_endTime >= m_startTime, m_startTime = m_endTime);
emit timeChanged(m_startTime, time);
}
}