forked from qt-creator/qt-creator
QmlProfiler: Make most of SortedTimelineModel protected
We don't want anyone to insert stuff into the ranges without reflecting it in the actual data. Change-Id: Iaa8cc9a962216ba466da2c468826f6fbf6bef11c Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -61,10 +61,6 @@ public:
|
|||||||
inline qint64 timestamp() const {return end;}
|
inline qint64 timestamp() const {return end;}
|
||||||
};
|
};
|
||||||
|
|
||||||
SortedTimelineModel(QObject *parent = 0) : QObject(parent) {}
|
|
||||||
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
inline int count() const { return ranges.count(); }
|
inline int count() const { return ranges.count(); }
|
||||||
|
|
||||||
qint64 duration(int index) const { return ranges[index].duration; }
|
qint64 duration(int index) const { return ranges[index].duration; }
|
||||||
@@ -76,31 +72,6 @@ public:
|
|||||||
|
|
||||||
inline const Range &range(int index) const { return ranges[index]; }
|
inline const Range &range(int index) const { return ranges[index]; }
|
||||||
|
|
||||||
inline int insert(qint64 startTime, qint64 duration, int typeId)
|
|
||||||
{
|
|
||||||
/* Doing insert-sort here is preferable as most of the time the times will actually be
|
|
||||||
* presorted in the right way. So usually this will just result in appending. */
|
|
||||||
int index = insertSorted(ranges, Range(startTime, duration, typeId));
|
|
||||||
if (index < ranges.size() - 1)
|
|
||||||
incrementStartIndices(index);
|
|
||||||
insertSorted(endTimes, RangeEnd(index, startTime + duration));
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int insertStart(qint64 startTime, int typeId)
|
|
||||||
{
|
|
||||||
int index = insertSorted(ranges, Range(startTime, 0, typeId));
|
|
||||||
if (index < ranges.size() - 1)
|
|
||||||
incrementStartIndices(index);
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void insertEnd(int index, qint64 duration)
|
|
||||||
{
|
|
||||||
ranges[index].duration = duration;
|
|
||||||
insertSorted(endTimes, RangeEnd(index, ranges[index].start + duration));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int firstIndex(qint64 startTime) const
|
inline int firstIndex(qint64 startTime) const
|
||||||
{
|
{
|
||||||
int index = firstIndexNoParents(startTime);
|
int index = firstIndexNoParents(startTime);
|
||||||
@@ -137,6 +108,36 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
SortedTimelineModel(QObject *parent = 0) : QObject(parent) {}
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
inline int insert(qint64 startTime, qint64 duration, int typeId)
|
||||||
|
{
|
||||||
|
/* Doing insert-sort here is preferable as most of the time the times will actually be
|
||||||
|
* presorted in the right way. So usually this will just result in appending. */
|
||||||
|
int index = insertSorted(ranges, Range(startTime, duration, typeId));
|
||||||
|
if (index < ranges.size() - 1)
|
||||||
|
incrementStartIndices(index);
|
||||||
|
insertSorted(endTimes, RangeEnd(index, startTime + duration));
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int insertStart(qint64 startTime, int typeId)
|
||||||
|
{
|
||||||
|
int index = insertSorted(ranges, Range(startTime, 0, typeId));
|
||||||
|
if (index < ranges.size() - 1)
|
||||||
|
incrementStartIndices(index);
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void insertEnd(int index, qint64 duration)
|
||||||
|
{
|
||||||
|
ranges[index].duration = duration;
|
||||||
|
insertSorted(endTimes, RangeEnd(index, ranges[index].start + duration));
|
||||||
|
}
|
||||||
|
|
||||||
void computeNesting();
|
void computeNesting();
|
||||||
|
|
||||||
void incrementStartIndices(int index)
|
void incrementStartIndices(int index)
|
||||||
|
|||||||
Reference in New Issue
Block a user