summaryrefslogtreecommitdiffstats
path: root/ipc/test_util_mac.h
diff options
context:
space:
mode:
authorerikchen <erikchen@chromium.org>2015-10-23 14:05:26 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-23 21:07:10 +0000
commit033bbbcb63cab781552dfb435c035131c423de30 (patch)
tree35df53ec759aebbbdaefe55d112227af3f820edb /ipc/test_util_mac.h
parent86ef231cbe4c52bede41d583519898a9a345c987 (diff)
downloadchromium_src-033bbbcb63cab781552dfb435c035131c423de30.zip
chromium_src-033bbbcb63cab781552dfb435c035131c423de30.tar.gz
chromium_src-033bbbcb63cab781552dfb435c035131c423de30.tar.bz2
mac: Add auto-close and share-read-only functionality to Mach based SharedMemory.
base::FileDescriptor has a property |auto_close| that is used to indicate that when the object is passed to an IPC message, the message takes ownership of the underlying OS handle. Since SharedMemoryHandle needs to be interchangeable with base::FileDescriptor, I added a property with similar functionality named |ownership_passes_to_ipc_|. The method ShareToProcess() is used to lower the current and maximum protection of the underlying OS handle before it is transferred to a different process. I implemented this functionality for Mach memory objects. BUG=535711 Review URL: https://codereview.chromium.org/1418113003 Cr-Commit-Position: refs/heads/master@{#355880}
Diffstat (limited to 'ipc/test_util_mac.h')
-rw-r--r--ipc/test_util_mac.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/ipc/test_util_mac.h b/ipc/test_util_mac.h
index e976ce0..6ed4d19 100644
--- a/ipc/test_util_mac.h
+++ b/ipc/test_util_mac.h
@@ -50,6 +50,11 @@ mach_port_urefs_t GetMachRefCount(mach_port_name_t name,
// Increments the ref count for the right/name pair.
void IncrementMachRefCount(mach_port_name_t name, mach_port_right_t right);
+// Gets the current and maximum protection levels of the memory region.
+// Returns whether the operation was successful.
+// |current| and |max| are output variables only populated on success.
+bool GetMachProtections(void* address, size_t size, int* current, int* max);
+
} // namespace IPC
#endif // IPC_TEST_UTIL_MAC_H_