Let's start with a real life issue: - Start a chat in Empathy - Using the Shell, click on the message tray bubble - HandleChannels() is re-called on Empathy, asking it to present the channel All good. But when doing so, TpBaseClient's HandleChannels() implementation creates a NEW TpChannel subclass (which is actually a EmpathyTpChat as Empathy provides its own factory) doing a bunch of preparation and so involving useless D-Bus traffic. Re-using the existing TpChannel would avoid this extra useless work. We could do the caching in TpClientChannelFactoryInterface so the each implementation wouldn't have to re-implement it. I guess it would probably be best to add a _ensure_channel() method rather than modifying _create_channel() to make things clearer.
I would make TpChannel instances unique per factory instances. So one could still create its own factory that create other subclasses for the same channel.
Now for the how to implement this, I'm not sure it's nice to do code in interfaces. Maybe we need a TpBaseProxyFactory and make TpAutomaticProxyFactory and TpBasicProxyFactory subclasses of it?
(In reply to comment #2) > Maybe we need a TpBaseProxyFactory and make TpAutomaticProxyFactory > and TpBasicProxyFactory subclasses of it? We can't without breaking ABI, I think. We could just add a _ensure_channel() (falling back to _create_channel() in the iface if not implemented) and let factories implementing it.
Closing as dup of bug #38142 since it replaces TpClientChannelFactory completely *** This bug has been marked as a duplicate of bug 38142 ***
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.