OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BASE_MAC_MACH_PORT_UTIL_H_ | |
6 #define BASE_MAC_MACH_PORT_UTIL_H_ | |
7 | |
8 #include <mach/mach.h> | |
9 | |
10 #include "base/base_export.h" | |
11 #include "base/mac/scoped_mach_port.h" | |
12 | |
13 namespace base { | |
14 | |
15 // Sends a Mach port to |dest_port|. Assumes that |dest_port| is a send once | |
16 // right. Takes ownership of |dest_port|. | |
17 BASE_EXPORT kern_return_t SendMachPort(mach_port_t dest_port, | |
18 mach_port_t port_to_send, | |
19 int disposition); | |
20 | |
21 // Receives a Mach port from |port_to_listen_on|, which should have exactly one | |
22 // queued message. Returns |MACH_PORT_NULL| on any error. | |
23 BASE_EXPORT base::mac::ScopedMachSendRight ReceiveMachPort( | |
24 mach_port_t port_to_listen_on); | |
25 | |
26 // Creates an intermediate Mach port in |task_port| and sends |port_to_insert| | |
27 // as a mach_msg to the intermediate Mach port. | |
28 // |task_port| is the task port of another process. | |
29 // |port_to_insert| must be a send right in the current task's name space. | |
30 // Returns the intermediate port on success, and MACH_PORT_NULL on failure. | |
31 // On failure, if |error_code| is not null, it is set to an error code as | |
32 // defined in IPC::AttachmentBrokerPrivileged::UMAError. | |
erikchen
2016/03/10 17:54:09
Use an enum here, and have IPC::AttachmentBrokerPr
Anand Mistry (off Chromium)
2016/03/11 00:29:04
Is this what you had in mind?
erikchen
2016/03/11 00:30:56
yup. still lgtm.
| |
33 // This method takes ownership of |port_to_insert|. On success, ownership is | |
34 // passed to the intermediate Mach port. | |
35 BASE_EXPORT mach_port_name_t CreateIntermediateMachPort( | |
36 mach_port_t task_port, | |
37 base::mac::ScopedMachSendRight port_to_insert, | |
38 uint32_t* error_code); | |
39 | |
40 } // namespace base | |
41 | |
42 #endif // BASE_MAC_MACH_PORT_UTIL_H_ | |
OLD | NEW |