Bug 1384713 - remove unused *MsgStartChild constants; r=billm
authorNathan Froyd <froydnj@mozilla.com>
Thu, 27 Jul 2017 13:32:15 -0400
changeset 422672 f682a94b747439e679ccf3f5d2983b15152cfe93
parent 422671 75b56cf1c910b87c7fc00a07224fef94f0b512d0
child 422673 5b4c249619e5c9d0421bb910eebf62bbac1f4bbf
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1384713
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1384713 - remove unused *MsgStartChild constants; r=billm We only ever use these for passing them into Endpoint construction. Let's remove them. Removing them also shows that the corresponding field in Endpoint is essentially read-only, so we can completely avoid passing in protocol IDs to Endpoint.
ipc/glue/ProtocolUtils.h
ipc/ipdl/ipdl.py
ipc/ipdl/ipdl/lower.py
--- a/ipc/glue/ProtocolUtils.h
+++ b/ipc/glue/ProtocolUtils.h
@@ -592,45 +592,41 @@ public:
     Endpoint()
       : mValid(false)
     {}
 
     Endpoint(const PrivateIPDLInterface&,
              mozilla::ipc::Transport::Mode aMode,
              TransportDescriptor aTransport,
              ProcessId aMyPid,
-             ProcessId aOtherPid,
-             ProtocolId aProtocolId)
+             ProcessId aOtherPid)
       : mValid(true)
       , mMode(aMode)
       , mTransport(aTransport)
       , mMyPid(aMyPid)
       , mOtherPid(aOtherPid)
-      , mProtocolId(aProtocolId)
     {}
 
     Endpoint(Endpoint&& aOther)
       : mValid(aOther.mValid)
       , mMode(aOther.mMode)
       , mTransport(aOther.mTransport)
       , mMyPid(aOther.mMyPid)
       , mOtherPid(aOther.mOtherPid)
-      , mProtocolId(aOther.mProtocolId)
     {
         aOther.mValid = false;
     }
 
     Endpoint& operator=(Endpoint&& aOther)
     {
         mValid = aOther.mValid;
         mMode = aOther.mMode;
         mTransport = aOther.mTransport;
         mMyPid = aOther.mMyPid;
         mOtherPid = aOther.mOtherPid;
-        mProtocolId = aOther.mProtocolId;
 
         aOther.mValid = false;
         return *this;
     }
 
     ~Endpoint() {
         if (mValid) {
             CloseDescriptor(mTransport);
@@ -670,53 +666,50 @@ private:
 
     Endpoint(const Endpoint&) = delete;
     Endpoint& operator=(const Endpoint&) = delete;
 
     bool mValid;
     mozilla::ipc::Transport::Mode mMode;
     TransportDescriptor mTransport;
     ProcessId mMyPid, mOtherPid;
-    ProtocolId mProtocolId;
 };
 
 #if defined(MOZ_CRASHREPORTER) && defined(XP_MACOSX)
 void AnnotateCrashReportWithErrno(const char* tag, int error);
 #else
 static inline void AnnotateCrashReportWithErrno(const char* tag, int error)
 {}
 #endif
 
 // This function is used internally to create a pair of Endpoints. See the
 // comment above Endpoint for a description of how it might be used.
 template<class PFooParent, class PFooChild>
 nsresult
 CreateEndpoints(const PrivateIPDLInterface& aPrivate,
                 base::ProcessId aParentDestPid,
                 base::ProcessId aChildDestPid,
-                ProtocolId aProtocol,
-                ProtocolId aChildProtocol,
                 Endpoint<PFooParent>* aParentEndpoint,
                 Endpoint<PFooChild>* aChildEndpoint)
 {
   MOZ_RELEASE_ASSERT(aParentDestPid);
   MOZ_RELEASE_ASSERT(aChildDestPid);
 
   TransportDescriptor parentTransport, childTransport;
   nsresult rv;
   if (NS_FAILED(rv = CreateTransport(aParentDestPid, &parentTransport, &childTransport))) {
     AnnotateCrashReportWithErrno("IpcCreateEndpointsNsresult", int(rv));
     return rv;
   }
 
   *aParentEndpoint = Endpoint<PFooParent>(aPrivate, mozilla::ipc::Transport::MODE_SERVER,
-                                          parentTransport, aParentDestPid, aChildDestPid, aProtocol);
+                                          parentTransport, aParentDestPid, aChildDestPid);
 
   *aChildEndpoint = Endpoint<PFooChild>(aPrivate, mozilla::ipc::Transport::MODE_CLIENT,
-                                        childTransport, aChildDestPid, aParentDestPid, aChildProtocol);
+                                        childTransport, aChildDestPid, aParentDestPid);
 
   return NS_OK;
 }
 
 void
 TableToArray(const nsTHashtable<nsPtrHashKey<void>>& aTable,
              nsTArray<void*>& aArray);
 
@@ -817,41 +810,38 @@ struct ParamTraits<mozilla::ipc::Endpoin
         // valid after the write. An alternative would be to set
         // aParam.mTransport.mValid to false, but that won't work because aParam
         // is const.
         mozilla::ipc::TransportDescriptor desc = mozilla::ipc::DuplicateDescriptor(aParam.mTransport);
         IPC::WriteParam(aMsg, desc);
 
         IPC::WriteParam(aMsg, aParam.mMyPid);
         IPC::WriteParam(aMsg, aParam.mOtherPid);
-        IPC::WriteParam(aMsg, static_cast<uint32_t>(aParam.mProtocolId));
     }
 
     static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
     {
         MOZ_RELEASE_ASSERT(!aResult->mValid);
 
         if (!IPC::ReadParam(aMsg, aIter, &aResult->mValid)) {
             return false;
         }
         if (!aResult->mValid) {
             // Object is empty, but read succeeded.
             return true;
         }
 
-        uint32_t mode, protocolId;
+        uint32_t mode;
         if (!IPC::ReadParam(aMsg, aIter, &mode) ||
             !IPC::ReadParam(aMsg, aIter, &aResult->mTransport) ||
             !IPC::ReadParam(aMsg, aIter, &aResult->mMyPid) ||
-            !IPC::ReadParam(aMsg, aIter, &aResult->mOtherPid) ||
-            !IPC::ReadParam(aMsg, aIter, &protocolId)) {
+            !IPC::ReadParam(aMsg, aIter, &aResult->mOtherPid)) {
             return false;
         }
         aResult->mMode = Channel::Mode(mode);
-        aResult->mProtocolId = mozilla::ipc::ProtocolId(protocolId);
         return true;
     }
 
     static void Log(const paramType& aParam, std::wstring* aLog)
     {
         aLog->append(StringPrintf(L"Endpoint"));
     }
 };
--- a/ipc/ipdl/ipdl.py
+++ b/ipc/ipdl/ipdl.py
@@ -203,17 +203,16 @@ print >>ipcmsgstart, """
 #ifndef IPCMessageStart_h
 #define IPCMessageStart_h
 
 enum IPCMessageStart {
 """
 
 for name in allprotocols:
     print >>ipcmsgstart, "  %s," % name
-    print >>ipcmsgstart, "  %sChild," % name
 
 print >>ipcmsgstart, """
   LastMsgIndex
 };
 
 static_assert(LastMsgIndex <= 65536, "need to update IPC_MESSAGE_MACRO");
 
 #endif // ifndef IPCMessageStart_h
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -1630,18 +1630,16 @@ class _GenerateProtocolCode(ipdl.ast.Vis
                      Decl(Type('base::ProcessId'), childpidvar.name),
                      Decl(Type('mozilla::ipc::Endpoint<' + tparent.name + '>', ptr=1), parentvar.name),
                      Decl(Type('mozilla::ipc::Endpoint<' + tchild.name + '>', ptr=1), childvar.name) ],
             ret=rettype))
         openfunc.addstmt(StmtReturn(ExprCall(
             ExprVar('mozilla::ipc::CreateEndpoints'),
             args=[ _backstagePass(),
                    parentpidvar, childpidvar,
-                   _protocolId(p),
-                   ExprVar(_messageStartName(p) + 'Child'),
                    parentvar, childvar
                    ])))
         return openfunc
 
 
     def genTransitionFunc(self):
         ptype = self.protocol.decl.type