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 #include "ipc/attachment_broker_privileged_mac.h" | 5 #include "ipc/attachment_broker_privileged_mac.h" |
6 | 6 |
7 #include "base/mac/scoped_mach_port.h" | 7 #include "base/mac/scoped_mach_port.h" |
8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "base/process/process.h" | 9 #include "base/process/process.h" |
10 #include "ipc/attachment_broker_messages.h" | 10 #include "ipc/attachment_broker_messages.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 &send_once_right, &send_right_type); | 224 &send_once_right, &send_right_type); |
225 if (kr != KERN_SUCCESS) { | 225 if (kr != KERN_SUCCESS) { |
226 // TODO(erikchen): UMA metric. | 226 // TODO(erikchen): UMA metric. |
227 mach_port_deallocate(task_port, endpoint); | 227 mach_port_deallocate(task_port, endpoint); |
228 return MACH_PORT_NULL; | 228 return MACH_PORT_NULL; |
229 } | 229 } |
230 DCHECK_EQ(static_cast<mach_msg_type_name_t>(MACH_MSG_TYPE_PORT_SEND_ONCE), | 230 DCHECK_EQ(static_cast<mach_msg_type_name_t>(MACH_MSG_TYPE_PORT_SEND_ONCE), |
231 send_right_type); | 231 send_right_type); |
232 | 232 |
233 // This call takes ownership of |send_once_right|. | 233 // This call takes ownership of |send_once_right|. |
234 kr = SendMachPort(send_once_right, port_to_insert, MACH_MSG_TYPE_COPY_SEND); | 234 kr = SendMachPort( |
| 235 send_once_right, port_to_insert.get(), MACH_MSG_TYPE_COPY_SEND); |
235 if (kr != KERN_SUCCESS) { | 236 if (kr != KERN_SUCCESS) { |
236 // TODO(erikchen): UMA metric. | 237 // TODO(erikchen): UMA metric. |
237 mach_port_deallocate(task_port, endpoint); | 238 mach_port_deallocate(task_port, endpoint); |
238 return MACH_PORT_NULL; | 239 return MACH_PORT_NULL; |
239 } | 240 } |
240 | 241 |
241 // Endpoint is intentionally leaked into the destination task. An IPC must be | 242 // Endpoint is intentionally leaked into the destination task. An IPC must be |
242 // sent to the destination task so that it can clean up this port. | 243 // sent to the destination task so that it can clean up this port. |
243 return endpoint; | 244 return endpoint; |
244 } | 245 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 286 |
286 AttachmentBrokerPrivilegedMac::MachPortWireFormat | 287 AttachmentBrokerPrivilegedMac::MachPortWireFormat |
287 AttachmentBrokerPrivilegedMac::CopyWireFormat( | 288 AttachmentBrokerPrivilegedMac::CopyWireFormat( |
288 const MachPortWireFormat& wire_format, | 289 const MachPortWireFormat& wire_format, |
289 uint32_t mach_port) { | 290 uint32_t mach_port) { |
290 return MachPortWireFormat(mach_port, wire_format.destination_process, | 291 return MachPortWireFormat(mach_port, wire_format.destination_process, |
291 wire_format.attachment_id); | 292 wire_format.attachment_id); |
292 } | 293 } |
293 | 294 |
294 } // namespace IPC | 295 } // namespace IPC |
OLD | NEW |