| OLD | NEW |
| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id); | 187 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id); |
| 188 if (i != active_connections_.end()) { | 188 if (i != active_connections_.end()) { |
| 189 i->second->DetachFromDesktop(); | 189 i->second->DetachFromDesktop(); |
| 190 i->second->AttachToDesktop(desktop_process, desktop_pipe); | 190 i->second->AttachToDesktop(desktop_process, desktop_pipe); |
| 191 } else { | 191 } else { |
| 192 base::CloseProcessHandle(desktop_process); | 192 base::CloseProcessHandle(desktop_process); |
| 193 | 193 |
| 194 #if defined(OS_POSIX) | 194 #if defined(OS_POSIX) |
| 195 DCHECK(desktop_pipe.auto_close); | 195 DCHECK(desktop_pipe.auto_close); |
| 196 | 196 base::File pipe_closer(IPC::PlatformFileForTransitToFile(desktop_pipe)); |
| 197 base::ClosePlatformFile(desktop_pipe.fd); | |
| 198 #endif // defined(OS_POSIX) | 197 #endif // defined(OS_POSIX) |
| 199 } | 198 } |
| 200 } | 199 } |
| 201 | 200 |
| 202 void IpcDesktopEnvironmentFactory::OnTerminalDisconnected(int terminal_id) { | 201 void IpcDesktopEnvironmentFactory::OnTerminalDisconnected(int terminal_id) { |
| 203 if (!caller_task_runner_->BelongsToCurrentThread()) { | 202 if (!caller_task_runner_->BelongsToCurrentThread()) { |
| 204 caller_task_runner_->PostTask(FROM_HERE, base::Bind( | 203 caller_task_runner_->PostTask(FROM_HERE, base::Bind( |
| 205 &IpcDesktopEnvironmentFactory::OnTerminalDisconnected, | 204 &IpcDesktopEnvironmentFactory::OnTerminalDisconnected, |
| 206 base::Unretained(this), terminal_id)); | 205 base::Unretained(this), terminal_id)); |
| 207 return; | 206 return; |
| 208 } | 207 } |
| 209 | 208 |
| 210 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id); | 209 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id); |
| 211 if (i != active_connections_.end()) { | 210 if (i != active_connections_.end()) { |
| 212 DesktopSessionProxy* desktop_session_proxy = i->second; | 211 DesktopSessionProxy* desktop_session_proxy = i->second; |
| 213 active_connections_.erase(i); | 212 active_connections_.erase(i); |
| 214 | 213 |
| 215 // Disconnect the client session. | 214 // Disconnect the client session. |
| 216 desktop_session_proxy->DisconnectSession(); | 215 desktop_session_proxy->DisconnectSession(); |
| 217 } | 216 } |
| 218 } | 217 } |
| 219 | 218 |
| 220 } // namespace remoting | 219 } // namespace remoting |
| OLD | NEW |