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

Unified Diff: ipc/attachment_broker_privileged_win.cc

Issue 1256993003: ipc: Create AttachmentBrokerPrivileged and AttachmentBrokerUnprivileged. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add_ipc_message_feature
Patch Set: Rebase. Created 5 years, 5 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
Index: ipc/attachment_broker_privileged_win.cc
diff --git a/ipc/attachment_broker_privileged_win.cc b/ipc/attachment_broker_privileged_win.cc
index 965f3b45dffe7970f2d048ad9d1dcf40254771aa..5344e20b82650dddd5bf2027467d9c32cbd5a19d 100644
--- a/ipc/attachment_broker_privileged_win.cc
+++ b/ipc/attachment_broker_privileged_win.cc
@@ -47,20 +47,6 @@ bool AttachmentBrokerPrivilegedWin::OnMessageReceived(const Message& msg) {
return handled;
}
-void AttachmentBrokerPrivilegedWin::RegisterCommunicationChannel(
- Channel* channel) {
- auto it = std::find(channels_.begin(), channels_.end(), channel);
- DCHECK(channels_.end() == it);
- channels_.push_back(channel);
-}
-
-void AttachmentBrokerPrivilegedWin::DeregisterCommunicationChannel(
- Channel* channel) {
- auto it = std::find(channels_.begin(), channels_.end(), channel);
- DCHECK(it != channels_.end());
- channels_.erase(it);
-}
-
void AttachmentBrokerPrivilegedWin::OnDuplicateWinHandle(
const IPC::Message& message) {
AttachmentBrokerMsg_DuplicateWinHandle::Param param;
@@ -89,10 +75,8 @@ void AttachmentBrokerPrivilegedWin::RouteDuplicatedHandle(
// Another process is the destination.
base::ProcessId dest = wire_format.destination_process;
- auto it =
- std::find_if(channels_.begin(), channels_.end(),
- [dest](Channel* c) { return c->GetPeerPID() == dest; });
- if (it == channels_.end()) {
+ Channel* channel = GetChannelWithProcessId(dest);
+ if (!channel) {
// Assuming that this message was not sent from a malicious process, the
// channel endpoint that would have received this message will block
// forever.
@@ -101,7 +85,8 @@ void AttachmentBrokerPrivilegedWin::RouteDuplicatedHandle(
return;
}
- (*it)->Send(new AttachmentBrokerMsg_WinHandleHasBeenDuplicated(wire_format));
+ channel->Send(
+ new AttachmentBrokerMsg_WinHandleHasBeenDuplicated(wire_format));
}
AttachmentBrokerPrivilegedWin::HandleWireFormat

Powered by Google App Engine
This is Rietveld 408576698