forked from qt-creator/qt-creator
QmlProfiler: Remove extra file cache
The FileInProjectFinder has its own cache. We don't need to duplicate it. Change-Id: I90450ac734953e3747e55cb74505dd48e5f22f6e Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -112,14 +112,8 @@ void QmlProfilerDetailsRewriter::requestDetailsForLocation(int typeId,
|
|||||||
|
|
||||||
QString QmlProfilerDetailsRewriter::getLocalFile(const QString &remoteFile)
|
QString QmlProfilerDetailsRewriter::getLocalFile(const QString &remoteFile)
|
||||||
{
|
{
|
||||||
QString localFile;
|
const QString localFile = m_projectFinder.findFile(remoteFile);
|
||||||
if (!m_filesCache.contains(remoteFile)) {
|
const QFileInfo fileInfo(localFile);
|
||||||
localFile = m_projectFinder.findFile(remoteFile);
|
|
||||||
m_filesCache[remoteFile] = localFile;
|
|
||||||
} else {
|
|
||||||
localFile = m_filesCache[remoteFile];
|
|
||||||
}
|
|
||||||
QFileInfo fileInfo(localFile);
|
|
||||||
if (!fileInfo.exists() || !fileInfo.isReadable())
|
if (!fileInfo.exists() || !fileInfo.isReadable())
|
||||||
return QString();
|
return QString();
|
||||||
if (!QmlJS::ModelManagerInterface::guessLanguageOfFile(localFile).isQmlLikeOrJsLanguage())
|
if (!QmlJS::ModelManagerInterface::guessLanguageOfFile(localFile).isQmlLikeOrJsLanguage())
|
||||||
@@ -176,7 +170,6 @@ void QmlProfilerDetailsRewriter::disconnectQmlModel()
|
|||||||
|
|
||||||
void QmlProfilerDetailsRewriter::clear()
|
void QmlProfilerDetailsRewriter::clear()
|
||||||
{
|
{
|
||||||
m_filesCache.clear();
|
|
||||||
m_pendingEvents.clear();
|
m_pendingEvents.clear();
|
||||||
disconnectQmlModel();
|
disconnectQmlModel();
|
||||||
}
|
}
|
||||||
@@ -203,14 +196,12 @@ void QmlProfilerDetailsRewriter::documentReady(QmlJS::Document::Ptr doc)
|
|||||||
if (m_pendingEvents.isEmpty()) {
|
if (m_pendingEvents.isEmpty()) {
|
||||||
disconnectQmlModel();
|
disconnectQmlModel();
|
||||||
emit eventDetailsChanged();
|
emit eventDetailsChanged();
|
||||||
m_filesCache.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerDetailsRewriter::populateFileFinder(const ProjectExplorer::Target *target)
|
void QmlProfilerDetailsRewriter::populateFileFinder(const ProjectExplorer::Target *target)
|
||||||
{
|
{
|
||||||
QtSupport::BaseQtVersion::populateQmlFileFinder(&m_projectFinder, target);
|
QtSupport::BaseQtVersion::populateQmlFileFinder(&m_projectFinder, target);
|
||||||
m_filesCache.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -60,7 +60,6 @@ private:
|
|||||||
|
|
||||||
QMultiHash<QString, PendingEvent> m_pendingEvents;
|
QMultiHash<QString, PendingEvent> m_pendingEvents;
|
||||||
Utils::FileInProjectFinder m_projectFinder;
|
Utils::FileInProjectFinder m_projectFinder;
|
||||||
QHash<QString, QString> m_filesCache;
|
|
||||||
|
|
||||||
void rewriteDetailsForLocation(const QString &source, QmlJS::Document::Ptr doc, int typeId,
|
void rewriteDetailsForLocation(const QString &source, QmlJS::Document::Ptr doc, int typeId,
|
||||||
const QmlEventLocation &location);
|
const QmlEventLocation &location);
|
||||||
|
Reference in New Issue
Block a user