Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Unified Diff: ipc/mach_port_mac.cc

Issue 1385143002: ipc: Update MachPortMac ownership semantics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« ipc/mach_port_mac.h ('K') | « ipc/mach_port_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()))) {
« ipc/mach_port_mac.h ('K') | « ipc/mach_port_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698