| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 AttachmentBrokerPrivilegedMac::~AttachmentBrokerPrivilegedMac() {} | 58 AttachmentBrokerPrivilegedMac::~AttachmentBrokerPrivilegedMac() {} |
| 59 | 59 |
| 60 void AttachmentBrokerPrivilegedMac::SetPortProvider( | 60 void AttachmentBrokerPrivilegedMac::SetPortProvider( |
| 61 base::PortProvider* port_provider) { | 61 base::PortProvider* port_provider) { |
| 62 CHECK(!port_provider_); | 62 CHECK(!port_provider_); |
| 63 port_provider_ = port_provider; | 63 port_provider_ = port_provider; |
| 64 } | 64 } |
| 65 | 65 |
| 66 bool AttachmentBrokerPrivilegedMac::SendAttachmentToProcess( | 66 bool AttachmentBrokerPrivilegedMac::SendAttachmentToProcess( |
| 67 const BrokerableAttachment* attachment, | 67 BrokerableAttachment* attachment, |
| 68 base::ProcessId destination_process) { | 68 base::ProcessId destination_process) { |
| 69 switch (attachment->GetBrokerableType()) { | 69 switch (attachment->GetBrokerableType()) { |
| 70 case BrokerableAttachment::MACH_PORT: { | 70 case BrokerableAttachment::MACH_PORT: { |
| 71 const internal::MachPortAttachmentMac* mach_port_attachment = | 71 const internal::MachPortAttachmentMac* mach_port_attachment = |
| 72 static_cast<const internal::MachPortAttachmentMac*>(attachment); | 72 static_cast<const internal::MachPortAttachmentMac*>(attachment); |
| 73 MachPortWireFormat wire_format = | 73 MachPortWireFormat wire_format = |
| 74 mach_port_attachment->GetWireFormat(destination_process); | 74 mach_port_attachment->GetWireFormat(destination_process); |
| 75 MachPortWireFormat new_wire_format = | 75 MachPortWireFormat new_wire_format = |
| 76 DuplicateMachPort(wire_format, base::Process::Current().Pid()); | 76 DuplicateMachPort(wire_format, base::Process::Current().Pid()); |
| 77 if (new_wire_format.mach_port == 0) | 77 if (new_wire_format.mach_port == 0) |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 266 |
| 267 AttachmentBrokerPrivilegedMac::MachPortWireFormat | 267 AttachmentBrokerPrivilegedMac::MachPortWireFormat |
| 268 AttachmentBrokerPrivilegedMac::CopyWireFormat( | 268 AttachmentBrokerPrivilegedMac::CopyWireFormat( |
| 269 const MachPortWireFormat& wire_format, | 269 const MachPortWireFormat& wire_format, |
| 270 uint32_t mach_port) { | 270 uint32_t mach_port) { |
| 271 return MachPortWireFormat(mach_port, wire_format.destination_process, | 271 return MachPortWireFormat(mach_port, wire_format.destination_process, |
| 272 wire_format.attachment_id); | 272 wire_format.attachment_id); |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace IPC | 275 } // namespace IPC |
| OLD | NEW |