forked from qt-creator/qt-creator
Remove some dead code
Keeping redundant copies of the same data is wasteful and error prone. Change-Id: Ie4273d01728acd0caecf20739ae53376ef91ace8 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -70,12 +70,10 @@ public:
|
|||||||
void computeMaxCacheSize();
|
void computeMaxCacheSize();
|
||||||
void resizeUnfinishedLoads();
|
void resizeUnfinishedLoads();
|
||||||
void flattenLoads();
|
void flattenLoads();
|
||||||
void computeRowCounts();
|
|
||||||
int updateCacheCount(int lastCacheSizeEvent, qint64 startTime, qint64 pixSize,
|
int updateCacheCount(int lastCacheSizeEvent, qint64 startTime, qint64 pixSize,
|
||||||
PixmapCacheEvent &newEvent);
|
PixmapCacheEvent &newEvent);
|
||||||
|
|
||||||
QVector<Pixmap> pixmaps;
|
QVector<Pixmap> pixmaps;
|
||||||
int expandedRowCount;
|
|
||||||
int collapsedRowCount;
|
int collapsedRowCount;
|
||||||
void addVP(QVariantList &l, QString label, qint64 time) const;
|
void addVP(QVariantList &l, QString label, qint64 time) const;
|
||||||
|
|
||||||
@@ -91,7 +89,6 @@ PixmapCacheModel::PixmapCacheModel(QObject *parent)
|
|||||||
{
|
{
|
||||||
Q_D(PixmapCacheModel);
|
Q_D(PixmapCacheModel);
|
||||||
d->collapsedRowCount = 1;
|
d->collapsedRowCount = 1;
|
||||||
d->expandedRowCount = 1;
|
|
||||||
d->maxCacheSize = 1;
|
d->maxCacheSize = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +99,7 @@ int PixmapCacheModel::categoryDepth(int categoryIndex) const
|
|||||||
if (isEmpty())
|
if (isEmpty())
|
||||||
return 1;
|
return 1;
|
||||||
if (d->expanded)
|
if (d->expanded)
|
||||||
return d->expandedRowCount;
|
return d->pixmaps.count() + 2;
|
||||||
return d->collapsedRowCount;
|
return d->collapsedRowCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,14 +107,15 @@ int PixmapCacheModel::getEventRow(int index) const
|
|||||||
{
|
{
|
||||||
Q_D(const PixmapCacheModel);
|
Q_D(const PixmapCacheModel);
|
||||||
if (d->expanded)
|
if (d->expanded)
|
||||||
return d->range(index).rowNumberExpanded;
|
return getEventId(index) + 1;
|
||||||
return d->range(index).rowNumberCollapsed;
|
return d->range(index).rowNumberCollapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PixmapCacheModel::getEventId(int index) const
|
int PixmapCacheModel::getEventId(int index) const
|
||||||
{
|
{
|
||||||
Q_D(const PixmapCacheModel);
|
Q_D(const PixmapCacheModel);
|
||||||
return d->range(index).eventId;
|
return d->range(index).pixmapEventType == PixmapCacheCountChanged ?
|
||||||
|
0 : d->range(index).urlIndex + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor PixmapCacheModel::getColor(int index) const
|
QColor PixmapCacheModel::getColor(int index) const
|
||||||
@@ -297,9 +295,6 @@ void PixmapCacheModel::loadData()
|
|||||||
d->pixmaps << Pixmap(event.location.filename);
|
d->pixmaps << Pixmap(event.location.filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
newEvent.eventId = newEvent.urlIndex + 1;
|
|
||||||
newEvent.rowNumberExpanded = newEvent.urlIndex + 2;
|
|
||||||
|
|
||||||
Pixmap &pixmap = d->pixmaps[newEvent.urlIndex];
|
Pixmap &pixmap = d->pixmaps[newEvent.urlIndex];
|
||||||
switch (newEvent.pixmapEventType) {
|
switch (newEvent.pixmapEventType) {
|
||||||
case PixmapSizeKnown: {// pixmap size
|
case PixmapSizeKnown: {// pixmap size
|
||||||
@@ -486,7 +481,6 @@ void PixmapCacheModel::loadData()
|
|||||||
|
|
||||||
d->computeMaxCacheSize();
|
d->computeMaxCacheSize();
|
||||||
d->flattenLoads();
|
d->flattenLoads();
|
||||||
d->computeRowCounts();
|
|
||||||
d->computeNesting();
|
d->computeNesting();
|
||||||
|
|
||||||
d->modelManager->modelProxyCountUpdated(d->modelId, 1, 1);
|
d->modelManager->modelProxyCountUpdated(d->modelId, 1, 1);
|
||||||
@@ -498,7 +492,6 @@ void PixmapCacheModel::clear()
|
|||||||
d->SortedTimelineModel::clear();
|
d->SortedTimelineModel::clear();
|
||||||
d->pixmaps.clear();
|
d->pixmaps.clear();
|
||||||
d->collapsedRowCount = 1;
|
d->collapsedRowCount = 1;
|
||||||
d->expandedRowCount = 1;
|
|
||||||
d->maxCacheSize = 1;
|
d->maxCacheSize = 1;
|
||||||
d->expanded = false;
|
d->expanded = false;
|
||||||
|
|
||||||
@@ -530,6 +523,8 @@ void PixmapCacheModel::PixmapCacheModelPrivate::resizeUnfinishedLoads()
|
|||||||
|
|
||||||
void PixmapCacheModel::PixmapCacheModelPrivate::flattenLoads()
|
void PixmapCacheModel::PixmapCacheModelPrivate::flattenLoads()
|
||||||
{
|
{
|
||||||
|
collapsedRowCount = 0;
|
||||||
|
|
||||||
// computes "compressed row"
|
// computes "compressed row"
|
||||||
QVector <qint64> eventEndTimes;
|
QVector <qint64> eventEndTimes;
|
||||||
for (int i = 0; i < count(); i++) {
|
for (int i = 0; i < count(); i++) {
|
||||||
@@ -548,22 +543,11 @@ void PixmapCacheModel::PixmapCacheModelPrivate::flattenLoads()
|
|||||||
// readjust to account for category empty row and bargraph
|
// readjust to account for category empty row and bargraph
|
||||||
event.rowNumberCollapsed += 2;
|
event.rowNumberCollapsed += 2;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PixmapCacheModel::PixmapCacheModelPrivate::computeRowCounts()
|
|
||||||
{
|
|
||||||
expandedRowCount = 0;
|
|
||||||
collapsedRowCount = 0;
|
|
||||||
foreach (const PixmapCacheModel::PixmapCacheEvent &event, ranges) {
|
|
||||||
if (event.rowNumberExpanded > expandedRowCount)
|
|
||||||
expandedRowCount = event.rowNumberExpanded;
|
|
||||||
if (event.rowNumberCollapsed > collapsedRowCount)
|
if (event.rowNumberCollapsed > collapsedRowCount)
|
||||||
collapsedRowCount = event.rowNumberCollapsed;
|
collapsedRowCount = event.rowNumberCollapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Starting from 0, count is maxIndex+1
|
// Starting from 0, count is maxIndex+1
|
||||||
expandedRowCount++;
|
|
||||||
collapsedRowCount++;
|
collapsedRowCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,8 +555,6 @@ int PixmapCacheModel::PixmapCacheModelPrivate::updateCacheCount(int lastCacheSiz
|
|||||||
qint64 startTime, qint64 pixSize, PixmapCacheEvent &newEvent)
|
qint64 startTime, qint64 pixSize, PixmapCacheEvent &newEvent)
|
||||||
{
|
{
|
||||||
newEvent.pixmapEventType = PixmapCacheCountChanged;
|
newEvent.pixmapEventType = PixmapCacheCountChanged;
|
||||||
newEvent.eventId = 0;
|
|
||||||
newEvent.rowNumberExpanded = 1;
|
|
||||||
newEvent.rowNumberCollapsed = 1;
|
newEvent.rowNumberCollapsed = 1;
|
||||||
|
|
||||||
qint64 prevSize = 0;
|
qint64 prevSize = 0;
|
||||||
|
@@ -35,13 +35,11 @@ class PixmapCacheModel : public QmlProfiler::SingleCategoryTimelineModel
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
struct PixmapCacheEvent {
|
struct PixmapCacheEvent {
|
||||||
int eventId;
|
|
||||||
int pixmapEventType;
|
int pixmapEventType;
|
||||||
int urlIndex;
|
int urlIndex;
|
||||||
int sizeIndex;
|
int sizeIndex;
|
||||||
qint64 cacheSize;
|
|
||||||
int rowNumberExpanded;
|
|
||||||
int rowNumberCollapsed;
|
int rowNumberCollapsed;
|
||||||
|
qint64 cacheSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PixmapEventType {
|
enum PixmapEventType {
|
||||||
|
Reference in New Issue
Block a user