Bug 792652 - Stop generating code for toplevel-only methods in non-toplevel protocols (r=dvander)
☠☠ backed out by d2098e1d1f2d ☠ ☠
authorBill McCloskey <billm@mozilla.com>
Mon, 31 Oct 2016 15:50:43 -0700
changeset 351770 8edf4b247250cf585bb0e0ec9d533cbf7ad85d4c
parent 351769 63a3c8e4016edb83f9079390cac98fcb3277e731
child 351771 bdf86b8b9c43a5fc7e9b9d481f15d82925f0ae53
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs792652
milestone52.0a1
Bug 792652 - Stop generating code for toplevel-only methods in non-toplevel protocols (r=dvander) Moves OnProcessingError, OnChannelError, OnChannelConnected so that they're only generated for toplevel protocols. For some reason APZCTreeManagerChild implemented OnProcessingError. I'm not sure what the intention was there so I removed it.
gfx/layers/ipc/APZCTreeManagerChild.cpp
gfx/layers/ipc/APZCTreeManagerChild.h
ipc/ipdl/ipdl/lower.py
--- a/gfx/layers/ipc/APZCTreeManagerChild.cpp
+++ b/gfx/layers/ipc/APZCTreeManagerChild.cpp
@@ -257,18 +257,10 @@ APZCTreeManagerChild::RecvNotifyPinchGes
   // of the pinch is. This may change in the future.
   if (mCompositorSession &&
       mCompositorSession->GetWidget()) {
     APZCCallbackHelper::NotifyPinchGesture(aType, aSpanChange, aModifiers, mCompositorSession->GetWidget());
   }
   return true;
 }
 
-void
-APZCTreeManagerChild::OnProcessingError(
-        Result aCode,
-        const char* aReason)
-{
-  MOZ_RELEASE_ASSERT(aCode != MsgDropped);
-}
-
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/ipc/APZCTreeManagerChild.h
+++ b/gfx/layers/ipc/APZCTreeManagerChild.h
@@ -81,21 +81,16 @@ public:
           LayoutDeviceIntPoint* aRefPoint,
           ScrollableLayerGuid* aOutTargetGuid) override;
 
   void
   UpdateWheelTransaction(
           LayoutDeviceIntPoint aRefPoint,
           EventMessage aEventMessage) override;
 
-  void
-  OnProcessingError(
-          Result aCode,
-          const char* aReason) override;
-
 protected:
   bool RecvHandleTap(const TapType& aType,
                      const LayoutDevicePoint& aPoint,
                      const Modifiers& aModifiers,
                      const ScrollableLayerGuid& aGuid,
                      const uint64_t& aInputBlockId) override;
 
   bool RecvNotifyPinchGesture(const PinchGestureType& aType,
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -3236,52 +3236,42 @@ class _GenerateProtocolActorCode(ipdl.as
             Whitespace.NL
         ])
 
         destroysubtreevar = ExprVar('DestroySubtree')
         deallocsubtreevar = ExprVar('DeallocSubtree')
         deallocshmemvar = ExprVar('DeallocShmems')
         deallocselfvar = ExprVar('Dealloc' + _actorName(ptype.name(), self.side))
 
-        # OnProcesingError(code)
-        codevar = ExprVar('aCode')
-        reasonvar = ExprVar('aReason')
-        onprocessingerror = MethodDefn(
-            MethodDecl('OnProcessingError',
-                       params=[ Param(_Result.Type(), codevar.name),
-                                Param(Type('char', const=1, ptr=1), reasonvar.name) ]))
         if ptype.isToplevel():
+            # OnProcesingError(code)
+            codevar = ExprVar('aCode')
+            reasonvar = ExprVar('aReason')
+            onprocessingerror = MethodDefn(
+                MethodDecl('OnProcessingError',
+                           params=[ Param(_Result.Type(), codevar.name),
+                                    Param(Type('char', const=1, ptr=1), reasonvar.name) ]))
             onprocessingerror.addstmt(StmtReturn(
                 ExprCall(p.processingErrorVar(), args=[ codevar, reasonvar ])))
-        else:
-            onprocessingerror.addstmt(
-                _fatalError("`OnProcessingError' called on non-toplevel actor"))
-        self.cls.addstmts([ onprocessingerror, Whitespace.NL ])
+            self.cls.addstmts([ onprocessingerror, Whitespace.NL ])
 
         # int32_t GetProtocolTypeId() { return PFoo; }
         gettypetag = MethodDefn(
             MethodDecl('GetProtocolTypeId', ret=_actorTypeTagType()))
         gettypetag.addstmt(StmtReturn(_protocolId(ptype)))
         self.cls.addstmts([ gettypetag, Whitespace.NL ])
 
-        # OnReplyTimeout()
-        if toplevel.isSync() or toplevel.isInterrupt():
-            ontimeout = MethodDefn(
-                MethodDecl('OnReplyTimeout', ret=Type.BOOL))
-
-            if ptype.isToplevel():
+        if ptype.isToplevel():
+            # OnReplyTimeout()
+            if toplevel.isSync() or toplevel.isInterrupt():
+                ontimeout = MethodDefn(
+                    MethodDecl('OnReplyTimeout', ret=Type.BOOL))
                 ontimeout.addstmt(StmtReturn(
                     ExprCall(p.shouldContinueFromTimeoutVar())))
-            else:
-                ontimeout.addstmts([
-                    _fatalError("`OnReplyTimeout' called on non-toplevel actor"),
-                    StmtReturn.FALSE
-                ])
-
-            self.cls.addstmts([ ontimeout, Whitespace.NL ])
+                self.cls.addstmts([ ontimeout, Whitespace.NL ])
 
         # C++-stack-related methods
         if ptype.isToplevel():
             # OnEnteredCxxStack()
             onentered = MethodDefn(MethodDecl('OnEnteredCxxStack'))
             onentered.addstmt(StmtReturn(ExprCall(p.enteredCxxStackVar())))
 
             # OnExitedCxxStack()
@@ -3301,54 +3291,38 @@ class _GenerateProtocolActorCode(ipdl.as
                 MethodDecl(p.onCxxStackVar().name, ret=Type.BOOL, const=1))
             onstack.addstmt(StmtReturn(ExprCall(
                 ExprSelect(p.channelVar(), '.', p.onCxxStackVar().name))))
 
             self.cls.addstmts([ onentered, onexited,
                                 onenteredcall, onexitedcall,
                                 onstack, Whitespace.NL ])
 
-        # OnChannelClose()
-        onclose = MethodDefn(MethodDecl('OnChannelClose'))
         if ptype.isToplevel():
+            # OnChannelClose()
+            onclose = MethodDefn(MethodDecl('OnChannelClose'))
             onclose.addstmts([
                 StmtExpr(ExprCall(destroysubtreevar,
                                   args=[ _DestroyReason.NormalShutdown ])),
                 StmtExpr(ExprCall(deallocsubtreevar)),
                 StmtExpr(ExprCall(deallocshmemvar)),
                 StmtExpr(ExprCall(deallocselfvar))
             ])
-        else:
-            onclose.addstmt(
-                _fatalError("`OnClose' called on non-toplevel actor"))
-        self.cls.addstmts([ onclose, Whitespace.NL ])
-
-        # OnChannelError()
-        onerror = MethodDefn(MethodDecl('OnChannelError'))
-        if ptype.isToplevel():
+            self.cls.addstmts([ onclose, Whitespace.NL ])
+
+            # OnChannelError()
+            onerror = MethodDefn(MethodDecl('OnChannelError'))
             onerror.addstmts([
                 StmtExpr(ExprCall(destroysubtreevar,
                                   args=[ _DestroyReason.AbnormalShutdown ])),
                 StmtExpr(ExprCall(deallocsubtreevar)),
                 StmtExpr(ExprCall(deallocshmemvar)),
                 StmtExpr(ExprCall(deallocselfvar))
             ])
-        else:
-            onerror.addstmt(
-                _fatalError("`OnError' called on non-toplevel actor"))
-        self.cls.addstmts([ onerror, Whitespace.NL ])
-
-        # OnChannelConnected()
-        onconnected = MethodDefn(MethodDecl('OnChannelConnected',
-                                            params=[ Decl(Type.INT32, 'aPid') ]))
-        if not ptype.isToplevel():
-            onconnected.addstmt(
-                _fatalError("'OnConnected' called on non-toplevel actor"))
-
-        self.cls.addstmts([ onconnected, Whitespace.NL ])
+            self.cls.addstmts([ onerror, Whitespace.NL ])
 
         # User-facing shmem methods
         self.cls.addstmts(self.makeShmemIface())
 
         if (ptype.isToplevel() and ptype.isInterrupt()):
 
             processnative = MethodDefn(
                 MethodDecl('ProcessNativeEventsInInterruptCall', ret=Type.VOID))