Commit 8c90998f authored by Nikolai Kosjar's avatar Nikolai Kosjar

CppTools/ProjectManagers: Reduce ui blocking when loading projects

${AnyProject}::updateCppCodeModel() did two potentially not that cheap
operations in the ui thread:
 (1) Querying the MimeDatabase for the mime type for the source files of
     the project. In 99.9% of the cases no files need to be read for
     this as the file extension will resolve the type. The expensiveness
     comes from the sheer number of files that can occur.
 (2) Calling compilers with the "(sub)project's compiler command line"
     to determine the macros. While the caches avoid redundant calls,
     the number of the unique compiler calls makes this still a
     ui-freezing experience.

These two operations are moved into a worker thread. For this, the
expensive compiler calls are encapsulated in thread safe lambdas
("runners") in order to keep the "mutexed" data minimal. The original
API calls of the toolchains are implemented in terms of the runners.

While adapting the project managers, remove also the calls to
setProjectLanguage(). These are redundant because all of the project
managers already set a proper value in the constructor. Also, currently
there is no need (client) to report back detection of C sources in
project parts. This also keeps CppProjectUpdater simple.

There is still room for improvement:
 * Run the compiler calls in parallel instead of sequence.
 * Ensure that the mime type for a file is determined exactly once.

Change-Id: I2efc4e132ee88e3c8f264012ec8fafe3d86c404f
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 010060de
......@@ -47,7 +47,7 @@
#include <extensionsystem/pluginmanager.h>
#include <cpptools/cppmodelmanager.h>
#include <cpptools/projectinfo.h>
#include <cpptools/projectpartbuilder.h>
#include <cpptools/cppprojectupdater.h>
#include <coreplugin/icore.h>
#include <coreplugin/icontext.h>
#include <qtsupport/baseqtversion.h>
......@@ -70,7 +70,8 @@ using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer;
AutotoolsProject::AutotoolsProject(AutotoolsManager *manager, const QString &fileName) :
m_fileWatcher(new Utils::FileSystemWatcher(this))
m_fileWatcher(new Utils::FileSystemWatcher(this)),
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
{
setId(Constants::AUTOTOOLS_PROJECT_ID);
setProjectManager(manager);
......@@ -86,6 +87,8 @@ AutotoolsProject::AutotoolsProject(AutotoolsManager *manager, const QString &fil
AutotoolsProject::~AutotoolsProject()
{
delete m_cppCodeModelUpdater;
setRootProjectNode(0);
if (m_makefileParserThread != 0) {
......@@ -270,42 +273,47 @@ static QStringList filterIncludes(const QString &absSrc, const QString &absBuild
void AutotoolsProject::updateCppCodeModel()
{
CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance();
const Kit *k = nullptr;
if (Target *target = activeTarget())
k = target->kit();
else
k = KitManager::defaultKit();
QTC_ASSERT(k, return);
ToolChain *cToolChain
= ToolChainKitInformation::toolChain(k, ProjectExplorer::Constants::C_LANGUAGE_ID);
ToolChain *cxxToolChain
= ToolChainKitInformation::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
m_codeModelFuture.cancel();
CppTools::ProjectInfo pInfo(this);
CppTools::ProjectPartBuilder ppBuilder(pInfo);
m_cppCodeModelUpdater->cancel();
ppBuilder.setProjectFile(projectFilePath().toString());
CppTools::RawProjectPart rpp;
rpp.setProjectFile(projectFilePath().toString());
CppTools::ProjectPart::QtVersion activeQtVersion = CppTools::ProjectPart::NoQt;
if (QtSupport::BaseQtVersion *qtVersion =
QtSupport::QtKitInformation::qtVersion(activeTarget()->kit())) {
if (QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(k)) {
if (qtVersion->qtVersion() < QtSupport::QtVersionNumber(5,0,0))
activeQtVersion = CppTools::ProjectPart::Qt4;
else
activeQtVersion = CppTools::ProjectPart::Qt5;
}
ppBuilder.setQtVersion(activeQtVersion);
rpp.setQtVersion(activeQtVersion);
const QStringList cflags = m_makefileParserThread->cflags();
QStringList cxxflags = m_makefileParserThread->cxxflags();
if (cxxflags.isEmpty())
cxxflags = cflags;
ppBuilder.setCFlags(cflags);
ppBuilder.setCxxFlags(cxxflags);
rpp.setFlagsForC({cToolChain, cflags});
rpp.setFlagsForCxx({cxxToolChain, cxxflags});
const QString absSrc = projectDirectory().toString();
const Target *target = activeTarget();
const QString absBuild = (target && target->activeBuildConfiguration())
? target->activeBuildConfiguration()->buildDirectory().toString() : QString();
ppBuilder.setIncludePaths(filterIncludes(absSrc, absBuild, m_makefileParserThread->includePaths()));
ppBuilder.setDefines(m_makefileParserThread->defines());
const QList<Core::Id> languages = ppBuilder.createProjectPartsForFiles(m_files);
foreach (Core::Id language, languages)
setProjectLanguage(language, true);
rpp.setIncludePaths(filterIncludes(absSrc, absBuild, m_makefileParserThread->includePaths()));
rpp.setDefines(m_makefileParserThread->defines());
rpp.setFiles(m_files);
m_codeModelFuture = modelManager->updateProjectInfo(pInfo);
m_cppCodeModelUpdater->update({this, cToolChain, cxxToolChain, k, {rpp}});
}
......@@ -37,6 +37,8 @@ QT_FORWARD_DECLARE_CLASS(QDir)
namespace Utils { class FileSystemWatcher; }
namespace CppTools { class CppProjectUpdater; }
namespace ProjectExplorer {
class Node;
class FolderNode;
......@@ -119,7 +121,7 @@ private:
/// Responsible for parsing the makefiles asynchronously in a thread
MakefileParserThread *m_makefileParserThread = nullptr;
QFuture<void> m_codeModelFuture;
CppTools::CppProjectUpdater *m_cppCodeModelUpdater = nullptr;
};
} // namespace Internal
......
......@@ -38,7 +38,6 @@
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <cpptools/cpptoolsconstants.h>
#include <cpptools/projectpartbuilder.h>
#include <projectexplorer/headerpath.h>
#include <projectexplorer/kit.h>
#include <projectexplorer/kitinformation.h>
......@@ -289,10 +288,10 @@ void BuildDirManager::generateProjectTree(CMakeListsNode *root, const QList<cons
root->addNode(new FileNode(projectFile, FileType::Project, false));
}
QSet<Core::Id> BuildDirManager::updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder)
void BuildDirManager::updateCodeModel(CppTools::RawProjectParts &rpps)
{
QTC_ASSERT(m_reader, return QSet<Core::Id>());
return m_reader->updateCodeModel(ppBuilder);
QTC_ASSERT(m_reader, return);
return m_reader->updateCodeModel(rpps);
}
void BuildDirManager::parse()
......
......@@ -37,8 +37,6 @@
#include <functional>
#include <memory>
namespace CppTools { class ProjectPartBuilder; }
namespace ProjectExplorer {
class FileNode;
class IOutputParser;
......@@ -73,7 +71,7 @@ public:
void generateProjectTree(CMakeListsNode *root,
const QList<const ProjectExplorer::FileNode *> &allFiles);
QSet<Core::Id> updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder);
void updateCodeModel(CppTools::RawProjectParts &rpps);
QList<CMakeBuildTarget> buildTargets() const;
CMakeConfig parsedConfiguration() const;
......
......@@ -29,6 +29,8 @@
#include "cmakeproject.h"
#include "cmaketool.h"
#include <cpptools/cpprawprojectpart.h>
#include <utils/environment.h>
#include <utils/fileutils.h>
#include <utils/macroexpander.h>
......@@ -36,8 +38,6 @@
#include <QFutureInterface>
#include <QObject>
namespace CppTools { class ProjectPartBuilder; }
namespace CMakeProjectManager {
namespace Internal {
......@@ -97,7 +97,7 @@ public:
virtual QList<CMakeBuildTarget> buildTargets() const = 0;
virtual void generateProjectTree(CMakeListsNode *root,
const QList<const ProjectExplorer::FileNode *> &allFiles) = 0;
virtual QSet<Core::Id> updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder) = 0;
virtual void updateCodeModel(CppTools::RawProjectParts &rpps) = 0;
signals:
void isReadyNow() const;
......
......@@ -220,9 +220,9 @@ void CMakeBuildConfiguration::generateProjectTree(CMakeListsNode *root,
m_buildDirManager->generateProjectTree(root, allFiles);
}
QSet<Core::Id> CMakeBuildConfiguration::updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder)
void CMakeBuildConfiguration::updateCodeModel(CppTools::RawProjectParts &rpps)
{
return m_buildDirManager->updateCodeModel(ppBuilder);
m_buildDirManager->updateCodeModel(rpps);
}
FileName CMakeBuildConfiguration::shadowBuildDirectory(const FileName &projectFilePath,
......
......@@ -29,12 +29,13 @@
#include "cmakeproject.h"
#include "configmodel.h"
#include <cpptools/cpprawprojectpart.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/abi.h>
#include <memory>
namespace CppTools { class ProjectPartBuilder; }
namespace ProjectExplorer { class ToolChain; }
namespace CMakeProjectManager {
......@@ -86,7 +87,7 @@ public:
QList<CMakeBuildTarget> buildTargets() const;
void generateProjectTree(CMakeListsNode *root, const QList<const ProjectExplorer::FileNode *> &allFiles) const;
QSet<Core::Id> updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder);
void updateCodeModel(CppTools::RawProjectParts &rpps);
static Utils::FileName
shadowBuildDirectory(const Utils::FileName &projectFilePath, const ProjectExplorer::Kit *k,
......
......@@ -33,11 +33,11 @@
#include "cmakeprojectmanager.h"
#include <coreplugin/progressmanager/progressmanager.h>
#include <cpptools/cppmodelmanager.h>
#include <cpptools/cpprawprojectpart.h>
#include <cpptools/cppprojectupdater.h>
#include <cpptools/generatedcodemodelsupport.h>
#include <cpptools/projectinfo.h>
#include <cpptools/cpptoolsconstants.h>
#include <cpptools/projectpartbuilder.h>
#include <projectexplorer/buildtargetinfo.h>
#include <projectexplorer/deploymentdata.h>
#include <projectexplorer/headerpath.h>
......@@ -74,6 +74,7 @@ using namespace Internal;
\class CMakeProject
*/
CMakeProject::CMakeProject(CMakeManager *manager, const FileName &fileName)
: m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
{
setId(CMakeProjectManager::Constants::CMAKEPROJECT_ID);
setProjectManager(manager);
......@@ -133,8 +134,8 @@ CMakeProject::~CMakeProject()
future.cancel();
future.waitForFinished();
}
delete m_cppCodeModelUpdater;
setRootProjectNode(nullptr);
m_codeModelFuture.cancel();
qDeleteAll(m_extraCompilers);
qDeleteAll(m_allFiles);
}
......@@ -165,10 +166,6 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc)
return;
}
CppTools::CppModelManager *modelmanager = CppTools::CppModelManager::instance();
CppTools::ProjectInfo pinfo(this);
CppTools::ProjectPartBuilder ppBuilder(pinfo);
CppTools::ProjectPart::QtVersion activeQtVersion = CppTools::ProjectPart::NoQt;
if (QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(k)) {
if (qtVersion->qtVersion() < QtSupport::QtVersionNumber(5,0,0))
......@@ -177,14 +174,17 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc)
activeQtVersion = CppTools::ProjectPart::Qt5;
}
ppBuilder.setQtVersion(activeQtVersion);
CppTools::RawProjectParts rpps;
bc->updateCodeModel(rpps);
const QSet<Core::Id> languages = bc->updateCodeModel(ppBuilder);
for (const auto &lid : languages)
setProjectLanguage(lid, true);
for (CppTools::RawProjectPart &rpp : rpps) {
// TODO: Set the Qt version only if target actually depends on Qt.
rpp.setQtVersion(activeQtVersion);
// TODO: Support also C
rpp.setFlagsForCxx({tc, rpp.flagsForCxx.commandLineFlags});
}
m_codeModelFuture.cancel();
m_codeModelFuture = modelmanager->updateProjectInfo(pinfo);
m_cppCodeModelUpdater->update({this, nullptr, tc, k, rpps});
updateQmlJSCodeModel();
......
......@@ -43,6 +43,8 @@ QT_BEGIN_NAMESPACE
class QFileSystemWatcher;
QT_END_NAMESPACE
namespace CppTools { class CppProjectUpdater; }
namespace CMakeProjectManager {
namespace Internal {
......@@ -134,7 +136,7 @@ private:
// TODO probably need a CMake specific node structure
QList<CMakeBuildTarget> m_buildTargets;
QFuture<void> m_codeModelFuture;
CppTools::CppProjectUpdater *m_cppCodeModelUpdater = nullptr;
QList<ProjectExplorer::ExtraCompiler *> m_extraCompilers;
Internal::TreeScanner m_treeScanner;
......
......@@ -34,7 +34,6 @@
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <cpptools/projectpartbuilder.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/task.h>
......@@ -287,9 +286,8 @@ void ServerModeReader::generateProjectTree(CMakeListsNode *root,
addProjects(root, m_projects, allFiles);
}
QSet<Core::Id> ServerModeReader::updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder)
void ServerModeReader::updateCodeModel(CppTools::RawProjectParts &rpps)
{
QSet<Core::Id> languages;
int counter = 0;
foreach (const FileGroup *fg, m_fileGroups) {
++counter;
......@@ -304,23 +302,29 @@ QSet<Core::Id> ServerModeReader::updateCodeModel(CppTools::ProjectPartBuilder &p
const QStringList flags = QtcProcess::splitArgs(fg->compileFlags);
const QStringList includes = transform(fg->includePaths, [](const IncludePath *ip) { return ip->path.toString(); });
ppBuilder.setProjectFile(fg->target->sourceDirectory.toString() + "/CMakeLists.txt");
ppBuilder.setDisplayName(fg->target->name + QString::number(counter));
ppBuilder.setDefines(defineArg.toUtf8());
ppBuilder.setIncludePaths(includes);
ppBuilder.setCFlags(flags);
ppBuilder.setCxxFlags(flags);
CppTools::RawProjectPart rpp;
rpp.setProjectFile(fg->target->sourceDirectory.toString() + "/CMakeLists.txt");
rpp.setDisplayName(fg->target->name + QString::number(counter));
rpp.setDefines(defineArg.toUtf8());
rpp.setIncludePaths(includes);
CppTools::RawProjectPartFlags cProjectFlags;
cProjectFlags.commandLineFlags = flags;
rpp.setFlagsForC(cProjectFlags);
languages.unite(QSet<Core::Id>::fromList(ppBuilder.createProjectPartsForFiles(transform(fg->sources, &FileName::toString))));
CppTools::RawProjectPartFlags cxxProjectFlags;
cxxProjectFlags.commandLineFlags = flags;
rpp.setFlagsForCxx(cxxProjectFlags);
rpp.setFiles(transform(fg->sources, &FileName::toString));
rpps.append(rpp);
}
qDeleteAll(m_projects); // Not used anymore!
m_projects.clear();
m_targets.clear();
m_fileGroups.clear();
return languages;
}
void ServerModeReader::handleReply(const QVariantMap &data, const QString &inReplyTo)
......
......@@ -56,7 +56,7 @@ public:
CMakeConfig takeParsedConfiguration() final;
void generateProjectTree(CMakeListsNode *root,
const QList<const ProjectExplorer::FileNode *> &allFiles) final;
QSet<Core::Id> updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder) final;
void updateCodeModel(CppTools::RawProjectParts &rpps) final;
private:
void handleReply(const QVariantMap &data, const QString &inReplyTo);
......
......@@ -40,7 +40,6 @@
#include <coreplugin/messagemanager.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/reaper.h>
#include <cpptools/projectpartbuilder.h>
#include <projectexplorer/headerpath.h>
#include <projectexplorer/ioutputparser.h>
#include <projectexplorer/kitinformation.h>
......@@ -312,9 +311,8 @@ static void processCMakeIncludes(const CMakeBuildTarget &cbt, const ToolChain *t
}
}
QSet<Id> TeaLeafReader::updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder)
void TeaLeafReader::updateCodeModel(CppTools::RawProjectParts &rpps)
{
QSet<Id> languages;
const ToolChain *tcCxx = ToolChainManager::findToolChain(m_parameters.cxxToolChainId);
const ToolChain *tcC = ToolChainManager::findToolChain(m_parameters.cToolChainId);
const FileName sysroot = m_parameters.sysRoot;
......@@ -339,21 +337,24 @@ QSet<Id> TeaLeafReader::updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder)
includePaths = transform(cbt.includeFiles, &FileName::toString);
}
includePaths += m_parameters.buildDirectory.toString();
ppBuilder.setProjectFile(QString()); // No project file information available!
ppBuilder.setIncludePaths(includePaths);
ppBuilder.setCFlags(cflags);
ppBuilder.setCxxFlags(cxxflags);
ppBuilder.setDefines(cbt.defines);
ppBuilder.setDisplayName(cbt.title);
const QSet<Id> partLanguages
= QSet<Id>::fromList(ppBuilder.createProjectPartsForFiles(
transform(cbt.files, [](const FileName &fn) { return fn.toString(); })));
languages.unite(partLanguages);
}
return languages;
CppTools::RawProjectPart rpp;
rpp.setProjectFile(QString()); // No project file information available!
rpp.setIncludePaths(includePaths);
CppTools::RawProjectPartFlags cProjectFlags;
cProjectFlags.commandLineFlags = cflags;
rpp.setFlagsForC(cProjectFlags);
CppTools::RawProjectPartFlags cxxProjectFlags;
cxxProjectFlags.commandLineFlags = cxxflags;
rpp.setFlagsForCxx(cxxProjectFlags);
rpp.setDefines(cbt.defines);
rpp.setDisplayName(cbt.title);
rpp.setFiles(transform(cbt.files, [](const FileName &fn) { return fn.toString(); }));
rpps.append(rpp);
}
}
void TeaLeafReader::cleanUpProcess()
......
......@@ -58,7 +58,7 @@ public:
CMakeConfig takeParsedConfiguration() final;
void generateProjectTree(CMakeListsNode *root,
const QList<const ProjectExplorer::FileNode *> &allFiles) final;
QSet<Core::Id> updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder) final;
void updateCodeModel(CppTools::RawProjectParts &rpps) final;
private:
void cleanUpProcess();
......
......@@ -133,7 +133,9 @@ void classifyFiles(const QSet<QString> &files, QStringList *headers, QStringList
}
}
void indexFindErrors(QFutureInterface<void> &future, const ParseParams params)
void indexFindErrors(QFutureInterface<void> &indexingFuture,
const QFutureInterface<void> &superFuture,
const ParseParams params)
{
QStringList sources, headers;
classifyFiles(params.sourceFiles, &headers, &sources);
......@@ -146,9 +148,7 @@ void indexFindErrors(QFutureInterface<void> &future, const ParseParams params)
timer.start();
for (int i = 0, end = files.size(); i < end ; ++i) {
if (future.isPaused())
future.waitForResume();
if (future.isCanceled())
if (indexingFuture.isCanceled() || superFuture.isCanceled())
break;
const QString file = files.at(i);
......@@ -170,7 +170,7 @@ void indexFindErrors(QFutureInterface<void> &future, const ParseParams params)
document->releaseSourceAndAST();
future.setProgressValue(files.size() - (files.size() - (i + 1)));
indexingFuture.setProgressValue(files.size() - (files.size() - (i + 1)));
}
const QTime format = QTime(0, 0, 0, 0).addMSecs(timer.elapsed() + 500);
......@@ -178,7 +178,9 @@ void indexFindErrors(QFutureInterface<void> &future, const ParseParams params)
qDebug("FindErrorsIndexing: Finished after %s.", qPrintable(time));
}
void index(QFutureInterface<void> &future, const ParseParams params)
void index(QFutureInterface<void> &indexingFuture,
const QFutureInterface<void> &superFuture,
const ParseParams params)
{
QScopedPointer<CppSourceProcessor> sourceProcessor(CppModelManager::createSourceProcessor());
sourceProcessor->setFileSizeLimitInMb(params.indexerFileSizeLimitInMb);
......@@ -205,10 +207,7 @@ void index(QFutureInterface<void> &future, const ParseParams params)
const CPlusPlus::LanguageFeatures defaultFeatures =
CPlusPlus::LanguageFeatures::defaultFeatures();
for (int i = 0; i < files.size(); ++i) {
if (future.isPaused())
future.waitForResume();
if (future.isCanceled())
if (indexingFuture.isCanceled() || superFuture.isCanceled())
break;
const QString fileName = files.at(i);
......@@ -233,27 +232,29 @@ void index(QFutureInterface<void> &future, const ParseParams params)
sourceProcessor->setHeaderPaths(headerPaths);
sourceProcessor->run(fileName);
future.setProgressValue(files.size() - sourceProcessor->todo().size());
indexingFuture.setProgressValue(files.size() - sourceProcessor->todo().size());
if (isSourceFile)
sourceProcessor->resetEnvironment();
}
}
void parse(QFutureInterface<void> &future, const ParseParams params)
void parse(QFutureInterface<void> &indexingFuture,
const QFutureInterface<void> &superFuture,
const ParseParams params)
{
const QSet<QString> &files = params.sourceFiles;
if (files.isEmpty())
return;
future.setProgressRange(0, files.size());
indexingFuture.setProgressRange(0, files.size());
if (FindErrorsIndexing)
indexFindErrors(future, params);
indexFindErrors(indexingFuture, superFuture, params);
else
index(future, params);
index(indexingFuture, superFuture, params);
future.setProgressValue(files.size());
indexingFuture.setProgressValue(files.size());
CppModelManager::instance()->finishedRefreshingSourceFiles(files);
}
......@@ -345,8 +346,10 @@ BuiltinIndexingSupport::BuiltinIndexingSupport()
BuiltinIndexingSupport::~BuiltinIndexingSupport()
{}
QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(const QSet<QString> &sourceFiles,
CppModelManager::ProgressNotificationMode mode)
QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(
const QFutureInterface<void> &superFuture,
const QSet<QString> &sourceFiles,
CppModelManager::ProgressNotificationMode mode)
{
CppModelManager *mgr = CppModelManager::instance();
......@@ -357,7 +360,7 @@ QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(const QSet<QString> &so
params.workingCopy.insert(mgr->configurationFileName(), mgr->definedMacros());
params.sourceFiles = sourceFiles;
QFuture<void> result = Utils::runAsync(mgr->sharedThreadPool(), parse, params);
QFuture<void> result = Utils::runAsync(mgr->sharedThreadPool(), parse, superFuture, params);
if (m_synchronizer.futures().size() > 10) {
QList<QFuture<void> > futures = m_synchronizer.futures();
......
......@@ -38,10 +38,11 @@ public:
BuiltinIndexingSupport();
~BuiltinIndexingSupport();
virtual QFuture<void> refreshSourceFiles(const QSet<QString> &sourceFiles,
CppModelManager::ProgressNotificationMode mode);
virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters,
QSet<QString> fileNames);
QFuture<void> refreshSourceFiles(const QFutureInterface<void> &superFuture,
const QSet<QString> &sourceFiles,
CppModelManager::ProgressNotificationMode mode) override;
SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters,
QSet<QString> fileNames) override;
public:
static bool isFindErrorsIndexingActive();
......
......@@ -78,8 +78,9 @@ class CPPTOOLS_EXPORT CppIndexingSupport
public:
virtual ~CppIndexingSupport() = 0;
virtual QFuture<void> refreshSourceFiles(const QSet<QString> &sourceFiles,
CppModelManager::ProgressNotificationMode mode) = 0;
virtual QFuture<void> refreshSourceFiles(const QFutureInterface<void> &superFuture,
const QSet<QString> &sourceFiles,
CppModelManager::ProgressNotificationMode mode) = 0;
virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters,
QSet<QString> fileNames) = 0;
};
......
......@@ -630,6 +630,14 @@ static QSet<QString> tooBigFilesRemoved(const QSet<QString> &files, int fileSize
QFuture<void> CppModelManager::updateSourceFiles(const QSet<QString> &sourceFiles,
ProgressNotificationMode mode)
{
const QFutureInterface<void> dummy;
return updateSourceFiles(dummy, sourceFiles, mode);
}
QFuture<void> CppModelManager::updateSourceFiles(const QFutureInterface<void> &superFuture,
const QSet<QString> &sourceFiles,
ProgressNotificationMode mode)
{
if (sourceFiles.isEmpty() || !d->m_indexerEnabled)
return QFuture<void>();
......@@ -637,8 +645,8 @@ QFuture<void> CppModelManager::updateSourceFiles(const QSet<QString> &sourceFile
const QSet<QString> filteredFiles = tooBigFilesRemoved(sourceFiles, indexerFileSizeLimitInMb());
if (d->m_indexingSupporter)
d->m_indexingSupporter->refreshSourceFiles(filteredFiles, mode);
return d->m_internalIndexingSupport->refreshSourceFiles(filteredFiles, mode);