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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
| 9 #include <tuple> |
| 10 |
9 #include "base/mac/scoped_mach_port.h" | 11 #include "base/mac/scoped_mach_port.h" |
10 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
11 #include "base/process/port_provider_mac.h" | 13 #include "base/process/port_provider_mac.h" |
12 #include "base/process/process.h" | 14 #include "base/process/process.h" |
13 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
14 #include "ipc/attachment_broker_messages.h" | 16 #include "ipc/attachment_broker_messages.h" |
15 #include "ipc/brokerable_attachment.h" | 17 #include "ipc/brokerable_attachment.h" |
16 #include "ipc/ipc_channel.h" | 18 #include "ipc/ipc_channel.h" |
17 #include "ipc/mach_port_attachment_mac.h" | 19 #include "ipc/mach_port_attachment_mac.h" |
18 | 20 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 178 |
177 void AttachmentBrokerPrivilegedMac::OnDuplicateMachPort( | 179 void AttachmentBrokerPrivilegedMac::OnDuplicateMachPort( |
178 const IPC::Message& message) { | 180 const IPC::Message& message) { |
179 DCHECK_NE(0, message.get_sender_pid()); | 181 DCHECK_NE(0, message.get_sender_pid()); |
180 AttachmentBrokerMsg_DuplicateMachPort::Param param; | 182 AttachmentBrokerMsg_DuplicateMachPort::Param param; |
181 if (!AttachmentBrokerMsg_DuplicateMachPort::Read(&message, ¶m)) { | 183 if (!AttachmentBrokerMsg_DuplicateMachPort::Read(&message, ¶m)) { |
182 LogError(ERROR_PARSE_DUPLICATE_MACH_PORT_MESSAGE); | 184 LogError(ERROR_PARSE_DUPLICATE_MACH_PORT_MESSAGE); |
183 return; | 185 return; |
184 } | 186 } |
185 IPC::internal::MachPortAttachmentMac::WireFormat wire_format = | 187 IPC::internal::MachPortAttachmentMac::WireFormat wire_format = |
186 base::get<0>(param); | 188 std::get<0>(param); |
187 | 189 |
188 if (wire_format.destination_process == base::kNullProcessId) { | 190 if (wire_format.destination_process == base::kNullProcessId) { |
189 LogError(NO_DESTINATION); | 191 LogError(NO_DESTINATION); |
190 return; | 192 return; |
191 } | 193 } |
192 | 194 |
193 AddExtractor(message.get_sender_pid(), wire_format.destination_process, | 195 AddExtractor(message.get_sender_pid(), wire_format.destination_process, |
194 wire_format.mach_port, wire_format.attachment_id); | 196 wire_format.mach_port, wire_format.attachment_id); |
195 ProcessExtractorsForProcess(message.get_sender_pid()); | 197 ProcessExtractorsForProcess(message.get_sender_pid()); |
196 } | 198 } |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 | 444 |
443 auto it = extractors_.find(source_pid); | 445 auto it = extractors_.find(source_pid); |
444 if (it == extractors_.end()) | 446 if (it == extractors_.end()) |
445 extractors_[source_pid] = new ScopedVector<AttachmentExtractor>; | 447 extractors_[source_pid] = new ScopedVector<AttachmentExtractor>; |
446 | 448 |
447 extractors_[source_pid]->push_back( | 449 extractors_[source_pid]->push_back( |
448 new AttachmentExtractor(source_pid, dest_pid, port, id)); | 450 new AttachmentExtractor(source_pid, dest_pid, port, id)); |
449 } | 451 } |
450 | 452 |
451 } // namespace IPC | 453 } // namespace IPC |
OLD | NEW |