default: return "<unknown IPC msg name>"; } } } // namespace IPC namespace mozilla { namespace ipc { const char* ProtocolIdToName(IPCMessageStart aId) { switch (aId) { """, file=ipc_msgtype_name) for name in allprotocols: print(" case %sMsgStart:" % name, file=ipc_msgtype_name) print(" return \"%s\";" % name, file=ipc_msgtype_name) print(""" default: return "<unknown protocol id>"; } } } // namespace ipc } // namespace mozilla """, file=ipc_msgtype_name) ipdl.writeifmodified(ipcmsgstart.getvalue(), ipcmessagestartpath) ipdl.writeifmodified(ipc_msgtype_name.getvalue(), ipc_msgtype_name_path)
for protocol in sorted(allmessages.keys()): for (msg, num) in allmessages[protocol].idnums: if num or msg.endswith('End'): continue print >>ipc_msgtype_name, """ case %s__%s: return "%s::%s";""" % (protocol, msg, protocol, msg) print >>ipc_msgtype_name, """ case CHANNEL_OPENED_MESSAGE_TYPE: return "CHANNEL_OPENED_MESSAGE"; case SHMEM_DESTROYED_MESSAGE_TYPE: return "SHMEM_DESTROYED_MESSAGE"; case SHMEM_CREATED_MESSAGE_TYPE: return "SHMEM_CREATED_MESSAGE"; case GOODBYE_MESSAGE_TYPE: return "GOODBYE_MESSAGE"; case CANCEL_MESSAGE_TYPE: return "CANCEL_MESSAGE"; default: return "<unknown IPC msg name>"; } } } // namespace ipc } // namespace mozilla """ ipdl.writeifmodified(ipcmsgstart.getvalue(), ipcmessagestartpath) ipdl.writeifmodified(ipc_msgtype_name.getvalue(), ipc_msgtype_name_path)
if ast.protocol: allprotocols.append('%sMsgStart' % ast.protocol.name) allprotocols.sort() ipcmsgstart = StringIO() print >> ipcmsgstart, """ // CODE GENERATED by ipdl.py. Do not edit. #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 """ ipdl.writeifmodified(ipcmsgstart.getvalue(), ipcmessagestartpath)
allprotocols.append('%sMsgStart' % ast.protocol.name) allprotocols.sort() ipcmsgstart = StringIO() print >> ipcmsgstart, """ // CODE GENERATED by ipdl.py. Do not edit. #ifndef IPCMessageStart_h #define IPCMessageStart_h enum IPCMessageStart { """ for name in allprotocols: print >> ipcmsgstart, " %s," % name print >> ipcmsgstart, """ LastMsgIndex }; COMPILE_ASSERT(LastMsgIndex <= 65536, need_to_update_IPC_MESSAGE_MACRO); #endif // ifndef IPCMessageStart_h """ ipdl.writeifmodified(ipcmsgstart.getvalue(), os.path.join(headersdir, 'IPCMessageStart.h'))
allprotocols.append('%sMsgStart' % ast.protocol.name) allprotocols.sort() ipcmsgstart = StringIO() print >>ipcmsgstart, """ // CODE GENERATED by ipdl.py. Do not edit. #ifndef IPCMessageStart_h #define IPCMessageStart_h enum IPCMessageStart { """ for name in allprotocols: print >>ipcmsgstart, " %s," % name print >>ipcmsgstart, """ LastMsgIndex }; COMPILE_ASSERT(LastMsgIndex <= 65536, need_to_update_IPC_MESSAGE_MACRO); #endif // ifndef IPCMessageStart_h """ ipdl.writeifmodified(ipcmsgstart.getvalue(), os.path.join(headersdir, 'IPCMessageStart.h'))
allprotocols.append('%sMsgStart' % ast.protocol.name) allprotocols.sort() ipcmsgstart = StringIO() print >>ipcmsgstart, """ // CODE GENERATED by ipdl.py. Do not edit. #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 """ ipdl.writeifmodified(ipcmsgstart.getvalue(), ipcmessagestartpath)