PLUGINS: don't fully load each plugins at startup for single plugin method
The reason to load each plugin was to figure out if it's a sound or engine plugin. Since all our plugin files are currently engines, there's no reason to load every file. If we get dynamic sound plugins, it'd be a good idea to make a quick and easy way to know which kind of plugin it is (e.g. a prefix or suffix in the filename). svn-id: r55021
This commit is contained in:
parent
8cc28b218c
commit
81dd62f3cb
1 changed files with 10 additions and 6 deletions
|
@ -338,16 +338,20 @@ void PluginManager::loadNonEnginePluginsAndEnumerate() {
|
|||
pp != _providers.end();
|
||||
++pp) {
|
||||
PluginList pl((*pp)->getPlugins());
|
||||
|
||||
for (PluginList::iterator p = pl.begin(); p != pl.end(); ++p) {
|
||||
// To find out which are engine plugins, we have to load them. This is inefficient
|
||||
// Hopefully another way can be found (e.g. if the music plugins are all static,
|
||||
// we can use only the static provider
|
||||
if ((*p)->loadPlugin()) {
|
||||
// This is a 'hack' based on the assumption that we have no sound
|
||||
// file plugins. Currently this is the case. If it changes, we
|
||||
// should find a fast way of detecting whether a plugin is a
|
||||
// music or an engine plugin.
|
||||
if ((*pp)->isFilePluginProvider()) {
|
||||
_allEnginePlugins.push_back(*p);
|
||||
} else if ((*p)->loadPlugin()) { // and this is the proper method
|
||||
if ((*p)->getType() == PLUGIN_TYPE_ENGINE) {
|
||||
(*p)->unloadPlugin(); // to prevent fragmentation
|
||||
(*p)->unloadPlugin();
|
||||
_allEnginePlugins.push_back(*p);
|
||||
} else { // add non-engine plugins to the 'in-memory' list
|
||||
// these won't ever get unloaded (in this implementation)
|
||||
// these won't ever get unloaded
|
||||
addToPluginsInMemList(*p);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue