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_unprivileged_mac.h" | 5 #include "ipc/attachment_broker_unprivileged_mac.h" |
6 | 6 |
7 #include <mach/mach.h> | 7 #include <mach/mach.h> |
8 | 8 |
9 #include "base/mac/scoped_mach_port.h" | 9 #include "base/mac/scoped_mach_port.h" |
10 #include "base/process/process.h" | 10 #include "base/process/process.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 void AttachmentBrokerUnprivilegedMac::OnMachPortHasBeenDuplicated( | 84 void AttachmentBrokerUnprivilegedMac::OnMachPortHasBeenDuplicated( |
85 const IPC::internal::MachPortAttachmentMac::WireFormat& wire_format) { | 85 const IPC::internal::MachPortAttachmentMac::WireFormat& wire_format) { |
86 // The IPC message was intended for a different process. Ignore it. | 86 // The IPC message was intended for a different process. Ignore it. |
87 if (wire_format.destination_process != base::Process::Current().Pid()) { | 87 if (wire_format.destination_process != base::Process::Current().Pid()) { |
88 // TODO(erikchen): UMA metric. | 88 // TODO(erikchen): UMA metric. |
89 return; | 89 return; |
90 } | 90 } |
91 | 91 |
92 base::mac::ScopedMachReceiveRight message_port(wire_format.mach_port); | 92 base::mac::ScopedMachReceiveRight message_port(wire_format.mach_port); |
93 base::mac::ScopedMachSendRight memory_object(ReceiveMachPort(message_port)); | 93 base::mac::ScopedMachSendRight memory_object( |
| 94 ReceiveMachPort(message_port.get())); |
94 IPC::internal::MachPortAttachmentMac::WireFormat translated_wire_format( | 95 IPC::internal::MachPortAttachmentMac::WireFormat translated_wire_format( |
95 memory_object.release(), wire_format.destination_process, | 96 memory_object.release(), wire_format.destination_process, |
96 wire_format.attachment_id); | 97 wire_format.attachment_id); |
97 | 98 |
98 scoped_refptr<BrokerableAttachment> attachment( | 99 scoped_refptr<BrokerableAttachment> attachment( |
99 new IPC::internal::MachPortAttachmentMac(translated_wire_format)); | 100 new IPC::internal::MachPortAttachmentMac(translated_wire_format)); |
100 HandleReceivedAttachment(attachment); | 101 HandleReceivedAttachment(attachment); |
101 } | 102 } |
102 | 103 |
103 } // namespace IPC | 104 } // namespace IPC |
OLD | NEW |