From bfc72d696de9b36136dcbed8c23353916232f4f5 Mon Sep 17 00:00:00 2001 From: Andi-Bogdan Postelnicu Date: Thu, 17 Nov 2016 15:07:35 +0200 Subject: [PATCH] Bug 1318335 - Use auto type specifier where aplicable for variable declarations to improve code readability and maintainability in ipc/. r=billm MozReview-Commit-ID: K4NAI8HjUd2 --HG-- extra : rebase_source : 9abcb40b9b3ffea07519cc03e892e15b907e6e25 --- ipc/glue/GeckoChildProcessHost.cpp | 8 ++++---- ipc/glue/SharedMemoryBasic_mach.mm | 18 +++++++++--------- ipc/testshell/XPCShellEnvironment.cpp | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp index ab791b37d987..0dbd64081697 100644 --- a/ipc/glue/GeckoChildProcessHost.cpp +++ b/ipc/glue/GeckoChildProcessHost.cpp @@ -968,12 +968,12 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector& aExt if (child_message.GetTranslatedPort(2) == MACH_PORT_NULL) { CHROMIUM_LOG(ERROR) << "parent GetTranslatedPort(2) failed."; } - MachPortSender* parent_recv_port_memory_ack = new MachPortSender(child_message.GetTranslatedPort(2)); + auto* parent_recv_port_memory_ack = new MachPortSender(child_message.GetTranslatedPort(2)); if (child_message.GetTranslatedPort(3) == MACH_PORT_NULL) { CHROMIUM_LOG(ERROR) << "parent GetTranslatedPort(3) failed."; } - MachPortSender* parent_send_port_memory = new MachPortSender(child_message.GetTranslatedPort(3)); + auto* parent_send_port_memory = new MachPortSender(child_message.GetTranslatedPort(3)); MachSendMessage parent_message(/* id= */0); if (!parent_message.AddDescriptor(MachMsgPortDescriptor(bootstrap_port))) { @@ -981,13 +981,13 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector& aExt return false; } - ReceivePort* parent_recv_port_memory = new ReceivePort(); + auto* parent_recv_port_memory = new ReceivePort(); if (!parent_message.AddDescriptor(MachMsgPortDescriptor(parent_recv_port_memory->GetPort()))) { CHROMIUM_LOG(ERROR) << "parent AddDescriptor(" << parent_recv_port_memory->GetPort() << ") failed."; return false; } - ReceivePort* parent_send_port_memory_ack = new ReceivePort(); + auto* parent_send_port_memory_ack = new ReceivePort(); if (!parent_message.AddDescriptor(MachMsgPortDescriptor(parent_send_port_memory_ack->GetPort()))) { CHROMIUM_LOG(ERROR) << "parent AddDescriptor(" << parent_send_port_memory_ack->GetPort() << ") failed."; return false; diff --git a/ipc/glue/SharedMemoryBasic_mach.mm b/ipc/glue/SharedMemoryBasic_mach.mm index 72649892afbe..6f7de61f5e7f 100644 --- a/ipc/glue/SharedMemoryBasic_mach.mm +++ b/ipc/glue/SharedMemoryBasic_mach.mm @@ -150,7 +150,7 @@ SetupMachMemory(pid_t pid, if (pidIsParent) { gParentPid = pid; } - MemoryPorts* listen_ports = new MemoryPorts(listen_port_ack, listen_port); + auto* listen_ports = new MemoryPorts(listen_port_ack, listen_port); pthread_t thread; pthread_attr_t attr; pthread_attr_init(&attr); @@ -249,8 +249,8 @@ GetMemoryPortsForPid(pid_t pid) // Create two receiving ports in this process to send to the parent. One will be used for // for listening for incoming memory to be shared, the other for getting the Handle of // memory we share to the other process. - ReceivePort* ports_in_receiver = new ReceivePort(); - ReceivePort* ports_out_receiver = new ReceivePort(); + auto* ports_in_receiver = new ReceivePort(); + auto* ports_out_receiver = new ReceivePort(); mach_port_t raw_ports_in_sender, raw_ports_out_sender; if (!RequestPorts(parent, ports_in_receiver->GetPort(), @@ -263,8 +263,8 @@ GetMemoryPortsForPid(pid_t pid) } // Our parent process sent us two ports, one is for sending new memory to, the other // is for replying with the Handle when we receive new memory. - MachPortSender* ports_in_sender = new MachPortSender(raw_ports_in_sender); - MachPortSender* ports_out_sender = new MachPortSender(raw_ports_out_sender); + auto* ports_in_sender = new MachPortSender(raw_ports_in_sender); + auto* ports_out_sender = new MachPortSender(raw_ports_out_sender); SetupMachMemory(pid, ports_in_receiver, ports_in_sender, @@ -372,11 +372,11 @@ HandleGetPortsMessage(MachReceiveMessage* rmsg, MemoryPorts* ports) return; } - MachPortSender* ports_in_sender = new MachPortSender(rmsg->GetTranslatedPort(0)); - MachPortSender* ports_out_sender = new MachPortSender(rmsg->GetTranslatedPort(1)); + auto* ports_in_sender = new MachPortSender(rmsg->GetTranslatedPort(0)); + auto* ports_out_sender = new MachPortSender(rmsg->GetTranslatedPort(1)); - ReceivePort* ports_in_receiver = new ReceivePort(); - ReceivePort* ports_out_receiver = new ReceivePort(); + auto* ports_in_receiver = new ReceivePort(); + auto* ports_out_receiver = new ReceivePort(); if (SendReturnPortsMsg(ports->mSender, ports_in_receiver->GetPort(), ports_out_receiver->GetPort())) { SetupMachMemory(pid_pair->mRequester, ports_out_receiver, diff --git a/ipc/testshell/XPCShellEnvironment.cpp b/ipc/testshell/XPCShellEnvironment.cpp index a6979ccae588..bf8d72e05743 100644 --- a/ipc/testshell/XPCShellEnvironment.cpp +++ b/ipc/testshell/XPCShellEnvironment.cpp @@ -378,7 +378,7 @@ XPCShellEnvironment::ProcessFile(JSContext *cx, XPCShellEnvironment* XPCShellEnvironment::CreateEnvironment() { - XPCShellEnvironment* env = new XPCShellEnvironment(); + auto* env = new XPCShellEnvironment(); if (env && !env->Init()) { delete env; env = nullptr;