summaryrefslogtreecommitdiff
path: root/src/plugin.cpp
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2010-12-06 21:18:53 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2010-12-06 21:18:53 +0800
commitb81ec866e1b0c20dcd77c442141aed9f4ea14cf3 (patch)
treeccfd9ed291bc4ec98f988b1c4ddb62f425723297 /src/plugin.cpp
parent51e01727d309f39e3f42ecf6b53b4ebb31a385dc (diff)
downloadmobileperf-b81ec866e1b0c20dcd77c442141aed9f4ea14cf3.tar.gz
mobileperf-b81ec866e1b0c20dcd77c442141aed9f4ea14cf3.tar.bz2
Fix startup order.
Previously we were doing something like this: init -> screen init -> init core plugin screen -> create windows -> eventLoop -> updatePlugins -> initPlugin (initScreen (initWindow))). This order has a number of problems with it - namely that config plugins will be loaded on one full pass of the event loop and then core options are initialized, before which we were doing certain startup procedures on the default options, which resulted in strange race condition bugs. Also, if we are compositing we have a brief (visible) switch from 2D mode to 3D mode - in reality we want to be in 3D mode ASAP. The new order is init -> updatePlugins (load plugins specified on command line) -> screen init -> load command line plugins -> update plugins (load new plugins specified by config plugins on the command line) -> init screens -> create window (init plugins for window) -> eventLoop. This means that it takes longer for us to get to the event loop, but at least we can zip through the initialization phase quite quickly
Diffstat (limited to 'src/plugin.cpp')
-rw-r--r--src/plugin.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/plugin.cpp b/src/plugin.cpp
index f9d8954..dd5bc7e8 100644
--- a/src/plugin.cpp
+++ b/src/plugin.cpp
@@ -264,8 +264,8 @@ UnloadPluginProc loaderUnloadPlugin = dlloaderUnloadPlugin;
ListPluginsProc loaderListPlugins = dlloaderListPlugins;
-static bool
-initPlugin (CompPlugin *p)
+bool
+CompManager::initPlugin (CompPlugin *p)
{
if (!p->vTable->init ())
@@ -275,7 +275,7 @@ initPlugin (CompPlugin *p)
return false;
}
- if (screen)
+ if (screen && screen->priv->initialized)
{
if (!p->vTable->initScreen (screen))
{
@@ -294,8 +294,8 @@ initPlugin (CompPlugin *p)
return true;
}
-static void
-finiPlugin (CompPlugin *p)
+void
+CompManager::finiPlugin (CompPlugin *p)
{
if (screen)
@@ -351,18 +351,18 @@ CompScreen::finiPluginForScreen (CompPlugin *p)
bool
CompPlugin::screenInitPlugins (CompScreen *s)
{
- CompPlugin::List::reverse_iterator rit = plugins.rbegin ();
+ CompPlugin::List::iterator it = plugins.begin ();
CompPlugin *p = NULL;
- while (rit != plugins.rend ())
+ while (it != plugins.end ())
{
- p = (*rit);
+ p = (*it);
if (p->vTable->initScreen (s))
s->initPluginForScreen (p);
- rit++;
+ it++;
}
return true;
@@ -491,7 +491,7 @@ CompPlugin::push (CompPlugin *p)
plugins.push_front (p);
- if (!initPlugin (p))
+ if (!CompManager::initPlugin (p))
{
compLogMessage ("core", CompLogLevelError,
"Couldn't activate plugin '%s'", name);
@@ -518,7 +518,7 @@ CompPlugin::pop (void)
pluginsMap.erase (p->vTable->name ().c_str ());
- finiPlugin (p);
+ CompManager::finiPlugin (p);
plugins.pop_front ();