forked from qt-creator/qt-creator
QmlProfiler: Fix nesting calculation.
The previous version makes no sense as two events for which start2 > end1 cannot have start1 == start2. Also, as we only keep parents, not children, in the parent list, we don't need all the special cases for grandparents. Change-Id: Ic6bae2fe237a31726fd55f560c309ba09b5af25d Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include "timelineselectionrenderpass.h"
|
||||
#include "timelinenotesrenderpass.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <QLinkedList>
|
||||
|
||||
namespace Timeline {
|
||||
@@ -75,25 +76,19 @@ void TimelineModel::computeNesting()
|
||||
TimelineModelPrivate::Range &parent = d->ranges[*parentIt];
|
||||
qint64 parentEnd = parent.start + parent.duration;
|
||||
if (parentEnd < current.start) {
|
||||
if (parent.start == current.start) {
|
||||
if (parent.parent == -1) {
|
||||
parent.parent = range;
|
||||
} else {
|
||||
TimelineModelPrivate::Range &ancestor = d->ranges[parent.parent];
|
||||
if (ancestor.start == current.start &&
|
||||
ancestor.duration < current.duration)
|
||||
parent.parent = range;
|
||||
}
|
||||
// Just switch the old parent range for the new, larger one
|
||||
*parentIt = range;
|
||||
break;
|
||||
} else {
|
||||
parentIt = parents.erase(parentIt);
|
||||
}
|
||||
// We've completely passed the parent. Remove it.
|
||||
parentIt = parents.erase(parentIt);
|
||||
} else if (parentEnd >= current.start + current.duration) {
|
||||
// no need to insert
|
||||
// Current range is completely inside the parent range: no need to insert
|
||||
current.parent = *parentIt;
|
||||
break;
|
||||
} else if (parent.start == current.start) {
|
||||
// The parent range starts at the same time but ends before the current range.
|
||||
// We need to switch them.
|
||||
QTC_CHECK(parent.parent == -1);
|
||||
parent.parent = range;
|
||||
*parentIt = range;
|
||||
break;
|
||||
} else {
|
||||
++parentIt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user