Bug 1419455, part 1 - Inline _semsToChannelParts. r=kanru
authorAndrew McCreight <continuation@gmail.com>
Tue, 21 Nov 2017 08:15:51 -0800
changeset 706175 30f8b4c8462d3422d58f7e036fc285522649670f
parent 706174 036a91aed26426e5ffd060288e9947db031652a0
child 706176 321ffe394a78a39a446632679899e5fd4e091846
push id91730
push usercholler@mozilla.com
push dateFri, 01 Dec 2017 12:27:59 +0000
reviewerskanru
bugs1419455
milestone59.0a1
Bug 1419455, part 1 - Inline _semsToChannelParts. r=kanru This method is now trivial, so we can inline a few things. This removes the only callers of sendSems(), so remove that, too. MozReview-Commit-ID: Bb4EF9M56ut
ipc/ipdl/ipdl/lower.py
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -1108,19 +1108,16 @@ class MessageDecl(ipdl.ast.MessageDecl):
                 _HybridDecl(
                     ipdl.type.ActorType(
                         messageDecl.decl.type.constructedType()),
                     'actor'))
         messageDecl.__class__ = MessageDecl
         return messageDecl
 
 ##--------------------------------------------------
-def _semsToChannelParts(sems):
-    return [ 'mozilla', 'ipc', 'MessageChannel' ]
-
 def _usesShmem(p):
     for md in p.messageDecls:
         for param in md.inParams:
             if ipdl.type.hasshmem(param.type):
                 return True
         for ret in md.outParams:
             if ipdl.type.hasshmem(ret.type):
                 return True
@@ -1136,32 +1133,23 @@ def _subtreeUsesShmem(p):
             if _subtreeUsesShmem(mgd._ast):
                 return True
     return False
 
 class Protocol(ipdl.ast.Protocol):
     def cxxTypedefs(self):
         return self.decl.cxxtypedefs
 
-    def sendSems(self):
-        return self.decl.type.toplevel().sendSemantics
-
-    def channelName(self):
-        return '::'.join(_semsToChannelParts(self.sendSems()))
-
     def channelSel(self):
         if self.decl.type.isToplevel():  return '.'
         return '->'
 
     def channelType(self):
         return Type('Channel', ptr=not self.decl.type.isToplevel())
 
-    def channelHeaderFile(self):
-        return '/'.join(_semsToChannelParts(self.sendSems())) +'.h'
-
     def managerInterfaceType(self, ptr=0):
         return Type('mozilla::ipc::IProtocol', ptr=ptr)
 
     def openedProtocolInterfaceType(self, ptr=0):
         return Type('mozilla::ipc::IToplevelProtocol',
                     ptr=ptr)
 
     def _ipdlmgrtype(self):
@@ -2480,17 +2468,17 @@ class _GenerateProtocolActorCode(ipdl.as
         self.hdrfile = cxxHeaderFile
         self.cppfile = cxxFile
         tu.accept(self)
 
     def standardTypedefs(self):
         return [
             Typedef(Type('mozilla::ipc::IProtocol'), 'ProtocolBase'),
             Typedef(Type('IPC::Message'), 'Message'),
-            Typedef(Type(self.protocol.channelName()), 'Channel'),
+            Typedef(Type('mozilla::ipc::MessageChannel'), 'Channel'),
             Typedef(Type('mozilla::ipc::IProtocol'), 'ChannelListener'),
             Typedef(Type('base::ProcessHandle'), 'ProcessHandle'),
             Typedef(Type('mozilla::ipc::MessageChannel'), 'MessageChannel'),
             Typedef(Type('mozilla::ipc::SharedMemory'), 'SharedMemory'),
         ]
 
 
     def visitTranslationUnit(self, tu):
@@ -2656,17 +2644,17 @@ class _GenerateProtocolActorCode(ipdl.as
         ptype = p.decl.type
         toplevel = p.decl.type.toplevel()
 
         # FIXME: all actors impl Iface for now
         if ptype.isManager() or 1:
             self.hdrfile.addthing(CppDirective('include', '"base/id_map.h"'))
 
         self.hdrfile.addthings([
-            CppDirective('include', '"'+ p.channelHeaderFile() +'"'),
+            CppDirective('include', '"mozilla/ipc/MessageChannel.h"'),
             Whitespace.NL ])
 
         hasAsyncReturns = False
         for md in p.messageDecls:
             if md.hasAsyncReturns():
                 hasAsyncReturns = True
                 break