Revert "Make sure that all pixmap URLs have a some event in the timeline"

This reverts commit 727f943671.
It was accidentally pushed without review and is broken, too.
This commit is contained in:
Ulf Hermann
2013-12-06 14:24:16 +01:00
parent 727f943671
commit eef8fe6544
2 changed files with 23 additions and 36 deletions

View File

@@ -368,16 +368,6 @@ bool compareStartTimes(const PixmapCacheModel::PixmapCacheEvent&t1, const Pixmap
return t1.startTime < t2.startTime; return t1.startTime < t2.startTime;
} }
void PixmapCacheModel::synthesizeLoadStart(PixmapCacheEvent &newEvent)
{
// if it's a new entry it means that we don't have a corresponding start
newEvent.pixmapEventType = PixmapLoadingStarted;
newEvent.rowNumberExpanded = newEvent.urlIndex + 2;
newEvent.duration = newEvent.startTime - traceStartTime();
newEvent.startTime = traceStartTime();
d->eventList << newEvent;
}
void PixmapCacheModel::loadData() void PixmapCacheModel::loadData()
{ {
clear(); clear();
@@ -403,24 +393,22 @@ void PixmapCacheModel::loadData()
if (newEvent.urlIndex == -1) { if (newEvent.urlIndex == -1) {
isNewEntry = true; isNewEntry = true;
newEvent.urlIndex = d->pixmapUrls.count(); newEvent.urlIndex = d->pixmapUrls.count();
qDebug() << "url: " << event.location.filename << " type: " << newEvent.pixmapEventType;
d->pixmapUrls << event.location.filename; d->pixmapUrls << event.location.filename;
d->pixmapSizes << QPair<int, int>(0,0); // default value d->pixmapSizes << QPair<int, int>(0,0); // default value
pixmapStartPoints << d->eventList.count(); // index to the starting point pixmapStartPoints << d->eventList.count(); // index to the starting point
} }
newEvent.eventId = newEvent.urlIndex + 1; if (newEvent.pixmapEventType == PixmapSizeKnown) { // pixmap size
newEvent.rowNumberExpanded = newEvent.urlIndex + 2;
switch (newEvent.pixmapEventType) {
case PixmapSizeKnown: // pixmap size
d->pixmapSizes[newEvent.urlIndex] = QPair<int,int>((int)event.numericData1, (int)event.numericData2); d->pixmapSizes[newEvent.urlIndex] = QPair<int,int>((int)event.numericData1, (int)event.numericData2);
if (isNewEntry) }
synthesizeLoadStart(newEvent);
break; newEvent.eventId = newEvent.urlIndex + 1;
case PixmapCacheCountChanged: {// Cache Size Changed Event
// Cache Size Changed Event
if (newEvent.pixmapEventType == PixmapCacheCountChanged) {
newEvent.startTime = event.startTime + 1; // delay 1 ns for proper sorting newEvent.startTime = event.startTime + 1; // delay 1 ns for proper sorting
newEvent.eventId = 0; newEvent.eventId = 0;
newEvent.rowNumberExpanded = 1;
newEvent.rowNumberCollapsed = 1; newEvent.rowNumberCollapsed = 1;
qint64 pixSize = d->pixmapSizes[newEvent.urlIndex].first * d->pixmapSizes[newEvent.urlIndex].second; qint64 pixSize = d->pixmapSizes[newEvent.urlIndex].first * d->pixmapSizes[newEvent.urlIndex].second;
@@ -436,34 +424,35 @@ void PixmapCacheModel::loadData()
newEvent.cacheSize = prevSize + pixSize; newEvent.cacheSize = prevSize + pixSize;
d->eventList << newEvent; d->eventList << newEvent;
lastCacheSizeEvent = d->eventList.count() - 1; lastCacheSizeEvent = d->eventList.count() - 1;
break;
} }
case PixmapLoadingStarted: // Load
// Load
if (newEvent.pixmapEventType == PixmapLoadingStarted) {
pixmapStartPoints[newEvent.urlIndex] = d->eventList.count(); pixmapStartPoints[newEvent.urlIndex] = d->eventList.count();
newEvent.rowNumberExpanded = newEvent.urlIndex + 2;
d->eventList << newEvent; d->eventList << newEvent;
break; }
case PixmapLoadingFinished:
case PixmapLoadingError: { if (newEvent.pixmapEventType == PixmapLoadingFinished || newEvent.pixmapEventType == PixmapLoadingError) {
int loadIndex = pixmapStartPoints[newEvent.urlIndex]; int loadIndex = pixmapStartPoints[newEvent.urlIndex];
if (!isNewEntry) { if (!isNewEntry) {
d->eventList[loadIndex].duration = event.startTime - d->eventList[loadIndex].startTime; d->eventList[loadIndex].duration = event.startTime - d->eventList[loadIndex].startTime;
} else { } else {
synthesizeLoadStart(newEvent); // if it's a new entry it means that we don't have a corresponding start
newEvent.pixmapEventType = PixmapLoadingStarted;
newEvent.rowNumberExpanded = newEvent.urlIndex + 2;
newEvent.startTime = traceStartTime();
newEvent.duration = event.startTime - traceStartTime();
d->eventList << newEvent;
} }
if (event.bindingType == PixmapLoadingFinished) if (event.bindingType == PixmapLoadingFinished)
d->eventList[loadIndex].cacheSize = 1; // use count to mark success d->eventList[loadIndex].cacheSize = 1; // use count to mark success
else else
d->eventList[loadIndex].cacheSize = -1; // ... or failure d->eventList[loadIndex].cacheSize = -1; // ... or failure
break;
} }
default:
if (isNewEntry)
synthesizeLoadStart(newEvent);
break;
}
}
m_modelManager->modelProxyCountUpdated(m_modelId, d->eventList.count(), 2*simpleModel->getEvents().count()); m_modelManager->modelProxyCountUpdated(m_modelId, d->eventList.count(), 2*simpleModel->getEvents().count());
}
if (lastCacheSizeEvent != -1) { if (lastCacheSizeEvent != -1) {
d->eventList[lastCacheSizeEvent].duration = traceEndTime() - d->eventList[lastCacheSizeEvent].startTime; d->eventList[lastCacheSizeEvent].duration = traceEndTime() - d->eventList[lastCacheSizeEvent].startTime;

View File

@@ -114,8 +114,6 @@ protected slots:
void dataChanged(); void dataChanged();
private: private:
void synthesizeLoadStart(PixmapCacheEvent &newEvent);
class PixmapCacheModelPrivate; class PixmapCacheModelPrivate;
PixmapCacheModelPrivate *d; PixmapCacheModelPrivate *d;