LanguagePlugins and AlwaysOn

Andreas Pakulat apaku at gmx.de
Thu Jun 17 17:56:44 UTC 2010


On 17.06.10 19:10:47, Milian Wolff wrote:
> while working on the multilang support I found out that the "AlwaysOn" 
> attribute doesn#t actually mean AlwaysOn but more "neverUnload". But imagine 
> this:
> 
> open index.html
> => langController->languagesForUrl()
> (foreground)
> => loads XML Language Support
> => parsejob
> => run (background)
> <style type="text/css">
> => langController->languagesForMimeType("text/css")
> => nothing found since loading plugins from the background is explicitly 
> forbidden
> 
> Now what to do? Can't we simply load all language plugins _always_? I.e. also 
> at start?

Don't load it in the background then, load it in the foreground. We
currently have no easy way of doing this, but IMHO it would make sense
to add a KJob subclass that contains a schedule function that basically
does:

QueueJobEvent* m = new QueueJobEvent( this );
QApplication::postEvent(Core::self()->runController(), m);

And RunController than catches the event and simply does:

m->job()->moveToThread( this->thread() );
registerJob( m->job() );

Unless of course you need the language plugin in the background thread,
that would make it a bit more complicated (as in, wait for the
plugin-loaded signal by running a local event loop).

Andreas

-- 
You may worry about your hair-do today, but tomorrow much peanut butter will
be sold.




More information about the KDevelop-devel mailing list