[Scummvm-cvs-logs] SF.net SVN: scummvm:[55021] scummvm/trunk/base/plugins.cpp

Bluddy at users.sourceforge.net Bluddy at users.sourceforge.net
Thu Dec 23 08:54:54 CET 2010


Revision: 55021
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55021&view=rev
Author:   Bluddy
Date:     2010-12-23 07:54:54 +0000 (Thu, 23 Dec 2010)

Log Message:
-----------
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).

Modified Paths:
--------------
    scummvm/trunk/base/plugins.cpp

Modified: scummvm/trunk/base/plugins.cpp
===================================================================
--- scummvm/trunk/base/plugins.cpp	2010-12-22 23:11:41 UTC (rev 55020)
+++ scummvm/trunk/base/plugins.cpp	2010-12-23 07:54:54 UTC (rev 55021)
@@ -338,16 +338,20 @@
 	                            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);			
 				}
 			}	


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list