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

Unified Diff: ipc/ipc_message_utils.cc

Issue 1422873002: Reland 1: "mac: Add auto-close and share-read-only functionality to SharedMemory." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix error. 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
« no previous file with comments | « ipc/attachment_broker_privileged_mac_unittest.cc ('k') | ipc/test_util_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_message_utils.cc
diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc
index 278d7beffe3b509cb802841356da0ddc736b93e1..0180d743a26a3d90010c758f3c2debb567c6a82f 100644
--- a/ipc/ipc_message_utils.cc
+++ b/ipc/ipc_message_utils.cc
@@ -563,6 +563,12 @@ void ParamTraits<base::SharedMemoryHandle>::Write(Message* m,
bool result = p.GetSize(&size);
DCHECK(result);
ParamTraits<size_t>::Write(m, size);
+
+ // If the caller intended to pass ownership to the IPC stack, release a
+ // reference.
+ if (p.OwnershipPassesToIPC())
+ p.Close();
+
break;
}
}
« no previous file with comments | « ipc/attachment_broker_privileged_mac_unittest.cc ('k') | ipc/test_util_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698