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

Side by Side Diff: ipc/attachment_broker.h

Issue 1979533003: Fix an attachment broker race condition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | ipc/attachment_broker.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_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
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
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_
OLDNEW
« no previous file with comments | « no previous file | ipc/attachment_broker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698