Plugin interface is unnecessarily complex

Bug #943908 reported by Alan Griffiths
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Compiz
Triaged
Low
Unassigned

Bug Description

The code to manage and validate plugin loading - like PluginClassHandler is complex beyond the needs of the problem it solves.

For instance: extern unsigned int pluginClassHandlerIndex; - is only ever referenced by PluginClassHandler (and a test harness) and could therefore be a private static member (with a const accessor to support the test.)

The class PluginClassHandler<class Tp, class Tb, int ABI = 0> is only instantiated on two Tb types - CompScreen and CompWindow and the use of ABI is restricted to one output string (which doesn't seem to justify instantiating separate types).

Also the function - PluginClassHandler<Tp,Tb,ABI>::initializeIndex() - is only ever instantiated for Tb = CompScreen.

---

VTableForScreenAndWindow<> seem to duplicate code that is in VTableForScreen<> - why not VTableForScreenAndWindow<...> : public VTableForScreen<...> as the name suggests?

And the duplication of code between functions like:

template <typename T, typename T2>
bool CompPlugin::VTableForScreenAndWindow<T,T2>::initScreen (CompScreen *s)
{
    T * ps = T::get (s);
    if (!ps)
 return false;

    return true;
}

and

template <typename T, typename T2>
bool CompPlugin::VTableForScreenAndWindow<T,T2>::initWindow (CompWindow *w)
{
    T2 * pw = T2::get (w);
    if (!pw)
 return false;

    return true;
}

Strongly suggests a missing abstraction.

Stephen M. Webb (bregma)
no longer affects: compiz-core
Changed in compiz:
status: New → Triaged
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.