Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(800)

Side by Side Diff: ipc/attachment_broker_unprivileged_mac.cc

Issue 1411523006: mac: Make Mach port scopers better ScopedGenerics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ipc/attachment_broker_privileged_mac_unittest.cc ('k') | sandbox/mac/bootstrap_sandbox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « ipc/attachment_broker_privileged_mac_unittest.cc ('k') | sandbox/mac/bootstrap_sandbox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698