Closed Bug 717027 Opened 13 years ago Closed 13 years ago

IPDL compiler doesn't generate code to handle message type SHMEM_CREATED_MESSAGE_TYPE when no other async messages are declared

Categories

(Core :: IPC, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla12

People

(Reporter: ajuma, Assigned: ajuma)

Details

Attachments

(1 file)

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 :/.
Assignee: nobody → ajuma
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.
Attachment #588131 - Flags: review?(jones.chris.g) → review+
Target Milestone: --- → mozilla12
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: