Bug 1262937 - part 4 - publically inherit from MessageListener in IProtocol; r=jld

IProtocolManager is templated over some listener type.  In our IPDL
code, that type is always IProtocol, which is a subclass of
MessageListener.  It's also important to note that IProtocol uses
protected inheritance from MessageListener; the generated code takes
advantage of this inheritance structure when it reads actors:

  // ChannelListener is typedef'd to MessageListener
  // Lookup here is IProtocolManager::Lookup
  ChannelListener* listener = Lookup(id);

Lookup returns a pointer to the type over which IProtocolManager is
templated.  As mentioned above, that type is always IProtocol.  But
thanks to the containing class inheriting from *both* IProtocolManager
and IProtocol, the returned pointer can be silently upcasted to
MessageListener thanks to C++ visibility rules.

It's not clear that this restricted inheritance structure is actually
benefitting anybody, or that the inheritance hierarchy of protocol
classes is the best way to do things.  This particular implementation
detail is getting in the way for the next improvement, so let's make the
protected inheritance public instead.
This commit is contained in:
Nathan Froyd 2016-05-21 04:07:56 -04:00
Родитель 2b69fc29e3
Коммит bdd874023f
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -191,7 +191,7 @@ typedef IPCMessageStart ProtocolId;
/**
* All RPC protocols should implement this interface.
*/
class IProtocol : protected MessageListener
class IProtocol : public MessageListener
{
public:
/**