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_ATTACHMENT_BROKER_H_ | 5 #ifndef IPC_ATTACHMENT_BROKER_H_ |
6 #define IPC_ATTACHMENT_BROKER_H_ | 6 #define IPC_ATTACHMENT_BROKER_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 virtual void RegisterCommunicationChannel( | 100 virtual void RegisterCommunicationChannel( |
101 Endpoint* endpoint, | 101 Endpoint* endpoint, |
102 scoped_refptr<base::SingleThreadTaskRunner> runner); | 102 scoped_refptr<base::SingleThreadTaskRunner> runner); |
103 virtual void DeregisterCommunicationChannel(Endpoint* endpoint); | 103 virtual void DeregisterCommunicationChannel(Endpoint* endpoint); |
104 | 104 |
105 // In each unprivileged process, exactly one channel should be used to | 105 // In each unprivileged process, exactly one channel should be used to |
106 // communicate brokerable attachments with the broker process. | 106 // communicate brokerable attachments with the broker process. |
107 virtual void RegisterBrokerCommunicationChannel(Endpoint* endpoint); | 107 virtual void RegisterBrokerCommunicationChannel(Endpoint* endpoint); |
108 virtual void DeregisterBrokerCommunicationChannel(Endpoint* endpoint); | 108 virtual void DeregisterBrokerCommunicationChannel(Endpoint* endpoint); |
109 | 109 |
| 110 // Informs the attachment broker that a channel endpoint has received its |
| 111 // peer's PID. |
| 112 virtual void ReceivedPeerPid(base::ProcessId peer_pid); |
| 113 |
110 // True if and only if this broker is privileged. | 114 // True if and only if this broker is privileged. |
111 virtual bool IsPrivilegedBroker(); | 115 virtual bool IsPrivilegedBroker(); |
112 | 116 |
113 protected: | 117 protected: |
114 using AttachmentVector = std::vector<scoped_refptr<BrokerableAttachment>>; | 118 using AttachmentVector = std::vector<scoped_refptr<BrokerableAttachment>>; |
115 | 119 |
116 // Adds |attachment| to |attachments_|, and notifies the observers. | 120 // Adds |attachment| to |attachments_|, and notifies the observers. |
117 void HandleReceivedAttachment( | 121 void HandleReceivedAttachment( |
118 const scoped_refptr<BrokerableAttachment>& attachment); | 122 const scoped_refptr<BrokerableAttachment>& attachment); |
119 | 123 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 167 |
164 // The AttachmentBroker can be accessed from any thread, so modifications to | 168 // The AttachmentBroker can be accessed from any thread, so modifications to |
165 // internal state must be guarded by a lock. | 169 // internal state must be guarded by a lock. |
166 base::Lock lock_; | 170 base::Lock lock_; |
167 DISALLOW_COPY_AND_ASSIGN(AttachmentBroker); | 171 DISALLOW_COPY_AND_ASSIGN(AttachmentBroker); |
168 }; | 172 }; |
169 | 173 |
170 } // namespace IPC | 174 } // namespace IPC |
171 | 175 |
172 #endif // IPC_ATTACHMENT_BROKER_H_ | 176 #endif // IPC_ATTACHMENT_BROKER_H_ |
OLD | NEW |