make ProFileOption persist during the scan of an entire project

there is no point in throwing away and re-recreating invariant data over
and over ...

shaves off ~15% of the load time of Qt 4.6.
This commit is contained in:
Oswald Buddenhagen
2009-12-07 20:49:39 +01:00
parent 0682dae77c
commit ef660880ad
11 changed files with 67 additions and 62 deletions

View File

@@ -320,7 +320,8 @@ Qt4Project::Qt4Project(Qt4Manager *manager, const QString& fileName) :
m_fileInfo(new Qt4ProjectFile(this, fileName, this)),
m_isApplication(true),
m_projectFiles(new Qt4ProjectFiles),
m_lastActiveQt4BuildConfiguration(0)
m_lastActiveQt4BuildConfiguration(0),
m_proFileOption(0)
{
m_manager->registerProject(this);
@@ -855,6 +856,38 @@ void Qt4Project::proFileParseError(const QString &errorMessage)
Core::ICore::instance()->messageManager()->printToOutputPane(errorMessage);
}
ProFileReader *Qt4Project::createProFileReader(Qt4ProFileNode *qt4ProFileNode)
{
if (!m_proFileOption) {
m_proFileOption = new ProFileOption;
m_proFileOptionRefCnt = 0;
if (Qt4BuildConfiguration *qt4bc = activeQt4BuildConfiguration()) {
QtVersion *version = qt4bc->qtVersion();
if (version->isValid())
m_proFileOption->properties = version->versionInfo();
}
}
++m_proFileOptionRefCnt;
ProFileReader *reader = new ProFileReader(m_proFileOption);
connect(reader, SIGNAL(errorFound(QString)),
this, SLOT(proFileParseError(QString)));
reader->setOutputDir(qt4ProFileNode->buildDir());
return reader;
}
void Qt4Project::destroyProFileReader(ProFileReader *reader)
{
delete reader;
if (!--m_proFileOptionRefCnt) {
delete m_proFileOption;
m_proFileOption = 0;
}
}
Qt4ProFileNode *Qt4Project::rootProjectNode() const
{
return m_rootProjectNode;