Bug 1259428 - part 2 - remove dodgy static_cast downcasts from logging statements; r=jld
authorNathan Froyd <froydnj.com>
Fri, 25 Mar 2016 17:07:26 -0400
changeset 291445 1349ec62f2411520c6c1120d00f6ea7e957f7ad1
parent 291444 234de0ccd39ba2cf18cf9da6e55a0ccb6033fa58
child 291446 9878927b10f4d472ab919330f6875ead04dcbc58
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjld
bugs1259428
milestone48.0a1
Bug 1259428 - part 2 - remove dodgy static_cast downcasts from logging statements; r=jld Various bits of IPDL code would do something like: Message* m = ...; if (m.type() == particular message type) { static_cast<ParticularMessageType*>(m)->name(); } The static_cast is a remnant of having to do the downcast to access the Log() method on the concrete subclass. Since name() is defined on Message, there's no need for these casts anymore, so let's remove them.
ipc/ipdl/ipdl/lower.py
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -5189,17 +5189,17 @@ class _GenerateProtocolActorCode(ipdl.as
         replyvar = self.replyvar
         return (
             [ StmtExpr(ExprAssn(
                 replyvar, ExprNew(Type(md.pqReplyClass()), args=[ routingId ]))),
               Whitespace.NL ]
             + [ StmtExpr(self.write(r.ipdltype, r.var(), replyvar))
                 for r in md.returns ]
             + self.setMessageFlags(md, replyvar, reply=1)
-            + [ self.logMessage(md, md.replyCast(replyvar), 'Sending reply ') ])
+            + [ self.logMessage(md, replyvar, 'Sending reply ') ])
 
 
     def setMessageFlags(self, md, var, reply):
         stmts = [ ]
 
         if md.decl.type.isSync():
             stmts.append(StmtExpr(ExprCall(
                 ExprSelect(var, '->', 'set_sync'))))
@@ -5224,17 +5224,17 @@ class _GenerateProtocolActorCode(ipdl.as
             # are forwarding the message name (yuck) or making the
             # IPDL|*Channel abstraction leak more
             StmtExpr(ExprCall(
                 ExprSelect(
                     ExprCast(msgvar, Type('Message', ref=1), const=1),
                     '.', 'set_name'),
                 args=[ ExprLiteral.String(md.prettyMsgName(self.protocol.name
                                                            +'::')) ])),
-            self.logMessage(md, md.msgCast(msgexpr), 'Received ',
+            self.logMessage(md, msgexpr, 'Received ',
                             receiving=True),
             self.profilerLabel('Recv', md.decl.progname),
             Whitespace.NL
         ])
 
         if 0 == len(md.params):
             return stmts
 
@@ -5262,17 +5262,17 @@ class _GenerateProtocolActorCode(ipdl.as
                         for p in md.params[start:] ]
             + [ self.endRead(msgvar, itervar) ]))
 
         return stmts
 
 
     def deserializeReply(self, md, replyexpr, side, errfn, actor=None):
         stmts = [ Whitespace.NL,
-                   self.logMessage(md, md.replyCast(replyexpr),
+                   self.logMessage(md, replyexpr,
                                    'Received reply ', actor, receiving=True) ]
         if 0 == len(md.returns):
             return stmts
 
         itervar = self.itervar
         stmts.extend(
             [ Whitespace.NL,
               StmtDecl(Decl(Type.VOIDPTR, itervar.name),