summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@digia.com>2014-03-27 15:43:09 +0100
committerUlf Hermann <ulf.hermann@digia.com>2014-04-03 11:07:17 +0300
commit9b92cf8ed1ae6fa5e3c3edd94d8a9153eebb31e6 (patch)
treebb00b702fea0bc9401b795542502dff48d596aa6 /plugins
parentb4d54648c4a25771d9450cb78ca38a2d6cfe1b69 (diff)
downloadqt-creator-9b92cf8ed1ae6fa5e3c3edd94d8a9153eebb31e6.tar.gz
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>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/qmlprofilerextension/pixmapcachemodel.cpp30
-rw-r--r--plugins/qmlprofilerextension/pixmapcachemodel.h4
2 files changed, 7 insertions, 27 deletions
diff --git a/plugins/qmlprofilerextension/pixmapcachemodel.cpp b/plugins/qmlprofilerextension/pixmapcachemodel.cpp
index 7e04f51b39..e3c65c68f7 100644
--- a/plugins/qmlprofilerextension/pixmapcachemodel.cpp
+++ b/plugins/qmlprofilerextension/pixmapcachemodel.cpp
@@ -70,12 +70,10 @@ public:
void computeMaxCacheSize();
void resizeUnfinishedLoads();
void flattenLoads();
- void computeRowCounts();
int updateCacheCount(int lastCacheSizeEvent, qint64 startTime, qint64 pixSize,
PixmapCacheEvent &newEvent);
QVector<Pixmap> pixmaps;
- int expandedRowCount;
int collapsedRowCount;
void addVP(QVariantList &l, QString label, qint64 time) const;
@@ -91,7 +89,6 @@ PixmapCacheModel::PixmapCacheModel(QObject *parent)
{
Q_D(PixmapCacheModel);
d->collapsedRowCount = 1;
- d->expandedRowCount = 1;
d->maxCacheSize = 1;
}
@@ -102,7 +99,7 @@ int PixmapCacheModel::categoryDepth(int categoryIndex) const
if (isEmpty())
return 1;
if (d->expanded)
- return d->expandedRowCount;
+ return d->pixmaps.count() + 2;
return d->collapsedRowCount;
}
@@ -110,14 +107,15 @@ int PixmapCacheModel::getEventRow(int index) const
{
Q_D(const PixmapCacheModel);
if (d->expanded)
- return d->range(index).rowNumberExpanded;
+ return getEventId(index) + 1;
return d->range(index).rowNumberCollapsed;
}
int PixmapCacheModel::getEventId(int index) const
{
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
@@ -297,9 +295,6 @@ void PixmapCacheModel::loadData()
d->pixmaps << Pixmap(event.location.filename);
}
- newEvent.eventId = newEvent.urlIndex + 1;
- newEvent.rowNumberExpanded = newEvent.urlIndex + 2;
-
Pixmap &pixmap = d->pixmaps[newEvent.urlIndex];
switch (newEvent.pixmapEventType) {
case PixmapSizeKnown: {// pixmap size
@@ -486,7 +481,6 @@ void PixmapCacheModel::loadData()
d->computeMaxCacheSize();
d->flattenLoads();
- d->computeRowCounts();
d->computeNesting();
d->modelManager->modelProxyCountUpdated(d->modelId, 1, 1);
@@ -498,7 +492,6 @@ void PixmapCacheModel::clear()
d->SortedTimelineModel::clear();
d->pixmaps.clear();
d->collapsedRowCount = 1;
- d->expandedRowCount = 1;
d->maxCacheSize = 1;
d->expanded = false;
@@ -530,6 +523,8 @@ void PixmapCacheModel::PixmapCacheModelPrivate::resizeUnfinishedLoads()
void PixmapCacheModel::PixmapCacheModelPrivate::flattenLoads()
{
+ collapsedRowCount = 0;
+
// computes "compressed row"
QVector <qint64> eventEndTimes;
for (int i = 0; i < count(); i++) {
@@ -548,22 +543,11 @@ void PixmapCacheModel::PixmapCacheModelPrivate::flattenLoads()
// readjust to account for category empty row and bargraph
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)
collapsedRowCount = event.rowNumberCollapsed;
}
// Starting from 0, count is maxIndex+1
- expandedRowCount++;
collapsedRowCount++;
}
@@ -571,8 +555,6 @@ int PixmapCacheModel::PixmapCacheModelPrivate::updateCacheCount(int lastCacheSiz
qint64 startTime, qint64 pixSize, PixmapCacheEvent &newEvent)
{
newEvent.pixmapEventType = PixmapCacheCountChanged;
- newEvent.eventId = 0;
- newEvent.rowNumberExpanded = 1;
newEvent.rowNumberCollapsed = 1;
qint64 prevSize = 0;
diff --git a/plugins/qmlprofilerextension/pixmapcachemodel.h b/plugins/qmlprofilerextension/pixmapcachemodel.h
index cbebf71d0d..fdf20f5195 100644
--- a/plugins/qmlprofilerextension/pixmapcachemodel.h
+++ b/plugins/qmlprofilerextension/pixmapcachemodel.h
@@ -35,13 +35,11 @@ class PixmapCacheModel : public QmlProfiler::SingleCategoryTimelineModel
public:
struct PixmapCacheEvent {
- int eventId;
int pixmapEventType;
int urlIndex;
int sizeIndex;
- qint64 cacheSize;
- int rowNumberExpanded;
int rowNumberCollapsed;
+ qint64 cacheSize;
};
enum PixmapEventType {