aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2022-08-26 08:40:23 +0200
committerEike Ziller <eike.ziller@qt.io>2022-08-26 08:40:23 +0200
commitc6c92ec0961f17e6749f8a9f5a1a71ab56b71906 (patch)
tree71b8f039d3a5a4388a68dfe43a6fb831e723e967 /src/libs
parentc10f23a5c6c7d54e5a9af2c3b729e5a752dc51b6 (diff)
parent70343084badaca0ae8a05f2e4c150a893e929275 (diff)
Merge remote-tracking branch 'origin/8.0'
Conflicts: src/libs/qmljs/qmljsmodelmanagerinterface.cpp src/plugins/clangcodemodel/clangdclient.cpp src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp src/plugins/qmldesigner/designercore/include/modelnode.h src/plugins/qmldesigner/designercore/model/modelnode.cpp src/plugins/qmldesigner/designercore/model/rewriterview.cpp Change-Id: I93c57879b79f27325321bfc045ca618bd835af93
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.cpp15
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.h3
-rw-r--r--src/libs/qmljs/qmljsplugindumper.cpp5
3 files changed, 18 insertions, 5 deletions
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
index 2d879ecb0af..40d43f202a8 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
@@ -111,6 +111,7 @@ ModelManagerInterface::ModelManagerInterface(QObject *parent)
m_defaultImportPaths(environmentImportPaths()),
m_pluginDumper(new PluginDumper(this))
{
+ m_threadPool.setMaxThreadCount(4);
m_futureSynchronizer.setCancelOnWait(false);
m_indexerDisabled = qEnvironmentVariableIsSet("QTC_NO_CODE_INDEXER");
@@ -325,6 +326,11 @@ Snapshot ModelManagerInterface::newestSnapshot() const
return m_newestSnapshot;
}
+QThreadPool *ModelManagerInterface::threadPool()
+{
+ return &m_threadPool;
+}
+
void ModelManagerInterface::updateSourceFiles(const QList<Utils::FilePath> &files,
bool emitDocumentOnDiskChanged)
{
@@ -339,7 +345,8 @@ QFuture<void> ModelManagerInterface::refreshSourceFiles(const QList<Utils::FileP
if (sourceFiles.isEmpty())
return QFuture<void>();
- QFuture<void> result = Utils::runAsync(&ModelManagerInterface::parse,
+ QFuture<void> result = Utils::runAsync(&m_threadPool,
+ &ModelManagerInterface::parse,
workingCopyInternal(), sourceFiles,
this, Dialect(Dialect::Qml),
emitDocumentOnDiskChanged);
@@ -366,7 +373,8 @@ QFuture<void> ModelManagerInterface::refreshSourceFiles(const QList<Utils::FileP
void ModelManagerInterface::fileChangedOnDisk(const Utils::FilePath &path)
{
- addFuture(Utils::runAsync(&ModelManagerInterface::parse,
+ addFuture(Utils::runAsync(&m_threadPool,
+ &ModelManagerInterface::parse,
workingCopyInternal(),
FilePaths({path}),
this,
@@ -1199,7 +1207,8 @@ void ModelManagerInterface::maybeScan(const PathsAndLanguages &importPaths)
}
if (pathToScan.length() >= 1) {
- QFuture<void> result = Utils::runAsync(&ModelManagerInterface::importScan,
+ QFuture<void> result = Utils::runAsync(&m_threadPool,
+ &ModelManagerInterface::importScan,
workingCopyInternal(), pathToScan,
this, true, true, false);
addFuture(result);
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h
index 2a17bd66e31..1899112d907 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.h
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h
@@ -41,6 +41,7 @@
#include <QObject>
#include <QPointer>
#include <QStringList>
+#include <QThreadPool>
QT_FORWARD_DECLARE_CLASS(QTimer)
@@ -133,6 +134,7 @@ public:
QmlJS::Snapshot snapshot() const;
QmlJS::Snapshot newestSnapshot() const;
+ QThreadPool *threadPool();
void activateScan();
void updateSourceFiles(const QList<Utils::FilePath> &files, bool emitDocumentOnDiskChanged);
@@ -292,6 +294,7 @@ private:
Utils::FutureSynchronizer m_futureSynchronizer;
bool m_indexerDisabled = false;
+ QThreadPool m_threadPool;
};
} // namespace QmlJS
diff --git a/src/libs/qmljs/qmljsplugindumper.cpp b/src/libs/qmljs/qmljsplugindumper.cpp
index ae5e9c3d7a5..383868621ad 100644
--- a/src/libs/qmljs/qmljsplugindumper.cpp
+++ b/src/libs/qmljs/qmljsplugindumper.cpp
@@ -296,7 +296,8 @@ void PluginDumper::qmlPluginTypeDumpDone(QtcProcess *process)
QStringList dependencies;
};
- auto future = Utils::runAsync([output, libraryPath](QFutureInterface<CppQmlTypesInfo>& future)
+ auto future = Utils::runAsync(m_modelManager->threadPool(),
+ [output, libraryPath](QFutureInterface<CppQmlTypesInfo>& future)
{
CppQmlTypesInfo infos;
CppQmlTypesLoader::parseQmlTypeDescriptions(output, &infos.objectsList, &infos.moduleApis, &infos.dependencies,
@@ -349,7 +350,7 @@ void PluginDumper::pluginChanged(const QString &pluginLibrary)
QFuture<PluginDumper::QmlTypeDescription> PluginDumper::loadQmlTypeDescription(const FilePaths &paths) const
{
- auto future = Utils::runAsync([=](QFutureInterface<PluginDumper::QmlTypeDescription> &future)
+ auto future = Utils::runAsync(m_modelManager->threadPool(), [=](QFutureInterface<PluginDumper::QmlTypeDescription> &future)
{
PluginDumper::QmlTypeDescription result;