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 #ifndef REMOTING_HOST_DAEMON_PROCESS_H_ | 5 #ifndef REMOTING_HOST_DAEMON_PROCESS_H_ |
6 #define REMOTING_HOST_DAEMON_PROCESS_H_ | 6 #define REMOTING_HOST_DAEMON_PROCESS_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // This class implements core of the daemon process. It manages the networking | 27 // This class implements core of the daemon process. It manages the networking |
28 // process running at lower privileges and maintains the list of virtual | 28 // process running at lower privileges and maintains the list of virtual |
29 // terminals. | 29 // terminals. |
30 class DaemonProcess : public Stoppable, public IPC::Listener { | 30 class DaemonProcess : public Stoppable, public IPC::Listener { |
31 public: | 31 public: |
32 virtual ~DaemonProcess(); | 32 virtual ~DaemonProcess(); |
33 | 33 |
34 // Creates a platform-specific implementation of the daemon process object. | 34 // Creates a platform-specific implementation of the daemon process object. |
35 static scoped_ptr<DaemonProcess> Create( | 35 static scoped_ptr<DaemonProcess> Create( |
36 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 36 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 37 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
37 const base::Closure& stopped_callback); | 38 const base::Closure& stopped_callback); |
38 | 39 |
39 // IPC::Listener implementation. | 40 // IPC::Listener implementation. |
40 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 41 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
41 | 42 |
42 protected: | 43 protected: |
43 DaemonProcess(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 44 DaemonProcess(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 45 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
44 const base::Closure& stopped_callback); | 46 const base::Closure& stopped_callback); |
45 | 47 |
46 // Reads the host configuration and launches the networking process. | 48 // Reads the host configuration and launches the networking process. |
47 void Init(); | 49 void Init(); |
48 | 50 |
49 // Stoppable implementation. | 51 // Stoppable implementation. |
50 virtual void DoStop() OVERRIDE; | 52 virtual void DoStop() OVERRIDE; |
51 | 53 |
52 // Launches the network process and establishes an IPC channel with it. | 54 // Launches the network process and establishes an IPC channel with it. |
53 virtual bool LaunchNetworkProcess() = 0; | 55 virtual bool LaunchNetworkProcess() = 0; |
54 | 56 |
55 private: | 57 private: |
56 // The main task runner. Typically it is the UI message loop. | 58 // The main task runner. Typically it is the UI message loop. |
57 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 59 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
58 | 60 |
59 // A dedicated thread for handling IPC requests. | 61 // Handles IPC and background I/O tasks. |
60 scoped_ptr<base::Thread> ipc_thread_; | 62 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
61 | 63 |
62 // The IPC channel connecting the daemon process to the networking process. | 64 // The IPC channel connecting the daemon process to the networking process. |
63 scoped_ptr<IPC::ChannelProxy> network_process_channel_; | 65 scoped_ptr<IPC::ChannelProxy> network_process_channel_; |
64 | 66 |
65 DISALLOW_COPY_AND_ASSIGN(DaemonProcess); | 67 DISALLOW_COPY_AND_ASSIGN(DaemonProcess); |
66 }; | 68 }; |
67 | 69 |
68 } // namespace remoting | 70 } // namespace remoting |
69 | 71 |
70 #endif // REMOTING_HOST_DAEMON_PROCESS_H_ | 72 #endif // REMOTING_HOST_DAEMON_PROCESS_H_ |
OLD | NEW |