OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IPC_ATTACHMENT_BROKER_PRIVILEGED_MAC_H_ | 5 #ifndef IPC_ATTACHMENT_BROKER_PRIVILEGED_MAC_H_ |
6 #define IPC_ATTACHMENT_BROKER_PRIVILEGED_MAC_H_ | 6 #define IPC_ATTACHMENT_BROKER_PRIVILEGED_MAC_H_ |
7 | 7 |
8 #include <mach/mach.h> | 8 #include <mach/mach.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 }; | 134 }; |
135 | 135 |
136 // IPC message handlers. | 136 // IPC message handlers. |
137 void OnDuplicateMachPort(const Message& message); | 137 void OnDuplicateMachPort(const Message& message); |
138 | 138 |
139 // Duplicates the Mach port referenced from |wire_format| from | 139 // Duplicates the Mach port referenced from |wire_format| from |
140 // |source_process| into |wire_format|'s destination process. | 140 // |source_process| into |wire_format|'s destination process. |
141 MachPortWireFormat DuplicateMachPort(const MachPortWireFormat& wire_format, | 141 MachPortWireFormat DuplicateMachPort(const MachPortWireFormat& wire_format, |
142 base::ProcessId source_process); | 142 base::ProcessId source_process); |
143 | 143 |
144 // |task_port| is the task port of another process. | |
145 // |port_to_insert| must be a send right in the current task's name space. | |
146 // Creates an intermediate Mach port in |pid| and sends |port_to_insert| as a | |
147 // mach_msg to the intermediate Mach port. | |
148 // Returns the intermediate port on success, and MACH_PORT_NULL on failure. | |
149 // This method takes ownership of |port_to_insert|. On success, ownership is | |
150 // passed to the intermediate Mach port. | |
151 mach_port_name_t CreateIntermediateMachPort( | |
152 mach_port_t task_port, | |
153 base::mac::ScopedMachSendRight port_to_insert); | |
154 | |
155 // Extracts a copy of the send right to |named_right| from |task_port|. | 144 // Extracts a copy of the send right to |named_right| from |task_port|. |
156 // Returns MACH_PORT_NULL on error. | 145 // Returns MACH_PORT_NULL on error. |
157 base::mac::ScopedMachSendRight ExtractNamedRight( | 146 base::mac::ScopedMachSendRight ExtractNamedRight( |
158 mach_port_t task_port, | 147 mach_port_t task_port, |
159 mach_port_name_t named_right); | 148 mach_port_name_t named_right); |
160 | 149 |
161 // Copies an existing |wire_format|, but substitutes in a different mach port. | 150 // Copies an existing |wire_format|, but substitutes in a different mach port. |
162 MachPortWireFormat CopyWireFormat(const MachPortWireFormat& wire_format, | 151 MachPortWireFormat CopyWireFormat(const MachPortWireFormat& wire_format, |
163 uint32_t mach_port); | 152 uint32_t mach_port); |
164 | 153 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // processed. | 204 // processed. |
216 std::map<base::ProcessId, ScopedVector<AttachmentExtractor>*> extractors_; | 205 std::map<base::ProcessId, ScopedVector<AttachmentExtractor>*> extractors_; |
217 base::Lock extractors_lock_; | 206 base::Lock extractors_lock_; |
218 | 207 |
219 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivilegedMac); | 208 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivilegedMac); |
220 }; | 209 }; |
221 | 210 |
222 } // namespace IPC | 211 } // namespace IPC |
223 | 212 |
224 #endif // IPC_ATTACHMENT_BROKER_PRIVILEGED_MAC_H_ | 213 #endif // IPC_ATTACHMENT_BROKER_PRIVILEGED_MAC_H_ |
OLD | NEW |