diff --git a/plugins/qmlprofilerextension/pixmapcachemodel.cpp b/plugins/qmlprofilerextension/pixmapcachemodel.cpp index d1fec8d1712..ff77f8f9623 100644 --- a/plugins/qmlprofilerextension/pixmapcachemodel.cpp +++ b/plugins/qmlprofilerextension/pixmapcachemodel.cpp @@ -395,17 +395,17 @@ void PixmapCacheModel::loadData() newEvent.urlIndex = d->pixmapUrls.count(); d->pixmapUrls << event.location.filename; d->pixmapSizes << QPair(0,0); // default value - pixmapStartPoints << d->eventList.count(); // index to the starting point - } - - if (newEvent.pixmapEventType == PixmapSizeKnown) { // pixmap size - d->pixmapSizes[newEvent.urlIndex] = QPair((int)event.numericData1, (int)event.numericData2); + pixmapStartPoints << -1; // dummy value to be filled by load event } newEvent.eventId = newEvent.urlIndex + 1; + newEvent.rowNumberExpanded = newEvent.urlIndex + 2; - // Cache Size Changed Event - if (newEvent.pixmapEventType == PixmapCacheCountChanged) { + switch (newEvent.pixmapEventType) { + case PixmapSizeKnown: // pixmap size + d->pixmapSizes[newEvent.urlIndex] = QPair((int)event.numericData1, (int)event.numericData2); + break; + case PixmapCacheCountChanged: {// Cache Size Changed Event newEvent.startTime = event.startTime + 1; // delay 1 ns for proper sorting newEvent.eventId = 0; newEvent.rowNumberExpanded = 1; @@ -424,18 +424,16 @@ void PixmapCacheModel::loadData() newEvent.cacheSize = prevSize + pixSize; d->eventList << newEvent; lastCacheSizeEvent = d->eventList.count() - 1; + break; } - - // Load - if (newEvent.pixmapEventType == PixmapLoadingStarted) { + case PixmapLoadingStarted: // Load pixmapStartPoints[newEvent.urlIndex] = d->eventList.count(); - newEvent.rowNumberExpanded = newEvent.urlIndex + 2; d->eventList << newEvent; - } - - if (newEvent.pixmapEventType == PixmapLoadingFinished || newEvent.pixmapEventType == PixmapLoadingError) { + break; + case PixmapLoadingFinished: + case PixmapLoadingError: { int loadIndex = pixmapStartPoints[newEvent.urlIndex]; - if (!isNewEntry) { + if (!isNewEntry && loadIndex != -1) { d->eventList[loadIndex].duration = event.startTime - d->eventList[loadIndex].startTime; } else { // if it's a new entry it means that we don't have a corresponding start @@ -443,12 +441,18 @@ void PixmapCacheModel::loadData() newEvent.rowNumberExpanded = newEvent.urlIndex + 2; newEvent.startTime = traceStartTime(); newEvent.duration = event.startTime - traceStartTime(); + loadIndex = d->eventList.count(); d->eventList << newEvent; + pixmapStartPoints[newEvent.urlIndex] = loadIndex; } if (event.bindingType == PixmapLoadingFinished) d->eventList[loadIndex].cacheSize = 1; // use count to mark success else d->eventList[loadIndex].cacheSize = -1; // ... or failure + break; + } + default: + break; } m_modelManager->modelProxyCountUpdated(m_modelId, d->eventList.count(), 2*simpleModel->getEvents().count());