QmlProfiler: Fix location for QtQuick1 events before using them

If this is not done multiple event types with empty locations are
regarded as equal which leads to confusion later. Also, it's not a
good idea to change the "location" member for already inserted event
types as that prevents us from looking them up in the eventTypeIds
map.

Finally, preprocessing the filename and stripping certain parts
from the URL prevents a proper lookup later on, so this is removed.

Change-Id: Idbe87e0b16444291bb13ff604ae65e1d7e74c3a5
Task-number: QTCREATORBUG-13382
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2014-11-11 13:46:16 +01:00
parent f554c5f5c0
commit 1d483cd352

View File

@@ -53,20 +53,6 @@ private:
Q_DECLARE_PUBLIC(QmlProfilerDataModel)
};
QString getInitialDetails(const QmlProfilerDataModel::QmlEventTypeData &event);
QmlDebug::QmlEventLocation getLocation(const QmlProfilerDataModel::QmlEventTypeData &event)
{
QmlDebug::QmlEventLocation eventLocation = event.location;
if ((event.rangeType == QmlDebug::Creating || event.rangeType == QmlDebug::Compiling)
&& eventLocation.filename.isEmpty()) {
eventLocation.filename = getInitialDetails(event);
eventLocation.line = 1;
eventLocation.column = 1;
}
return eventLocation;
}
QString getDisplayName(const QmlProfilerDataModel::QmlEventTypeData &event)
{
if (event.location.filename.isEmpty()) {
@@ -214,7 +200,6 @@ void QmlProfilerDataModel::complete()
int n = d->eventTypes.count();
for (int i = 0; i < n; i++) {
QmlEventTypeData *event = &d->eventTypes[i];
event->location = getLocation(*event);
event->displayName = getDisplayName(*event);
event->data = getInitialDetails(*event);
@@ -253,6 +238,14 @@ void QmlProfilerDataModel::addQmlEvent(QmlDebug::Message message, QmlDebug::Rang
QString displayName;
QmlEventTypeData typeData = {displayName, location, message, rangeType, detailType, data};
// Special case for QtQuick 1 Compiling and Creating events: filename is in the "data" field.
if ((rangeType == QmlDebug::Compiling || rangeType == QmlDebug::Creating) &&
location.filename.isEmpty()) {
typeData.location.filename = data;
typeData.location.line = typeData.location.column = 1;
}
QmlEventData eventData = {-1, startTime, duration, ndata1, ndata2, ndata3, ndata4, ndata5};
QHash<QmlEventTypeData, int>::Iterator it = d->eventTypeIds.find(typeData);