From cf8cae595c1e7d93156d391225847bbf6e79f39c Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Tue, 6 May 2014 17:56:30 +0200 Subject: [PATCH] PluginManager::getObject(): Remove special support for aggregates Since no one is using it and it's faster this way. Change-Id: Ib60d3a54aed98011b2fb4bb7d159e219abebfa7e Reviewed-by: Eike Ziller --- src/libs/extensionsystem/pluginmanager.cpp | 12 +++--------- src/libs/extensionsystem/pluginmanager.h | 12 +++++------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index 8e800cd1d6c..338d1578eaa 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -108,9 +108,7 @@ enum { debugLeaks = 0 }; Plugins (and everybody else) can add objects to a common 'pool' that is located in the plugin manager. Objects in the pool must derive from QObject, there are no other prerequisites. All objects of a specified type can be retrieved from the object pool - via the getObjects() and getObject() functions. They are aware of Aggregation::Aggregate, i.e. - these functions use the Aggregation::query functions instead of a qobject_cast to determine - the matching objects. + via the getObjects() and getObject() functions. Whenever the state of the object pool changes a corresponding signal is emitted by the plugin manager. @@ -220,9 +218,7 @@ enum { debugLeaks = 0 }; Retrieves the object of a given type from the object pool. - This function is aware of Aggregation::Aggregate. That is, it uses - the \c Aggregation::query functions instead of \c qobject_cast to - determine the type of an object. + This function uses \c qobject_cast to determine the type of an object. If there are more than one object of the given type in the object pool, this function will choose an arbitrary one of them. @@ -234,9 +230,7 @@ enum { debugLeaks = 0 }; Retrieves all objects of a given type from the object pool. - This function is aware of Aggregation::Aggregate. That is, it uses - the \c Aggregation::query functions instead of \c qobject_cast to - determine the type of an object. + This function uses \c qobject_cast to determine the type of an object. \sa addObject() */ diff --git a/src/libs/extensionsystem/pluginmanager.h b/src/libs/extensionsystem/pluginmanager.h index f40722e087d..312fc50b719 100644 --- a/src/libs/extensionsystem/pluginmanager.h +++ b/src/libs/extensionsystem/pluginmanager.h @@ -68,10 +68,9 @@ public: QReadLocker lock(listLock()); QList results; QList all = allObjects(); - QList result; foreach (QObject *obj, all) { - result = Aggregation::query_all(obj); - if (!result.isEmpty()) + T *result = qobject_cast(obj); + if (result) results += result; } return results; @@ -80,12 +79,11 @@ public: { QReadLocker lock(listLock()); QList all = allObjects(); - T *result = 0; foreach (QObject *obj, all) { - if ((result = Aggregation::query(obj)) != 0) - break; + if (T *result = qobject_cast(obj)) + return result; } - return result; + return 0; } static QObject *getObjectByName(const QString &name);