| 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> |
| 8 |
| 7 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/macros.h" |
| 12 #include "base/memory/shared_memory.h" |
| 9 #include "base/process/process_handle.h" | 13 #include "base/process/process_handle.h" |
| 10 #include "base/memory/shared_memory.h" | |
| 11 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "build/build_config.h" |
| 12 #include "ipc/ipc_channel_proxy.h" | 16 #include "ipc/ipc_channel_proxy.h" |
| 13 #include "ipc/ipc_message_macros.h" | 17 #include "ipc/ipc_message_macros.h" |
| 14 #include "remoting/base/capabilities.h" | 18 #include "remoting/base/capabilities.h" |
| 15 #include "remoting/host/chromoting_messages.h" | 19 #include "remoting/host/chromoting_messages.h" |
| 16 #include "remoting/host/client_session.h" | 20 #include "remoting/host/client_session.h" |
| 17 #include "remoting/host/client_session_control.h" | 21 #include "remoting/host/client_session_control.h" |
| 18 #include "remoting/host/desktop_session_connector.h" | 22 #include "remoting/host/desktop_session_connector.h" |
| 19 #include "remoting/host/ipc_audio_capturer.h" | 23 #include "remoting/host/ipc_audio_capturer.h" |
| 20 #include "remoting/host/ipc_input_injector.h" | 24 #include "remoting/host/ipc_input_injector.h" |
| 21 #include "remoting/host/ipc_mouse_cursor_monitor.h" | 25 #include "remoting/host/ipc_mouse_cursor_monitor.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 IPC_MESSAGE_HANDLER(ChromotingDesktopNetworkMsg_InjectClipboardEvent, | 198 IPC_MESSAGE_HANDLER(ChromotingDesktopNetworkMsg_InjectClipboardEvent, |
| 195 OnInjectClipboardEvent) | 199 OnInjectClipboardEvent) |
| 196 IPC_MESSAGE_HANDLER(ChromotingDesktopNetworkMsg_DisconnectSession, | 200 IPC_MESSAGE_HANDLER(ChromotingDesktopNetworkMsg_DisconnectSession, |
| 197 DisconnectSession); | 201 DisconnectSession); |
| 198 IPC_END_MESSAGE_MAP() | 202 IPC_END_MESSAGE_MAP() |
| 199 | 203 |
| 200 CHECK(handled) << "Received unexpected IPC type: " << message.type(); | 204 CHECK(handled) << "Received unexpected IPC type: " << message.type(); |
| 201 return handled; | 205 return handled; |
| 202 } | 206 } |
| 203 | 207 |
| 204 void DesktopSessionProxy::OnChannelConnected(int32 peer_pid) { | 208 void DesktopSessionProxy::OnChannelConnected(int32_t peer_pid) { |
| 205 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 209 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 206 | 210 |
| 207 VLOG(1) << "IPC: network <- desktop (" << peer_pid << ")"; | 211 VLOG(1) << "IPC: network <- desktop (" << peer_pid << ")"; |
| 208 } | 212 } |
| 209 | 213 |
| 210 void DesktopSessionProxy::OnChannelError() { | 214 void DesktopSessionProxy::OnChannelError() { |
| 211 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 215 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 212 | 216 |
| 213 DetachFromDesktop(); | 217 DetachFromDesktop(); |
| 214 } | 218 } |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 | 468 |
| 465 // Pass a captured audio packet to |audio_capturer_|. | 469 // Pass a captured audio packet to |audio_capturer_|. |
| 466 audio_capture_task_runner_->PostTask( | 470 audio_capture_task_runner_->PostTask( |
| 467 FROM_HERE, base::Bind(&IpcAudioCapturer::OnAudioPacket, audio_capturer_, | 471 FROM_HERE, base::Bind(&IpcAudioCapturer::OnAudioPacket, audio_capturer_, |
| 468 base::Passed(&packet))); | 472 base::Passed(&packet))); |
| 469 } | 473 } |
| 470 | 474 |
| 471 void DesktopSessionProxy::OnCreateSharedBuffer( | 475 void DesktopSessionProxy::OnCreateSharedBuffer( |
| 472 int id, | 476 int id, |
| 473 IPC::PlatformFileForTransit handle, | 477 IPC::PlatformFileForTransit handle, |
| 474 uint32 size) { | 478 uint32_t size) { |
| 475 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 479 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 476 | 480 |
| 477 #if defined(OS_WIN) | 481 #if defined(OS_WIN) |
| 478 base::SharedMemoryHandle shm_handle = | 482 base::SharedMemoryHandle shm_handle = |
| 479 base::SharedMemoryHandle(handle, base::GetCurrentProcId()); | 483 base::SharedMemoryHandle(handle, base::GetCurrentProcId()); |
| 480 #else | 484 #else |
| 481 base::SharedMemoryHandle shm_handle = base::SharedMemoryHandle(handle); | 485 base::SharedMemoryHandle shm_handle = base::SharedMemoryHandle(handle); |
| 482 #endif | 486 #endif |
| 483 scoped_refptr<IpcSharedBufferCore> shared_buffer = | 487 scoped_refptr<IpcSharedBufferCore> shared_buffer = |
| 484 new IpcSharedBufferCore(id, shm_handle, desktop_process_.Handle(), size); | 488 new IpcSharedBufferCore(id, shm_handle, desktop_process_.Handle(), size); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 } | 577 } |
| 574 | 578 |
| 575 // static | 579 // static |
| 576 void DesktopSessionProxyTraits::Destruct( | 580 void DesktopSessionProxyTraits::Destruct( |
| 577 const DesktopSessionProxy* desktop_session_proxy) { | 581 const DesktopSessionProxy* desktop_session_proxy) { |
| 578 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, | 582 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, |
| 579 desktop_session_proxy); | 583 desktop_session_proxy); |
| 580 } | 584 } |
| 581 | 585 |
| 582 } // namespace remoting | 586 } // namespace remoting |
| OLD | NEW |