aboutsummaryrefslogtreecommitdiff
path: root/base/plugins.h
diff options
context:
space:
mode:
authorYotam Barnoy2010-11-05 13:24:57 +0000
committerYotam Barnoy2010-11-05 13:24:57 +0000
commita6bee87990d3fd36cbb8e63716990a46fe00402c (patch)
tree5240814d46e4e0f3a59704354e4a643be3dc6108 /base/plugins.h
parent6b88fd44c0fca0b8439f820bceac808562697d0d (diff)
downloadscummvm-rg350-a6bee87990d3fd36cbb8e63716990a46fe00402c.tar.gz
scummvm-rg350-a6bee87990d3fd36cbb8e63716990a46fe00402c.tar.bz2
scummvm-rg350-a6bee87990d3fd36cbb8e63716990a46fe00402c.zip
PLUGINS: improved one-at-a-time plugin code
I reduced memory fragmentation using 2 principles: Plugins should be loaded for as little time as possible, and long lasting memory allocations should be allocated before plugins are loaded. There might still be a little fragmentation left. Note that command line settings that require plugins to be loaded don't work yet, but they didn't work (properly) before either. svn-id: r54097
Diffstat (limited to 'base/plugins.h')
-rw-r--r--base/plugins.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/base/plugins.h b/base/plugins.h
index 5472ab2fce..fc8adbf0d4 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -301,17 +301,14 @@ protected:
class PluginManager : public Common::Singleton<PluginManager> {
typedef Common::Array<PluginProvider *> ProviderList;
private:
- PluginList _plugins[PLUGIN_TYPE_MAX];
+ PluginList _pluginsInMem[PLUGIN_TYPE_MAX];
ProviderList _providers;
- PluginList _allPlugs;
+ PluginList _allEnginePlugins;
PluginList::iterator _currentPlugin;
- bool _skipStaticPlugs;
-
- uint _nonEnginePlugs;
-
bool tryLoadPlugin(Plugin *plugin);
+ void addToPluginsInMemList(Plugin *plugin);
friend class Common::Singleton<SingletonBaseType>;
PluginManager();
@@ -321,14 +318,15 @@ public:
void addPluginProvider(PluginProvider *pp);
+ void loadNonEnginePluginsAndEnumerate();
void loadFirstPlugin();
bool loadNextPlugin();
void loadPlugins();
void unloadPlugins();
- void unloadPluginsExcept(PluginType type, const Plugin *plugin);
+ void unloadPluginsExcept(PluginType type, const Plugin *plugin, bool deletePlugin = true);
- const PluginList &getPlugins(PluginType t) { return _plugins[t]; }
+ const PluginList &getPlugins(PluginType t) { return _pluginsInMem[t]; }
};
#endif