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

Side by Side Diff: remoting/host/ipc_desktop_environment.cc

Issue 859413003: Remove uses of CloseProcessHandle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (revert watcher client changes) Created 5 years, 10 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/host/ipc_desktop_environment.h" 5 #include "remoting/host/ipc_desktop_environment.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 174 }
175 175
176 if (i != active_connections_.end()) { 176 if (i != active_connections_.end()) {
177 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_SetScreenResolution( 177 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_SetScreenResolution(
178 i->first, resolution)); 178 i->first, resolution));
179 } 179 }
180 } 180 }
181 181
182 void IpcDesktopEnvironmentFactory::OnDesktopSessionAgentAttached( 182 void IpcDesktopEnvironmentFactory::OnDesktopSessionAgentAttached(
183 int terminal_id, 183 int terminal_id,
184 base::ProcessHandle desktop_process, 184 base::ProcessHandle desktop_process_handle,
185 IPC::PlatformFileForTransit desktop_pipe) { 185 IPC::PlatformFileForTransit desktop_pipe) {
186 if (!caller_task_runner_->BelongsToCurrentThread()) { 186 if (!caller_task_runner_->BelongsToCurrentThread()) {
187 caller_task_runner_->PostTask(FROM_HERE, base::Bind( 187 caller_task_runner_->PostTask(FROM_HERE, base::Bind(
188 &IpcDesktopEnvironmentFactory::OnDesktopSessionAgentAttached, 188 &IpcDesktopEnvironmentFactory::OnDesktopSessionAgentAttached,
189 base::Unretained(this), terminal_id, desktop_process, desktop_pipe)); 189 base::Unretained(this), terminal_id, desktop_process_handle,
190 desktop_pipe));
190 return; 191 return;
191 } 192 }
192 193
194 base::Process desktop_process(desktop_process_handle);
193 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id); 195 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id);
194 if (i != active_connections_.end()) { 196 if (i != active_connections_.end()) {
195 i->second->DetachFromDesktop(); 197 i->second->DetachFromDesktop();
196 i->second->AttachToDesktop(desktop_process, desktop_pipe); 198 i->second->AttachToDesktop(desktop_process.Pass(), desktop_pipe);
197 } else { 199 } else {
198 base::CloseProcessHandle(desktop_process);
199
200 #if defined(OS_POSIX) 200 #if defined(OS_POSIX)
201 DCHECK(desktop_pipe.auto_close); 201 DCHECK(desktop_pipe.auto_close);
202 base::File pipe_closer(IPC::PlatformFileForTransitToFile(desktop_pipe)); 202 base::File pipe_closer(IPC::PlatformFileForTransitToFile(desktop_pipe));
203 #endif // defined(OS_POSIX) 203 #endif // defined(OS_POSIX)
204 } 204 }
205 } 205 }
206 206
207 void IpcDesktopEnvironmentFactory::OnTerminalDisconnected(int terminal_id) { 207 void IpcDesktopEnvironmentFactory::OnTerminalDisconnected(int terminal_id) {
208 if (!caller_task_runner_->BelongsToCurrentThread()) { 208 if (!caller_task_runner_->BelongsToCurrentThread()) {
209 caller_task_runner_->PostTask(FROM_HERE, base::Bind( 209 caller_task_runner_->PostTask(FROM_HERE, base::Bind(
210 &IpcDesktopEnvironmentFactory::OnTerminalDisconnected, 210 &IpcDesktopEnvironmentFactory::OnTerminalDisconnected,
211 base::Unretained(this), terminal_id)); 211 base::Unretained(this), terminal_id));
212 return; 212 return;
213 } 213 }
214 214
215 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id); 215 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id);
216 if (i != active_connections_.end()) { 216 if (i != active_connections_.end()) {
217 DesktopSessionProxy* desktop_session_proxy = i->second; 217 DesktopSessionProxy* desktop_session_proxy = i->second;
218 active_connections_.erase(i); 218 active_connections_.erase(i);
219 219
220 // Disconnect the client session. 220 // Disconnect the client session.
221 desktop_session_proxy->DisconnectSession(); 221 desktop_session_proxy->DisconnectSession();
222 } 222 }
223 } 223 }
224 224
225 } // namespace remoting 225 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/ipc_desktop_environment.h ('k') | remoting/host/ipc_desktop_environment_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698