Update V8 to version 4.6.61.
[chromium-blink-merge.git] / ipc / attachment_broker_privileged.cc
blob1fe3a75e73ec2381ea4e063bab5e5925103db465
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
3 // found in the LICENSE file.
5 #include "ipc/attachment_broker_privileged.h"
7 #include <algorithm>
9 #include "ipc/ipc_channel.h"
11 namespace IPC {
13 AttachmentBrokerPrivileged::AttachmentBrokerPrivileged() {}
15 AttachmentBrokerPrivileged::~AttachmentBrokerPrivileged() {}
17 void AttachmentBrokerPrivileged::RegisterCommunicationChannel(
18 Channel* channel) {
19 channel->set_attachment_broker_endpoint(true);
20 auto it = std::find(channels_.begin(), channels_.end(), channel);
21 DCHECK(channels_.end() == it);
22 channels_.push_back(channel);
25 void AttachmentBrokerPrivileged::DeregisterCommunicationChannel(
26 Channel* channel) {
27 auto it = std::find(channels_.begin(), channels_.end(), channel);
28 if (it != channels_.end())
29 channels_.erase(it);
32 Channel* AttachmentBrokerPrivileged::GetChannelWithProcessId(
33 base::ProcessId id) {
34 auto it = std::find_if(channels_.begin(), channels_.end(),
35 [id](Channel* c) { return c->GetPeerPID() == id; });
36 if (it == channels_.end())
37 return nullptr;
38 return *it;
41 } // namespace IPC