Chromium Code Reviews| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 | 90 |
| 91 // These two methods should only be called by the broker process. | 91 // These two methods should only be called by the broker process. |
| 92 // | 92 // |
| 93 // Each unprivileged process should have one IPC channel on which it | 93 // Each unprivileged process should have one IPC channel on which it |
| 94 // communicates attachment information with the broker process. In the broker | 94 // communicates attachment information with the broker process. In the broker |
| 95 // process, these channels must be registered and deregistered with the | 95 // process, these channels must be registered and deregistered with the |
| 96 // Attachment Broker as they are created and destroyed. | 96 // Attachment Broker as they are created and destroyed. |
| 97 virtual void RegisterCommunicationChannel(Endpoint* endpoint); | 97 virtual void RegisterCommunicationChannel(Endpoint* endpoint); |
| 98 virtual void DeregisterCommunicationChannel(Endpoint* endpoint); | 98 virtual void DeregisterCommunicationChannel(Endpoint* endpoint); |
| 99 | 99 |
| 100 // In each unprivileged process, exactly one channel should be used to | |
| 101 // communicate brokerable attachments with the broker process. | |
| 102 virtual void DesignateBrokerCommunicationChannel(Endpoint* endpoint); | |
| 103 | |
| 104 // Whether the process's broker is privileged. | |
|
Tom Sepez
2016/02/09 00:26:19
nit: True iff the process's broker is privileged.
erikchen
2016/02/09 02:38:51
Done.
| |
| 105 virtual bool IsPrivilegedBroker(); | |
|
Tom Sepez
2016/02/09 00:26:19
Nit: maybe HasPrivilegedBroker(), because this pro
erikchen
2016/02/09 02:38:51
My initial comment was inaccurate in its use of th
| |
| 106 | |
| 100 protected: | 107 protected: |
| 101 using AttachmentVector = std::vector<scoped_refptr<BrokerableAttachment>>; | 108 using AttachmentVector = std::vector<scoped_refptr<BrokerableAttachment>>; |
| 102 | 109 |
| 103 // Adds |attachment| to |attachments_|, and notifies the observers. | 110 // Adds |attachment| to |attachments_|, and notifies the observers. |
| 104 void HandleReceivedAttachment( | 111 void HandleReceivedAttachment( |
| 105 const scoped_refptr<BrokerableAttachment>& attachment); | 112 const scoped_refptr<BrokerableAttachment>& attachment); |
| 106 | 113 |
| 107 // Informs the observers that a new BrokerableAttachment has been received. | 114 // Informs the observers that a new BrokerableAttachment has been received. |
| 108 void NotifyObservers(const BrokerableAttachment::AttachmentId& id); | 115 void NotifyObservers(const BrokerableAttachment::AttachmentId& id); |
| 109 | 116 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 | 156 |
| 150 // The AttachmentBroker can be accessed from any thread, so modifications to | 157 // The AttachmentBroker can be accessed from any thread, so modifications to |
| 151 // internal state must be guarded by a lock. | 158 // internal state must be guarded by a lock. |
| 152 base::Lock lock_; | 159 base::Lock lock_; |
| 153 DISALLOW_COPY_AND_ASSIGN(AttachmentBroker); | 160 DISALLOW_COPY_AND_ASSIGN(AttachmentBroker); |
| 154 }; | 161 }; |
| 155 | 162 |
| 156 } // namespace IPC | 163 } // namespace IPC |
| 157 | 164 |
| 158 #endif // IPC_ATTACHMENT_BROKER_H_ | 165 #endif // IPC_ATTACHMENT_BROKER_H_ |
| OLD | NEW |