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

Unified Diff: ipc/attachment_broker_privileged.cc

Issue 1405253010: ipc: Add a lock to guard modifications of state of the AttachmentBroker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ipc/attachment_broker.cc ('k') | ipc/attachment_broker_privileged_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/attachment_broker_privileged.cc
diff --git a/ipc/attachment_broker_privileged.cc b/ipc/attachment_broker_privileged.cc
index c3ebfda2e927684617b0f82c193517230648a73f..7631001e5413cecebdbc40b12cbfa3b600c18c6c 100644
--- a/ipc/attachment_broker_privileged.cc
+++ b/ipc/attachment_broker_privileged.cc
@@ -87,6 +87,7 @@ void AttachmentBrokerPrivileged::CreateBrokerIfNeeded() {
void AttachmentBrokerPrivileged::RegisterCommunicationChannel(
Endpoint* endpoint) {
+ base::AutoLock auto_lock(*get_lock());
endpoint->SetAttachmentBrokerEndpoint(true);
auto it = std::find(endpoints_.begin(), endpoints_.end(), endpoint);
DCHECK(endpoints_.end() == it);
@@ -95,12 +96,14 @@ void AttachmentBrokerPrivileged::RegisterCommunicationChannel(
void AttachmentBrokerPrivileged::DeregisterCommunicationChannel(
Endpoint* endpoint) {
+ base::AutoLock auto_lock(*get_lock());
auto it = std::find(endpoints_.begin(), endpoints_.end(), endpoint);
if (it != endpoints_.end())
endpoints_.erase(it);
}
Sender* AttachmentBrokerPrivileged::GetSenderWithProcessId(base::ProcessId id) {
+ base::AutoLock auto_lock(*get_lock());
auto it = std::find_if(endpoints_.begin(), endpoints_.end(),
[id](Endpoint* c) { return c->GetPeerPID() == id; });
if (it == endpoints_.end())
« no previous file with comments | « ipc/attachment_broker.cc ('k') | ipc/attachment_broker_privileged_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698