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

Side by Side Diff: ipc/mach_port_attachment_mac.h

Issue 2473993003: Delete IPC::ChannelPosix, IPC::ChannelWin and IPC::AttachmentBroker. (Closed)
Patch Set: Created 4 years, 1 month 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/ipc_test_base.cc ('k') | ipc/mach_port_attachment_mac.cc » ('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 #ifndef IPC_MACH_PORT_ATTACHMENT_MAC_H_ 5 #ifndef IPC_MACH_PORT_ATTACHMENT_MAC_H_
6 #define IPC_MACH_PORT_ATTACHMENT_MAC_H_ 6 #define IPC_MACH_PORT_ATTACHMENT_MAC_H_
7 7
8 #include <mach/mach.h> 8 #include <mach/mach.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/process/process_handle.h" 12 #include "base/process/process_handle.h"
13 #include "ipc/brokerable_attachment.h" 13 #include "ipc/brokerable_attachment.h"
14 #include "ipc/ipc_export.h" 14 #include "ipc/ipc_export.h"
15 #include "ipc/mach_port_mac.h" 15 #include "ipc/mach_port_mac.h"
16 16
17 namespace IPC { 17 namespace IPC {
18 namespace internal { 18 namespace internal {
19 19
20 // This class represents an OSX mach_port_t attached to a Chrome IPC message. 20 // This class represents an OSX mach_port_t attached to a Chrome IPC message.
21 class IPC_EXPORT MachPortAttachmentMac : public BrokerableAttachment { 21 class IPC_EXPORT MachPortAttachmentMac : public BrokerableAttachment {
22 public: 22 public:
23 struct IPC_EXPORT WireFormat { 23 struct IPC_EXPORT WireFormat {
24 // IPC translation requires that classes passed through IPC have a default 24 // IPC translation requires that classes passed through IPC have a default
25 // constructor. 25 // constructor.
26 WireFormat() : mach_port(0), destination_process(0) {} 26 WireFormat() : mach_port(0), destination_process(0) {}
27 27
28 WireFormat(uint32_t mach_port, 28 WireFormat(uint32_t mach_port, const base::ProcessId& destination_process)
29 const base::ProcessId& destination_process, 29 : mach_port(mach_port), destination_process(destination_process) {}
30 const AttachmentId& attachment_id)
31 : mach_port(mach_port),
32 destination_process(destination_process),
33 attachment_id(attachment_id) {}
34 30
35 // The mach port that is intended for duplication, or the mach port that has 31 // The mach port that is intended for duplication, or the mach port that has
36 // been duplicated, depending on context. 32 // been duplicated, depending on context.
37 // The type is uint32_t instead of mach_port_t to ensure that the wire 33 // The type is uint32_t instead of mach_port_t to ensure that the wire
38 // format stays consistent. 34 // format stays consistent.
39 uint32_t mach_port; 35 uint32_t mach_port;
40 static_assert(sizeof(mach_port_t) <= sizeof(uint32_t), 36 static_assert(sizeof(mach_port_t) <= sizeof(uint32_t),
41 "mach_port_t must be smaller than uint32_t"); 37 "mach_port_t must be smaller than uint32_t");
42 38
43 // The id of the destination process that the handle is duplicated into. 39 // The id of the destination process that the handle is duplicated into.
44 base::ProcessId destination_process; 40 base::ProcessId destination_process;
45
46 AttachmentId attachment_id;
47 }; 41 };
48 42
49 // This constructor increments the ref count of |mach_port_| and takes 43 // This constructor increments the ref count of |mach_port_| and takes
50 // ownership of the result. Should only be called by the sender of a Chrome 44 // ownership of the result. Should only be called by the sender of a Chrome
51 // IPC message. 45 // IPC message.
52 explicit MachPortAttachmentMac(mach_port_t mach_port); 46 explicit MachPortAttachmentMac(mach_port_t mach_port);
53 47
54 enum FromWire { 48 enum FromWire {
55 FROM_WIRE, 49 FROM_WIRE,
56 }; 50 };
(...skipping 26 matching lines...) Expand all
83 // In the destination process, the attachment owns |mach_port_| until 77 // In the destination process, the attachment owns |mach_port_| until
84 // ParamTraits<MachPortMac>::Read() is called, which takes ownership. 78 // ParamTraits<MachPortMac>::Read() is called, which takes ownership.
85 bool owns_mach_port_; 79 bool owns_mach_port_;
86 DISALLOW_COPY_AND_ASSIGN(MachPortAttachmentMac); 80 DISALLOW_COPY_AND_ASSIGN(MachPortAttachmentMac);
87 }; 81 };
88 82
89 } // namespace internal 83 } // namespace internal
90 } // namespace IPC 84 } // namespace IPC
91 85
92 #endif // IPC_MACH_PORT_ATTACHMENT_MAC_H_ 86 #endif // IPC_MACH_PORT_ATTACHMENT_MAC_H_
OLDNEW
« no previous file with comments | « ipc/ipc_test_base.cc ('k') | ipc/mach_port_attachment_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698