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:
Ulf Hermann
2018-06-12 10:45:21 +02:00
parent c679b3202a
commit c73c86e1a3
2 changed files with 2 additions and 12 deletions

View File

@@ -112,14 +112,8 @@ void QmlProfilerDetailsRewriter::requestDetailsForLocation(int typeId,
QString QmlProfilerDetailsRewriter::getLocalFile(const QString &remoteFile)
{
QString localFile;
if (!m_filesCache.contains(remoteFile)) {
localFile = m_projectFinder.findFile(remoteFile);
m_filesCache[remoteFile] = localFile;
} else {
localFile = m_filesCache[remoteFile];
}
QFileInfo fileInfo(localFile);
const QString localFile = m_projectFinder.findFile(remoteFile);
const QFileInfo fileInfo(localFile);
if (!fileInfo.exists() || !fileInfo.isReadable())
return QString();
if (!QmlJS::ModelManagerInterface::guessLanguageOfFile(localFile).isQmlLikeOrJsLanguage())
@@ -176,7 +170,6 @@ void QmlProfilerDetailsRewriter::disconnectQmlModel()
void QmlProfilerDetailsRewriter::clear()
{
m_filesCache.clear();
m_pendingEvents.clear();
disconnectQmlModel();
}
@@ -203,14 +196,12 @@ void QmlProfilerDetailsRewriter::documentReady(QmlJS::Document::Ptr doc)
if (m_pendingEvents.isEmpty()) {
disconnectQmlModel();
emit eventDetailsChanged();
m_filesCache.clear();
}
}
void QmlProfilerDetailsRewriter::populateFileFinder(const ProjectExplorer::Target *target)
{
QtSupport::BaseQtVersion::populateQmlFileFinder(&m_projectFinder, target);
m_filesCache.clear();
}
} // namespace Internal

View File

@@ -60,7 +60,6 @@ private:
QMultiHash<QString, PendingEvent> m_pendingEvents;
Utils::FileInProjectFinder m_projectFinder;
QHash<QString, QString> m_filesCache;
void rewriteDetailsForLocation(const QString &source, QmlJS::Document::Ptr doc, int typeId,
const QmlEventLocation &location);