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/port_provider_mac.h" | 9 #include "base/process/port_provider_mac.h" |
10 #include "base/process/process.h" | 10 #include "base/process/process.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 namespace IPC { | 54 namespace IPC { |
55 | 55 |
56 AttachmentBrokerPrivilegedMac::AttachmentBrokerPrivilegedMac( | 56 AttachmentBrokerPrivilegedMac::AttachmentBrokerPrivilegedMac( |
57 base::PortProvider* port_provider) | 57 base::PortProvider* port_provider) |
58 : port_provider_(port_provider) {} | 58 : port_provider_(port_provider) {} |
59 | 59 |
60 AttachmentBrokerPrivilegedMac::~AttachmentBrokerPrivilegedMac() {} | 60 AttachmentBrokerPrivilegedMac::~AttachmentBrokerPrivilegedMac() {} |
61 | 61 |
62 bool AttachmentBrokerPrivilegedMac::SendAttachmentToProcess( | 62 bool AttachmentBrokerPrivilegedMac::SendAttachmentToProcess( |
63 BrokerableAttachment* attachment, | 63 const scoped_refptr<IPC::BrokerableAttachment>& attachment, |
64 base::ProcessId destination_process) { | 64 base::ProcessId destination_process) { |
65 switch (attachment->GetBrokerableType()) { | 65 switch (attachment->GetBrokerableType()) { |
66 case BrokerableAttachment::MACH_PORT: { | 66 case BrokerableAttachment::MACH_PORT: { |
67 internal::MachPortAttachmentMac* mach_port_attachment = | 67 internal::MachPortAttachmentMac* mach_port_attachment = |
68 static_cast<internal::MachPortAttachmentMac*>(attachment); | 68 static_cast<internal::MachPortAttachmentMac*>(attachment.get()); |
69 MachPortWireFormat wire_format = | 69 MachPortWireFormat wire_format = |
70 mach_port_attachment->GetWireFormat(destination_process); | 70 mach_port_attachment->GetWireFormat(destination_process); |
71 | 71 |
72 if (destination_process == base::Process::Current().Pid()) { | 72 if (destination_process == base::Process::Current().Pid()) { |
73 RouteWireFormatToSelf(wire_format); | 73 RouteWireFormatToSelf(wire_format); |
74 mach_port_attachment->reset_mach_port_ownership(); | 74 mach_port_attachment->reset_mach_port_ownership(); |
75 return true; | 75 return true; |
76 } | 76 } |
77 | 77 |
78 mach_port_name_t intermediate_port = CreateIntermediateMachPort( | 78 mach_port_name_t intermediate_port = CreateIntermediateMachPort( |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 282 |
283 AttachmentBrokerPrivilegedMac::MachPortWireFormat | 283 AttachmentBrokerPrivilegedMac::MachPortWireFormat |
284 AttachmentBrokerPrivilegedMac::CopyWireFormat( | 284 AttachmentBrokerPrivilegedMac::CopyWireFormat( |
285 const MachPortWireFormat& wire_format, | 285 const MachPortWireFormat& wire_format, |
286 uint32_t mach_port) { | 286 uint32_t mach_port) { |
287 return MachPortWireFormat(mach_port, wire_format.destination_process, | 287 return MachPortWireFormat(mach_port, wire_format.destination_process, |
288 wire_format.attachment_id); | 288 wire_format.attachment_id); |
289 } | 289 } |
290 | 290 |
291 } // namespace IPC | 291 } // namespace IPC |
OLD | NEW |