erikchen | 1c1e665 | 2015-10-01 18:51:32 | [diff] [blame^] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "ipc/mach_port_attachment_mac.h" |
| 6 | |
| 7 | namespace IPC { |
| 8 | namespace internal { |
| 9 | |
| 10 | MachPortAttachmentMac::MachPortAttachmentMac(mach_port_t mach_port) |
| 11 | : mach_port_(mach_port) {} |
| 12 | |
| 13 | MachPortAttachmentMac::MachPortAttachmentMac(const WireFormat& wire_format) |
| 14 | : BrokerableAttachment(wire_format.attachment_id), |
| 15 | mach_port_(static_cast<mach_port_t>(wire_format.mach_port)) {} |
| 16 | |
| 17 | MachPortAttachmentMac::MachPortAttachmentMac( |
| 18 | const BrokerableAttachment::AttachmentId& id) |
| 19 | : BrokerableAttachment(id), mach_port_(MACH_PORT_NULL) {} |
| 20 | |
| 21 | MachPortAttachmentMac::~MachPortAttachmentMac() {} |
| 22 | |
| 23 | MachPortAttachmentMac::BrokerableType MachPortAttachmentMac::GetBrokerableType() |
| 24 | const { |
| 25 | return MACH_PORT; |
| 26 | } |
| 27 | |
| 28 | MachPortAttachmentMac::WireFormat MachPortAttachmentMac::GetWireFormat( |
| 29 | const base::ProcessId& destination) const { |
| 30 | return WireFormat(static_cast<uint32_t>(mach_port_), destination, |
| 31 | GetIdentifier()); |
| 32 | } |
| 33 | |
| 34 | } // namespace internal |
| 35 | } // namespace IPC |