Index: ipc/mach_port_mac.cc |
diff --git a/ipc/mach_port_mac.cc b/ipc/mach_port_mac.cc |
index 96f4acaeb214a42ee982305674de6f01c9115a82..64f7956b75a746ac0b13b3a6b937531b8c92306a 100644 |
--- a/ipc/mach_port_mac.cc |
+++ b/ipc/mach_port_mac.cc |
@@ -5,13 +5,23 @@ |
#include "ipc/mach_port_mac.h" |
#include "base/logging.h" |
+#include "base/mac/mach_logging.h" |
#include "base/memory/ref_counted.h" |
#include "base/strings/string_number_conversions.h" |
#include "ipc/mach_port_attachment_mac.h" |
namespace IPC { |
-// static |
+MachPortMac::MachPortMac(const mach_port_t& mach_port) : mach_port_(mach_port) { |
+ if (mach_port != MACH_PORT_NULL) { |
+ kern_return_t kr = mach_port_mod_refs(mach_task_self(), mach_port, |
+ MACH_PORT_RIGHT_SEND, 1); |
+ MACH_LOG_IF(ERROR, kr != KERN_SUCCESS, kr) |
+ << "MachPortMac mach_port_mod_refs"; |
+ } |
+} |
+ |
+ // static |
void ParamTraits<MachPortMac>::Write(Message* m, const param_type& p) { |
if (!m->WriteAttachment( |
new IPC::internal::MachPortAttachmentMac(p.get_mach_port()))) { |