| 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 <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/location.h" |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "ipc/ipc_channel.h" | 15 #include "ipc/ipc_channel.h" |
| 15 #include "ipc/ipc_channel_proxy.h" | 16 #include "ipc/ipc_channel_proxy.h" |
| 16 #include "remoting/base/stoppable.h" | 17 #include "remoting/base/stoppable.h" |
| 17 #include "remoting/host/config_file_watcher.h" | 18 #include "remoting/host/config_file_watcher.h" |
| 18 #include "remoting/host/worker_process_ipc_delegate.h" | 19 #include "remoting/host/worker_process_ipc_delegate.h" |
| 19 | 20 |
| 20 class FilePath; | 21 class FilePath; |
| 21 | 22 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 virtual void SendToNetwork(IPC::Message* message) = 0; | 63 virtual void SendToNetwork(IPC::Message* message) = 0; |
| 63 | 64 |
| 64 // Closes the desktop session identified by |terminal_id|. | 65 // Closes the desktop session identified by |terminal_id|. |
| 65 void CloseDesktopSession(int terminal_id); | 66 void CloseDesktopSession(int terminal_id); |
| 66 | 67 |
| 67 protected: | 68 protected: |
| 68 DaemonProcess(scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 69 DaemonProcess(scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 69 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 70 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 70 const base::Closure& stopped_callback); | 71 const base::Closure& stopped_callback); |
| 71 | 72 |
| 73 // Creates a desktop session and assigns a unique ID to it. |
| 74 void CreateDesktopSession(int terminal_id); |
| 75 |
| 76 // Requests the network process to crash. |
| 77 void CrashNetworkProcess(const tracked_objects::Location& location); |
| 78 |
| 72 // Reads the host configuration and launches the network process. | 79 // Reads the host configuration and launches the network process. |
| 73 void Initialize(); | 80 void Initialize(); |
| 74 | 81 |
| 75 // Creates a desktop session and assigns a unique ID to it. | |
| 76 void CreateDesktopSession(int terminal_id); | |
| 77 | |
| 78 // Returns true if |terminal_id| is considered to be known. I.e. it is | 82 // Returns true if |terminal_id| is considered to be known. I.e. it is |
| 79 // less or equal to the highest ID we have seen so far. | 83 // less or equal to the highest ID we have seen so far. |
| 80 bool IsTerminalIdKnown(int terminal_id); | 84 bool IsTerminalIdKnown(int terminal_id); |
| 81 | 85 |
| 82 // Stoppable implementation. | 86 // Stoppable implementation. |
| 83 virtual void DoStop() OVERRIDE; | 87 virtual void DoStop() OVERRIDE; |
| 84 | 88 |
| 85 // Creates a platform-specific desktop session and assigns a unique ID to it. | 89 // Creates a platform-specific desktop session and assigns a unique ID to it. |
| 86 virtual scoped_ptr<DesktopSession> DoCreateDesktopSession( | 90 virtual scoped_ptr<DesktopSession> DoCreateDesktopSession( |
| 87 int terminal_id) = 0; | 91 int terminal_id) = 0; |
| 88 | 92 |
| 89 // Launches the network process and establishes an IPC channel with it. | 93 // Launches the network process and establishes an IPC channel with it. |
| 90 virtual void LaunchNetworkProcess() = 0; | 94 virtual void LaunchNetworkProcess() = 0; |
| 91 | 95 |
| 92 // Restart the network process. | |
| 93 virtual void RestartNetworkProcess() = 0; | |
| 94 | |
| 95 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() { | 96 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() { |
| 96 return caller_task_runner_; | 97 return caller_task_runner_; |
| 97 } | 98 } |
| 98 | 99 |
| 99 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner() { | 100 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner() { |
| 100 return io_task_runner_; | 101 return io_task_runner_; |
| 101 } | 102 } |
| 102 | 103 |
| 103 // Let the test code analyze the list of desktop sessions. | 104 // Let the test code analyze the list of desktop sessions. |
| 104 friend class DaemonProcessTest; | 105 friend class DaemonProcessTest; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 126 | 127 |
| 127 // The highest desktop session ID that has been seen so far. | 128 // The highest desktop session ID that has been seen so far. |
| 128 int next_terminal_id_; | 129 int next_terminal_id_; |
| 129 | 130 |
| 130 DISALLOW_COPY_AND_ASSIGN(DaemonProcess); | 131 DISALLOW_COPY_AND_ASSIGN(DaemonProcess); |
| 131 }; | 132 }; |
| 132 | 133 |
| 133 } // namespace remoting | 134 } // namespace remoting |
| 134 | 135 |
| 135 #endif // REMOTING_HOST_DAEMON_PROCESS_H_ | 136 #endif // REMOTING_HOST_DAEMON_PROCESS_H_ |
| OLD | NEW |