OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_SIMPLE_HOST_H_ | 5 #ifndef REMOTING_CHROMOTING_HOST_H_ |
6 #define REMOTING_SIMPLE_HOST_H_ | 6 #define REMOTING_CHROMOTING_HOST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/thread.h" | 10 #include "base/thread.h" |
11 #include "remoting/host/capturer.h" | 11 #include "remoting/host/capturer.h" |
12 #include "remoting/host/client_connection.h" | 12 #include "remoting/host/client_connection.h" |
13 #include "remoting/host/encoder.h" | 13 #include "remoting/host/encoder.h" |
14 #include "remoting/host/event_executor.h" | 14 #include "remoting/host/event_executor.h" |
15 #include "remoting/host/heartbeat_sender.h" | 15 #include "remoting/host/heartbeat_sender.h" |
16 #include "remoting/host/session_manager.h" | 16 #include "remoting/host/session_manager.h" |
(...skipping 24 matching lines...) Expand all Loading... |
41 // This is also the right time to create multiple threads to host | 41 // This is also the right time to create multiple threads to host |
42 // the above objects. After we have done all the initialization | 42 // the above objects. After we have done all the initialization |
43 // we'll start the SessionManager. We'll then enter the running state | 43 // we'll start the SessionManager. We'll then enter the running state |
44 // of the host process. | 44 // of the host process. |
45 // | 45 // |
46 // 3. When the user is disconencted, we will pause the SessionManager | 46 // 3. When the user is disconencted, we will pause the SessionManager |
47 // and try to terminate the threads we have created. This will allow | 47 // and try to terminate the threads we have created. This will allow |
48 // all pending tasks to complete. After all of that completed we | 48 // all pending tasks to complete. After all of that completed we |
49 // return to the idle state. We then go to step (2) if there a new | 49 // return to the idle state. We then go to step (2) if there a new |
50 // incoming connection. | 50 // incoming connection. |
51 class SimpleHost : public base::RefCountedThreadSafe<SimpleHost>, | 51 class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, |
52 public ClientConnection::EventHandler, | 52 public ClientConnection::EventHandler, |
53 public JingleClient::Callback { | 53 public JingleClient::Callback { |
54 public: | 54 public: |
55 SimpleHost(const std::string& username, const std::string& auth_token, | 55 ChromotingHost(const std::string& username, const std::string& auth_token, |
56 Capturer* capturer, Encoder* encoder, EventExecutor* executor, | 56 Capturer* capturer, Encoder* encoder, EventExecutor* executor, |
57 base::WaitableEvent* host_done); | 57 base::WaitableEvent* host_done); |
58 virtual ~SimpleHost(); | 58 virtual ~ChromotingHost(); |
59 | 59 |
60 // Run the host porcess. This method returns only after the message loop | 60 // Run the host porcess. This method returns only after the message loop |
61 // of the host process exits. | 61 // of the host process exits. |
62 void Run(); | 62 void Run(); |
63 | 63 |
64 // This method is called when we need to the host process. | 64 // This method is called when we need to the host process. |
65 void DestroySession(); | 65 void DestroySession(); |
66 | 66 |
67 // This method talks to the cloud to register the host process. If | 67 // This method talks to the cloud to register the host process. If |
68 // successful we will start listening to network requests. | 68 // successful we will start listening to network requests. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // A ClientConnection manages the connectino to a remote client. | 132 // A ClientConnection manages the connectino to a remote client. |
133 // TODO(hclam): Expand this to a list of clients. | 133 // TODO(hclam): Expand this to a list of clients. |
134 scoped_refptr<ClientConnection> client_; | 134 scoped_refptr<ClientConnection> client_; |
135 | 135 |
136 // Session manager for the host process. | 136 // Session manager for the host process. |
137 scoped_refptr<SessionManager> session_; | 137 scoped_refptr<SessionManager> session_; |
138 | 138 |
139 // Signals the host is ready to be destroyed. | 139 // Signals the host is ready to be destroyed. |
140 base::WaitableEvent* host_done_; | 140 base::WaitableEvent* host_done_; |
141 | 141 |
142 DISALLOW_COPY_AND_ASSIGN(SimpleHost); | 142 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
143 }; | 143 }; |
144 | 144 |
145 } // namespace remoting | 145 } // namespace remoting |
146 | 146 |
147 #endif // REMOTING_HOST_SIMPLE_HOST_H_ | 147 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ |
OLD | NEW |