summaryrefslogtreecommitdiff
path: root/src/plugins/qtsupport/qtversionfactory.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2017-12-08 17:20:48 +0100
committerhjk <hjk@qt.io>2017-12-15 07:08:05 +0000
commitcc883023090030eb341a11c4d6634ca027f02c65 (patch)
treef5dd463617c340842e1f74440f0caa3a8ea41d3b /src/plugins/qtsupport/qtversionfactory.cpp
parent32762e27e2f4556cd7ed63f78ed3f28695fddccf (diff)
downloadqt-creator-cc883023090030eb341a11c4d6634ca027f02c65.tar.gz
De-emphasize PluginManager::getObjects<Type>()
... by additionally keeping local (currently non-owning) pools per "interesting" type. Current situation: - The global object pool does not scale well for looking up objects, as iteration plus qobject_cast typically iterates over all pooled objects. - User code that can use typed results from the object pool need to have access to the full type definition anyway, i.e. depend on the plugin of the target class anyway. The patch here solves the scaling problem is to have local type-specific pools to which objects register in their constructors and deregister in their destructors. This patch here does *not* change the ownership model of the pooled objects, however, it opens the possibility to change the ownership model per type (e.g. by not putting things into the global pool at all anymore and make the local pool 'owning') and the intent is to handle that in later patchs. Even without the follow-up patches this here is a performance improvement for the cases that access the local pools instead the global one, i.e. "practically all". Change-Id: Ib11a42df2c4ecf5e1155534730083a520dd1995b Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/qtsupport/qtversionfactory.cpp')
-rw-r--r--src/plugins/qtsupport/qtversionfactory.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/plugins/qtsupport/qtversionfactory.cpp b/src/plugins/qtsupport/qtversionfactory.cpp
index dc23ea981f..ebc8ae36ee 100644
--- a/src/plugins/qtsupport/qtversionfactory.cpp
+++ b/src/plugins/qtsupport/qtversionfactory.cpp
@@ -36,13 +36,22 @@
using namespace QtSupport;
using namespace QtSupport::Internal;
+static QList<QtVersionFactory *> g_qtVersionFactories;
+
QtVersionFactory::QtVersionFactory(QObject *parent) :
QObject(parent)
{
+ g_qtVersionFactories.append(this);
}
QtVersionFactory::~QtVersionFactory()
{
+ g_qtVersionFactories.removeOne(this);
+}
+
+const QList<QtVersionFactory *> QtVersionFactory::allQtVersionFactories()
+{
+ return g_qtVersionFactories;
}
BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileName &qmakePath, bool isAutoDetected, const QString &autoDetectionSource, QString *error)
@@ -62,7 +71,7 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileN
ProFileEvaluator evaluator(&globals, &parser, &vfs, &msgHandler);
evaluator.loadNamedSpec(mkspec.toString(), false);
- QList<QtVersionFactory *> factories = ExtensionSystem::PluginManager::getObjects<QtVersionFactory>();
+ QList<QtVersionFactory *> factories = g_qtVersionFactories;
Utils::sort(factories, [](const QtVersionFactory *l, const QtVersionFactory *r) {
return l->priority() > r->priority();
});