| 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/desktop_session_proxy.h" | 5 #include "remoting/host/desktop_session_proxy.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 IPC_END_MESSAGE_MAP() | 193 IPC_END_MESSAGE_MAP() |
| 194 | 194 |
| 195 CHECK(handled) << "Received unexpected IPC type: " << message.type(); | 195 CHECK(handled) << "Received unexpected IPC type: " << message.type(); |
| 196 return handled; | 196 return handled; |
| 197 } | 197 } |
| 198 | 198 |
| 199 void DesktopSessionProxy::OnChannelConnected(int32_t peer_pid) { | 199 void DesktopSessionProxy::OnChannelConnected(int32_t peer_pid) { |
| 200 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 200 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 201 | 201 |
| 202 VLOG(1) << "IPC: network <- desktop (" << peer_pid << ")"; | 202 VLOG(1) << "IPC: network <- desktop (" << peer_pid << ")"; |
| 203 |
| 204 #if defined(OS_WIN) |
| 205 if (!ProcessIdToSessionId(peer_pid, |
| 206 reinterpret_cast<DWORD*>(&desktop_session_id_))) { |
| 207 PLOG(ERROR) << "ProcessIdToSessionId() failed!"; |
| 208 } |
| 209 #endif // defined(OS_WIN) |
| 203 } | 210 } |
| 204 | 211 |
| 205 void DesktopSessionProxy::OnChannelError() { | 212 void DesktopSessionProxy::OnChannelError() { |
| 206 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 213 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 207 | 214 |
| 208 DetachFromDesktop(); | 215 DetachFromDesktop(); |
| 209 } | 216 } |
| 210 | 217 |
| 211 bool DesktopSessionProxy::AttachToDesktop( | 218 bool DesktopSessionProxy::AttachToDesktop( |
| 212 base::Process desktop_process, | 219 base::Process desktop_process, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 screen_resolution_, | 253 screen_resolution_, |
| 247 virtual_terminal_)); | 254 virtual_terminal_)); |
| 248 | 255 |
| 249 return true; | 256 return true; |
| 250 } | 257 } |
| 251 | 258 |
| 252 void DesktopSessionProxy::DetachFromDesktop() { | 259 void DesktopSessionProxy::DetachFromDesktop() { |
| 253 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 260 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 254 | 261 |
| 255 desktop_channel_.reset(); | 262 desktop_channel_.reset(); |
| 263 desktop_session_id_ = UINT32_MAX; |
| 256 | 264 |
| 257 if (desktop_process_.IsValid()) | 265 if (desktop_process_.IsValid()) |
| 258 desktop_process_.Close(); | 266 desktop_process_.Close(); |
| 259 | 267 |
| 260 shared_buffers_.clear(); | 268 shared_buffers_.clear(); |
| 261 | 269 |
| 262 // Generate fake responses to keep the video capturer in sync. | 270 // Generate fake responses to keep the video capturer in sync. |
| 263 while (pending_capture_frame_requests_) { | 271 while (pending_capture_frame_requests_) { |
| 264 --pending_capture_frame_requests_; | 272 --pending_capture_frame_requests_; |
| 265 video_capturer_->OnCaptureResult( | 273 video_capturer_->OnCaptureResult( |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 } | 546 } |
| 539 | 547 |
| 540 // static | 548 // static |
| 541 void DesktopSessionProxyTraits::Destruct( | 549 void DesktopSessionProxyTraits::Destruct( |
| 542 const DesktopSessionProxy* desktop_session_proxy) { | 550 const DesktopSessionProxy* desktop_session_proxy) { |
| 543 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, | 551 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, |
| 544 desktop_session_proxy); | 552 desktop_session_proxy); |
| 545 } | 553 } |
| 546 | 554 |
| 547 } // namespace remoting | 555 } // namespace remoting |
| OLD | NEW |