When the declaration of a manager protocol doesn't include any async messages received by the parent, the ipdl compiler does not generate code to handle messages of type SHMEM_CREATED_MESSAGE_TYPE in Parent::OnMessageReceived(Message&). A workaround is simply adding an (unused) async message to the protocol declaration.
That is ... most odd. I don't have a guess for what's up. Probably an easy fix.
The problem is related to lines 2885-2890 of ipc/ipdl/ipdl/lower.py: if switch.nr_cases > 1: method.addstmt(switch) else: method.addstmt(StmtReturn(_Result.NotKnown)) When a protocol has no async messages declared, at the point at which this snippet gets executed (during the generation of Parent.cpp::OnMessageReceived(Message&)) the only case added to |switch| (which is self.asyncSwitch here) is the default case, so |switch| doesn't get added to the method. Then, lines 3530-3536 (which add the SHMEM_CREATED/DESTROYED handlers to self.asyncSwitch) have no effect on the generated method. Indeed, changing line 2885 to: if switch.nr_cases > 0: fixes the problem (but breaks bug 509581).
An example of a protocol where we have to work around this bug is PCompositor.ipdl in Attachment 587713 [details] [diff], Bug 711168.
OK, that makes sense. The control flow is way too hard to follow in there. The simplest fix looks like moving # FIXME/bug 535053: only manager protocols and non-manager # protocols with union types need Lookup(). we'll give it to # all for the time being (simpler) if 1 or ptype.isManager(): self.cls.addstmts(self.implementManagerIface()) before def makeHandlerMethod(name, switch, hasReply, dispatches=0): params = [ Decl(Type('Message', const=1, ref=1), msgvar.name) ] The "right" fix is to rewrite this code again :/.
Created attachment 588131 [details] [diff] [review] Make IPDL compiler generate code to handle SHMEM-related messages even when there are no other async messages This implements the fix from Comment 4.
Comment on attachment 588131 [details] [diff] [review] Make IPDL compiler generate code to handle SHMEM-related messages even when there are no other async messages It would extremely gross to write a test for this, and not all that incredibly useful IMHO, so r=me without that.