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" |
17 | 18 |
18 namespace remoting { | 19 namespace remoting { |
19 | 20 |
20 // Provides screen/audio capturing and input injection services for | 21 // Provides screen/audio capturing and input injection services for |
21 // the network process. | 22 // the network process. |
22 class DesktopSessionAgentPosix : public DesktopSessionAgent { | 23 class DesktopSessionAgentPosix : public DesktopSessionAgent { |
23 public: | 24 public: |
24 DesktopSessionAgentPosix( | 25 DesktopSessionAgentPosix( |
25 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 26 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
26 scoped_refptr<AutoThreadTaskRunner> input_task_runner, | 27 scoped_refptr<AutoThreadTaskRunner> input_task_runner, |
27 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 28 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
28 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner); | 29 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner); |
29 | 30 |
30 protected: | 31 protected: |
31 virtual ~DesktopSessionAgentPosix(); | 32 virtual ~DesktopSessionAgentPosix(); |
32 | 33 |
33 virtual bool CreateChannelForNetworkProcess( | 34 virtual bool CreateChannelForNetworkProcess( |
34 IPC::PlatformFileForTransit* client_out, | 35 IPC::PlatformFileForTransit* client_out, |
35 scoped_ptr<IPC::ChannelProxy>* server_out) OVERRIDE; | 36 scoped_ptr<IPC::ChannelProxy>* server_out) OVERRIDE; |
| 37 virtual scoped_ptr<EventExecutor> CreateEventExecutor() OVERRIDE; |
36 | 38 |
37 private: | 39 private: |
38 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgentPosix); | 40 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgentPosix); |
39 }; | 41 }; |
40 | 42 |
41 DesktopSessionAgentPosix::DesktopSessionAgentPosix( | 43 DesktopSessionAgentPosix::DesktopSessionAgentPosix( |
42 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 44 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
43 scoped_refptr<AutoThreadTaskRunner> input_task_runner, | 45 scoped_refptr<AutoThreadTaskRunner> input_task_runner, |
44 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 46 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
45 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner) | 47 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 server_out->reset(new IPC::ChannelProxy( | 83 server_out->reset(new IPC::ChannelProxy( |
82 IPC::ChannelHandle(socket_name, fd), | 84 IPC::ChannelHandle(socket_name, fd), |
83 IPC::Channel::MODE_SERVER, | 85 IPC::Channel::MODE_SERVER, |
84 this, | 86 this, |
85 io_task_runner())); | 87 io_task_runner())); |
86 | 88 |
87 *client_out = base::FileDescriptor(pipe_fds[1], false); | 89 *client_out = base::FileDescriptor(pipe_fds[1], false); |
88 return true; | 90 return true; |
89 } | 91 } |
90 | 92 |
| 93 scoped_ptr<EventExecutor> DesktopSessionAgentPosix::CreateEventExecutor() { |
| 94 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 95 |
| 96 return EventExecutor::Create(input_task_runner(), |
| 97 caller_task_runner()).Pass(); |
| 98 } |
| 99 |
91 // static | 100 // static |
92 scoped_refptr<DesktopSessionAgent> DesktopSessionAgent::Create( | 101 scoped_refptr<DesktopSessionAgent> DesktopSessionAgent::Create( |
93 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 102 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
94 scoped_refptr<AutoThreadTaskRunner> input_task_runner, | 103 scoped_refptr<AutoThreadTaskRunner> input_task_runner, |
95 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 104 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
96 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner) { | 105 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner) { |
97 return scoped_refptr<DesktopSessionAgent>( | 106 return scoped_refptr<DesktopSessionAgent>( |
98 new DesktopSessionAgentPosix(caller_task_runner, input_task_runner, | 107 new DesktopSessionAgentPosix(caller_task_runner, input_task_runner, |
99 io_task_runner, video_capture_task_runner)); | 108 io_task_runner, video_capture_task_runner)); |
100 } | 109 } |
101 | 110 |
102 } // namespace remoting | 111 } // namespace remoting |
OLD | NEW |