forked from qt-creator/qt-creator
QmakeProjectManager: Do not keep an IDocument in QmakePriFile
Instead, we keep the IDocuments as "extra project files" in the Project class, like the other project managers do it. This has two advantages: - The document is no longer created in a parser thread callback, improving Qt Creator responsiveness while loading a project. - The IDocuments no longer get needlessly destroyed and re-created on a re-parse. This is relevant because adding these objects to the DocumentManager results in the creation of file watchers, which is expensive. Task-number: QTCREATORBUG-18533 Change-Id: I49c03377974e6b33340234dbabbbd82b8d0c827c Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -182,8 +182,6 @@ void QmakePriFile::finishInitialization(QmakeBuildSystem *buildSystem, QmakeProF
|
|||||||
QTC_ASSERT(buildSystem, return);
|
QTC_ASSERT(buildSystem, return);
|
||||||
m_buildSystem = buildSystem;
|
m_buildSystem = buildSystem;
|
||||||
m_qmakeProFile = qmakeProFile;
|
m_qmakeProFile = qmakeProFile;
|
||||||
m_priFileDocument = std::make_unique<QmakePriFileDocument>(this, filePath());
|
|
||||||
Core::DocumentManager::addDocument(m_priFileDocument.get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePath QmakePriFile::filePath() const
|
FilePath QmakePriFile::filePath() const
|
||||||
|
@@ -236,7 +236,6 @@ private:
|
|||||||
QmakePriFile *m_parent = nullptr;
|
QmakePriFile *m_parent = nullptr;
|
||||||
QVector<QmakePriFile *> m_children;
|
QVector<QmakePriFile *> m_children;
|
||||||
|
|
||||||
std::unique_ptr<Core::IDocument> m_priFileDocument;
|
|
||||||
Utils::TextFileFormat m_textFormat;
|
Utils::TextFileFormat m_textFormat;
|
||||||
|
|
||||||
// Memory is cheap...
|
// Memory is cheap...
|
||||||
|
@@ -259,6 +259,15 @@ void QmakeBuildSystem::updateCodeModels()
|
|||||||
updateQmlJSCodeModel();
|
updateQmlJSCodeModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmakeBuildSystem::updateDocuments()
|
||||||
|
{
|
||||||
|
QVector<FilePath> projectDocuments;
|
||||||
|
project()->rootProjectNode()->forEachProjectNode([&projectDocuments](const ProjectNode *n) {
|
||||||
|
projectDocuments << n->filePath();
|
||||||
|
});
|
||||||
|
project()->setExtraProjectFiles(projectDocuments);
|
||||||
|
}
|
||||||
|
|
||||||
void QmakeBuildSystem::updateCppCodeModel()
|
void QmakeBuildSystem::updateCppCodeModel()
|
||||||
{
|
{
|
||||||
m_toolChainWarnings.clear();
|
m_toolChainWarnings.clear();
|
||||||
@@ -528,6 +537,7 @@ void QmakeBuildSystem::decrementPendingEvaluateFutures()
|
|||||||
m_asyncUpdateState = Base;
|
m_asyncUpdateState = Base;
|
||||||
updateBuildSystemData();
|
updateBuildSystemData();
|
||||||
updateCodeModels();
|
updateCodeModels();
|
||||||
|
updateDocuments();
|
||||||
target()->updateDefaultDeployConfigurations();
|
target()->updateDefaultDeployConfigurations();
|
||||||
m_guard.markAsSuccess(); // Qmake always returns (some) data, even when it failed:-)
|
m_guard.markAsSuccess(); // Qmake always returns (some) data, even when it failed:-)
|
||||||
m_guard = {}; // This triggers emitParsingFinished by destroying the previous guard.
|
m_guard = {}; // This triggers emitParsingFinished by destroying the previous guard.
|
||||||
|
@@ -151,6 +151,7 @@ public:
|
|||||||
bool wasEvaluateCanceled();
|
bool wasEvaluateCanceled();
|
||||||
|
|
||||||
void updateCodeModels();
|
void updateCodeModels();
|
||||||
|
void updateDocuments();
|
||||||
|
|
||||||
void watchFolders(const QStringList &l, QmakePriFile *file);
|
void watchFolders(const QStringList &l, QmakePriFile *file);
|
||||||
void unwatchFolders(const QStringList &l, QmakePriFile *file);
|
void unwatchFolders(const QStringList &l, QmakePriFile *file);
|
||||||
|
Reference in New Issue
Block a user