Bug 37971

Summary: TpClientChannelFactory should cache and re-use existing TpChannel
Product: Telepathy Reporter: Guillaume Desmottes <guillaume.desmottes>
Component: tp-glibAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED DUPLICATE QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: enhancement    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on: 38142    
Bug Blocks:    

Description Guillaume Desmottes 2011-06-06 01:32:38 UTC
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.
Comment 1 Xavier Claessens 2011-06-06 01:40:35 UTC
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.
Comment 2 Xavier Claessens 2011-06-06 01:48:46 UTC
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?
Comment 3 Guillaume Desmottes 2011-06-09 04:19:07 UTC
(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.
Comment 4 Xavier Claessens 2011-07-26 05:46:55 UTC
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.