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

Side by Side Diff: ipc/attachment_broker_privileged_win.cc

Issue 1270683002: ipc: Make a common subclass for Channel and ProxyChannel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More rebase errors. Created 5 years, 4 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 | « ipc/attachment_broker_privileged.cc ('k') | ipc/attachment_broker_privileged_win_unittest.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_win.h" 5 #include "ipc/attachment_broker_privileged_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/process/process.h" 9 #include "base/process/process.h"
10 #include "ipc/attachment_broker_messages.h" 10 #include "ipc/attachment_broker_messages.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // This process is the destination. 68 // This process is the destination.
69 if (wire_format.destination_process == base::Process::Current().Pid()) { 69 if (wire_format.destination_process == base::Process::Current().Pid()) {
70 scoped_refptr<BrokerableAttachment> attachment( 70 scoped_refptr<BrokerableAttachment> attachment(
71 new internal::HandleAttachmentWin(wire_format)); 71 new internal::HandleAttachmentWin(wire_format));
72 HandleReceivedAttachment(attachment); 72 HandleReceivedAttachment(attachment);
73 return; 73 return;
74 } 74 }
75 75
76 // Another process is the destination. 76 // Another process is the destination.
77 base::ProcessId dest = wire_format.destination_process; 77 base::ProcessId dest = wire_format.destination_process;
78 Channel* channel = GetChannelWithProcessId(dest); 78 Sender* sender = GetSenderWithProcessId(dest);
79 if (!channel) { 79 if (!sender) {
80 // Assuming that this message was not sent from a malicious process, the 80 // Assuming that this message was not sent from a malicious process, the
81 // channel endpoint that would have received this message will block 81 // channel endpoint that would have received this message will block
82 // forever. 82 // forever.
83 LOG(ERROR) << "Failed to deliver brokerable attachment to process with id: " 83 LOG(ERROR) << "Failed to deliver brokerable attachment to process with id: "
84 << dest; 84 << dest;
85 return; 85 return;
86 } 86 }
87 87
88 channel->Send( 88 sender->Send(new AttachmentBrokerMsg_WinHandleHasBeenDuplicated(wire_format));
89 new AttachmentBrokerMsg_WinHandleHasBeenDuplicated(wire_format));
90 } 89 }
91 90
92 AttachmentBrokerPrivilegedWin::HandleWireFormat 91 AttachmentBrokerPrivilegedWin::HandleWireFormat
93 AttachmentBrokerPrivilegedWin::DuplicateWinHandle( 92 AttachmentBrokerPrivilegedWin::DuplicateWinHandle(
94 const HandleWireFormat& wire_format, 93 const HandleWireFormat& wire_format,
95 base::ProcessId source_pid) { 94 base::ProcessId source_pid) {
96 HandleWireFormat new_wire_format; 95 HandleWireFormat new_wire_format;
97 new_wire_format.destination_process = wire_format.destination_process; 96 new_wire_format.destination_process = wire_format.destination_process;
98 new_wire_format.attachment_id = wire_format.attachment_id; 97 new_wire_format.attachment_id = wire_format.attachment_id;
99 98
(...skipping 10 matching lines...) Expand all
110 FALSE, DUPLICATE_SAME_ACCESS); 109 FALSE, DUPLICATE_SAME_ACCESS);
111 110
112 new_wire_format.handle = (result != 0) ? HandleToLong(new_handle) : 0; 111 new_wire_format.handle = (result != 0) ? HandleToLong(new_handle) : 0;
113 } else { 112 } else {
114 new_wire_format.handle = 0; 113 new_wire_format.handle = 0;
115 } 114 }
116 return new_wire_format; 115 return new_wire_format;
117 } 116 }
118 117
119 } // namespace IPC 118 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/attachment_broker_privileged.cc ('k') | ipc/attachment_broker_privileged_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698