summaryrefslogtreecommitdiff
path: root/src/libs/extensionsystem
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2018-02-21 10:03:38 +0100
committerhjk <hjk@qt.io>2018-02-23 08:57:49 +0000
commit31a55b02477fa0c6b9b9fca7e26ebc6951c3be30 (patch)
treef588d537807b8b54715a834819115aed470b0df4 /src/libs/extensionsystem
parent34fec1cad23e2c6fe8ecf907419b231817e27564 (diff)
downloadqt-creator-31a55b02477fa0c6b9b9fca7e26ebc6951c3be30.tar.gz
ExtensionSystem: Remove per-plugin object pools
Remove now-unused IPlugin::addAutoReleasedObject and IPlugin:: {add,remove}Object convenience functions that were only forwarding to the global pool. Adjust all related tests. All previous users of these convenience functions are gone, and we do not want to encourage the use of object pool anymore. Plugins that wish to share objects to implement weak dependencies can use the global object pool via ExtensionSystem::PluginManager:: {add,remove}Object directly. Change-Id: Ic668ad5504af76963f6d4c69ae160438efc70db5 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/libs/extensionsystem')
-rw-r--r--src/libs/extensionsystem/iplugin.cpp62
-rw-r--r--src/libs/extensionsystem/iplugin.h4
-rw-r--r--src/libs/extensionsystem/iplugin_p.h5
3 files changed, 9 insertions, 62 deletions
diff --git a/src/libs/extensionsystem/iplugin.cpp b/src/libs/extensionsystem/iplugin.cpp
index b22814a9e5..76704be823 100644
--- a/src/libs/extensionsystem/iplugin.cpp
+++ b/src/libs/extensionsystem/iplugin.cpp
@@ -61,21 +61,18 @@
\li All plugin libraries are loaded in \e{root-to-leaf} order of the
dependency tree.
\li All plugins' initialize functions are called in \e{root-to-leaf} order
- of the dependency tree. This is a good place to put
- objects in the plugin manager's object pool.
+ of the dependency tree. This is a good time to create objects
+ needed by other plugins and register them via appropriate core functions
+ or, if a weak dependency is neceessary to be implemented, to put
+ them into the global object pool.
\li All plugins' extensionsInitialized functions are called in \e{leaf-to-root}
order of the dependency tree. At this point, plugins can
be sure that all plugins that depend on this plugin have
- been initialized completely (implying that they have put
- objects in the object pool, if they want that during the
- initialization sequence).
+ been initialized completely and objects these plugins wish to
+ share have been registered or are available in the global object pool.
\endlist
If library loading or initialization of a plugin fails, all plugins
that depend on that plugin also fail.
-
- Plugins have access to the plugin manager
- (and its object pool) via the PluginManager::instance()
- function.
*/
/*!
@@ -102,8 +99,8 @@
In this function, the plugin can assume that plugins that depend on
this plugin are fully 'up and running'. It is a good place to
- look in the plugin manager's object pool for objects that have
- been provided by dependent plugins.
+ look in the global object pool for objects that have been provided
+ by weakly dependent plugins.
\sa initialize()
\sa delayedInitialize()
@@ -191,12 +188,8 @@ IPlugin::IPlugin()
*/
IPlugin::~IPlugin()
{
- foreach (QObject *obj, d->addedObjectsInReverseOrder)
- PluginManager::removeObject(obj);
- qDeleteAll(d->addedObjectsInReverseOrder);
- d->addedObjectsInReverseOrder.clear();
delete d;
- d = 0;
+ d = nullptr;
}
/*!
@@ -222,40 +215,3 @@ PluginSpec *IPlugin::pluginSpec() const
{
return d->pluginSpec;
}
-
-/*!
- \fn void IPlugin::addObject(QObject *obj)
- Convenience function that registers \a obj in the plugin manager's
- plugin pool by just calling PluginManager::addObject().
-*/
-void IPlugin::addObject(QObject *obj)
-{
- PluginManager::addObject(obj);
-}
-
-/*!
- \fn void IPlugin::addAutoReleasedObject(QObject *obj)
- Convenience function for registering \a obj in the plugin manager's
- plugin pool. Usually, registered objects must be removed from
- the object pool and deleted by hand.
- Objects added to the pool via addAutoReleasedObject are automatically
- removed and deleted in reverse order of registration when
- the IPlugin instance is destroyed.
- \sa PluginManager::addObject()
-*/
-void IPlugin::addAutoReleasedObject(QObject *obj)
-{
- d->addedObjectsInReverseOrder.prepend(obj);
- PluginManager::addObject(obj);
-}
-
-/*!
- \fn void IPlugin::removeObject(QObject *obj)
- Convenience function that unregisters \a obj from the plugin manager's
- plugin pool by just calling PluginManager::removeObject().
-*/
-void IPlugin::removeObject(QObject *obj)
-{
- PluginManager::removeObject(obj);
-}
-
diff --git a/src/libs/extensionsystem/iplugin.h b/src/libs/extensionsystem/iplugin.h
index 42b4a564c7..dd1372130e 100644
--- a/src/libs/extensionsystem/iplugin.h
+++ b/src/libs/extensionsystem/iplugin.h
@@ -64,10 +64,6 @@ public:
PluginSpec *pluginSpec() const;
- void addObject(QObject *obj);
- void addAutoReleasedObject(QObject *obj);
- void removeObject(QObject *obj);
-
signals:
void asynchronousShutdownFinished();
diff --git a/src/libs/extensionsystem/iplugin_p.h b/src/libs/extensionsystem/iplugin_p.h
index 0c3824dd39..998539d7f0 100644
--- a/src/libs/extensionsystem/iplugin_p.h
+++ b/src/libs/extensionsystem/iplugin_p.h
@@ -27,11 +27,8 @@
#include "iplugin.h"
-#include <QString>
-
namespace ExtensionSystem {
-class PluginManager;
class PluginSpec;
namespace Internal {
@@ -40,8 +37,6 @@ class IPluginPrivate
{
public:
PluginSpec *pluginSpec;
-
- QList<QObject *> addedObjectsInReverseOrder;
};
} // namespace Internal