| 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_agent.h" | 5 #include "remoting/host/desktop_session_agent.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <sys/socket.h> | 8 #include <sys/socket.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| 11 | 11 |
| 12 #include "base/posix/eintr_wrapper.h" | 12 #include "base/posix/eintr_wrapper.h" |
| 13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 14 #include "ipc/ipc_channel.h" | 14 #include "ipc/ipc_channel.h" |
| 15 #include "ipc/ipc_channel_proxy.h" | 15 #include "ipc/ipc_channel_proxy.h" |
| 16 #include "remoting/base/auto_thread_task_runner.h" | 16 #include "remoting/base/auto_thread_task_runner.h" |
| 17 #include "remoting/host/event_executor.h" | |
| 18 | 17 |
| 19 namespace remoting { | 18 namespace remoting { |
| 20 | 19 |
| 21 // Provides screen/audio capturing and input injection services for | 20 // Provides screen/audio capturing and input injection services for |
| 22 // the network process. | 21 // the network process. |
| 23 class DesktopSessionAgentPosix : public DesktopSessionAgent { | 22 class DesktopSessionAgentPosix : public DesktopSessionAgent { |
| 24 public: | 23 public: |
| 25 DesktopSessionAgentPosix( | 24 DesktopSessionAgentPosix( |
| 26 scoped_refptr<AutoThreadTaskRunner> audio_capture_task_runner, | 25 scoped_refptr<AutoThreadTaskRunner> audio_capture_task_runner, |
| 27 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 26 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
| 28 scoped_refptr<AutoThreadTaskRunner> input_task_runner, | 27 scoped_refptr<AutoThreadTaskRunner> input_task_runner, |
| 29 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 28 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
| 30 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner); | 29 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner); |
| 31 | 30 |
| 32 protected: | 31 protected: |
| 33 virtual ~DesktopSessionAgentPosix(); | 32 virtual ~DesktopSessionAgentPosix(); |
| 34 | 33 |
| 35 virtual bool CreateChannelForNetworkProcess( | 34 virtual bool CreateChannelForNetworkProcess( |
| 36 IPC::PlatformFileForTransit* client_out, | 35 IPC::PlatformFileForTransit* client_out, |
| 37 scoped_ptr<IPC::ChannelProxy>* server_out) OVERRIDE; | 36 scoped_ptr<IPC::ChannelProxy>* server_out) OVERRIDE; |
| 38 virtual scoped_ptr<EventExecutor> CreateEventExecutor() OVERRIDE; | |
| 39 | 37 |
| 40 private: | 38 private: |
| 41 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgentPosix); | 39 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgentPosix); |
| 42 }; | 40 }; |
| 43 | 41 |
| 44 DesktopSessionAgentPosix::DesktopSessionAgentPosix( | 42 DesktopSessionAgentPosix::DesktopSessionAgentPosix( |
| 45 scoped_refptr<AutoThreadTaskRunner> audio_capture_task_runner, | 43 scoped_refptr<AutoThreadTaskRunner> audio_capture_task_runner, |
| 46 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 44 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
| 47 scoped_refptr<AutoThreadTaskRunner> input_task_runner, | 45 scoped_refptr<AutoThreadTaskRunner> input_task_runner, |
| 48 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 46 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 server_out->reset(new IPC::ChannelProxy( | 84 server_out->reset(new IPC::ChannelProxy( |
| 87 IPC::ChannelHandle(socket_name, fd), | 85 IPC::ChannelHandle(socket_name, fd), |
| 88 IPC::Channel::MODE_SERVER, | 86 IPC::Channel::MODE_SERVER, |
| 89 this, | 87 this, |
| 90 io_task_runner())); | 88 io_task_runner())); |
| 91 | 89 |
| 92 *client_out = base::FileDescriptor(pipe_fds[1], false); | 90 *client_out = base::FileDescriptor(pipe_fds[1], false); |
| 93 return true; | 91 return true; |
| 94 } | 92 } |
| 95 | 93 |
| 96 scoped_ptr<EventExecutor> DesktopSessionAgentPosix::CreateEventExecutor() { | |
| 97 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | |
| 98 | |
| 99 return EventExecutor::Create(input_task_runner(), | |
| 100 caller_task_runner()).Pass(); | |
| 101 } | |
| 102 | |
| 103 // static | 94 // static |
| 104 scoped_refptr<DesktopSessionAgent> DesktopSessionAgent::Create( | 95 scoped_refptr<DesktopSessionAgent> DesktopSessionAgent::Create( |
| 105 scoped_refptr<AutoThreadTaskRunner> audio_capture_task_runner, | 96 scoped_refptr<AutoThreadTaskRunner> audio_capture_task_runner, |
| 106 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 97 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
| 107 scoped_refptr<AutoThreadTaskRunner> input_task_runner, | 98 scoped_refptr<AutoThreadTaskRunner> input_task_runner, |
| 108 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 99 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
| 109 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner) { | 100 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner) { |
| 110 return scoped_refptr<DesktopSessionAgent>( | 101 return scoped_refptr<DesktopSessionAgent>( |
| 111 new DesktopSessionAgentPosix(audio_capture_task_runner, | 102 new DesktopSessionAgentPosix(audio_capture_task_runner, |
| 112 caller_task_runner, input_task_runner, | 103 caller_task_runner, input_task_runner, |
| 113 io_task_runner, video_capture_task_runner)); | 104 io_task_runner, video_capture_task_runner)); |
| 114 } | 105 } |
| 115 | 106 |
| 116 } // namespace remoting | 107 } // namespace remoting |
| OLD | NEW |