Commit 1d483cd3 authored by Ulf Hermann's avatar Ulf Hermann
Browse files

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: default avatarKai Koehne <kai.koehne@theqtcompany.com>
parent f554c5f5
...@@ -53,20 +53,6 @@ private: ...@@ -53,20 +53,6 @@ private:
Q_DECLARE_PUBLIC(QmlProfilerDataModel) 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) QString getDisplayName(const QmlProfilerDataModel::QmlEventTypeData &event)
{ {
if (event.location.filename.isEmpty()) { if (event.location.filename.isEmpty()) {
...@@ -214,7 +200,6 @@ void QmlProfilerDataModel::complete() ...@@ -214,7 +200,6 @@ void QmlProfilerDataModel::complete()
int n = d->eventTypes.count(); int n = d->eventTypes.count();
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
QmlEventTypeData *event = &d->eventTypes[i]; QmlEventTypeData *event = &d->eventTypes[i];
event->location = getLocation(*event);
event->displayName = getDisplayName(*event); event->displayName = getDisplayName(*event);
event->data = getInitialDetails(*event); event->data = getInitialDetails(*event);
...@@ -253,6 +238,14 @@ void QmlProfilerDataModel::addQmlEvent(QmlDebug::Message message, QmlDebug::Rang ...@@ -253,6 +238,14 @@ void QmlProfilerDataModel::addQmlEvent(QmlDebug::Message message, QmlDebug::Rang
QString displayName; QString displayName;
QmlEventTypeData typeData = {displayName, location, message, rangeType, detailType, data}; 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}; QmlEventData eventData = {-1, startTime, duration, ndata1, ndata2, ndata3, ndata4, ndata5};
QHash<QmlEventTypeData, int>::Iterator it = d->eventTypeIds.find(typeData); QHash<QmlEventTypeData, int>::Iterator it = d->eventTypeIds.find(typeData);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment