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

Side by Side Diff: ipc/attachment_broker_privileged.cc

Issue 1484763003: ipc: Slight change to GetSenderWithProcessId(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « ipc/attachment_broker_privileged.h ('k') | ipc/attachment_broker_privileged_mac.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 #include "ipc/attachment_broker_privileged.h" 5 #include "ipc/attachment_broker_privileged.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 void AttachmentBrokerPrivileged::DeregisterCommunicationChannel( 97 void AttachmentBrokerPrivileged::DeregisterCommunicationChannel(
98 Endpoint* endpoint) { 98 Endpoint* endpoint) {
99 base::AutoLock auto_lock(*get_lock()); 99 base::AutoLock auto_lock(*get_lock());
100 auto it = std::find(endpoints_.begin(), endpoints_.end(), endpoint); 100 auto it = std::find(endpoints_.begin(), endpoints_.end(), endpoint);
101 if (it != endpoints_.end()) 101 if (it != endpoints_.end())
102 endpoints_.erase(it); 102 endpoints_.erase(it);
103 } 103 }
104 104
105 Sender* AttachmentBrokerPrivileged::GetSenderWithProcessId(base::ProcessId id) { 105 Sender* AttachmentBrokerPrivileged::GetSenderWithProcessId(base::ProcessId id) {
106 base::AutoLock auto_lock(*get_lock()); 106 get_lock()->AssertAcquired();
107 auto it = std::find_if(endpoints_.begin(), endpoints_.end(), 107 auto it = std::find_if(endpoints_.begin(), endpoints_.end(),
108 [id](Endpoint* c) { return c->GetPeerPID() == id; }); 108 [id](Endpoint* c) { return c->GetPeerPID() == id; });
109 if (it == endpoints_.end()) 109 if (it == endpoints_.end())
110 return nullptr; 110 return nullptr;
111 return *it; 111 return *it;
112 } 112 }
113 113
114 void AttachmentBrokerPrivileged::LogError(UMAError error) { 114 void AttachmentBrokerPrivileged::LogError(UMAError error) {
115 UMA_HISTOGRAM_ENUMERATION( 115 UMA_HISTOGRAM_ENUMERATION(
116 "IPC.AttachmentBrokerPrivileged.BrokerAttachmentError", error, ERROR_MAX); 116 "IPC.AttachmentBrokerPrivileged.BrokerAttachmentError", error, ERROR_MAX);
117 } 117 }
118 118
119 } // namespace IPC 119 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/attachment_broker_privileged.h ('k') | ipc/attachment_broker_privileged_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698