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 #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 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // Returns the wire format of this attachment. | 60 // Returns the wire format of this attachment. |
61 WireFormat GetWireFormat(const base::ProcessId& destination) const; | 61 WireFormat GetWireFormat(const base::ProcessId& destination) const; |
62 | 62 |
63 mach_port_t get_mach_port() const { return mach_port_; } | 63 mach_port_t get_mach_port() const { return mach_port_; } |
64 | 64 |
65 // The caller of this method has taken ownership of |mach_port_|. | 65 // The caller of this method has taken ownership of |mach_port_|. |
66 void reset_mach_port_ownership() { owns_mach_port_ = false; } | 66 void reset_mach_port_ownership() { owns_mach_port_ = false; } |
67 | 67 |
68 private: | 68 private: |
69 ~MachPortAttachmentMac() override; | 69 ~MachPortAttachmentMac() override; |
70 mach_port_t mach_port_; | 70 const mach_port_t mach_port_; |
71 | 71 |
72 // In the sender process, the attachment owns the Mach port of a newly created | 72 // In the sender process, the attachment owns the Mach port of a newly created |
73 // message. The attachment broker will eventually take ownership, and set | 73 // message. The attachment broker will eventually take ownership, and set |
74 // this member to |false|. | 74 // this member to |false|. |
75 // In the destination process, the attachment never owns the Mach port. The | 75 // In the destination process, the attachment never owns the Mach port. The |
76 // client code that receives the Chrome IPC message is always expected to take | 76 // client code that receives the Chrome IPC message is always expected to take |
77 // ownership. | 77 // ownership. |
78 bool owns_mach_port_; | 78 bool owns_mach_port_; |
79 DISALLOW_COPY_AND_ASSIGN(MachPortAttachmentMac); | 79 DISALLOW_COPY_AND_ASSIGN(MachPortAttachmentMac); |
80 }; | 80 }; |
81 | 81 |
82 } // namespace internal | 82 } // namespace internal |
83 } // namespace IPC | 83 } // namespace IPC |
84 | 84 |
85 #endif // IPC_MACH_PORT_ATTACHMENT_MAC_H_ | 85 #endif // IPC_MACH_PORT_ATTACHMENT_MAC_H_ |
OLD | NEW |