Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Side by Side Diff: remoting/host/chromoting_host.h

Issue 5298001: Use VP8 over PseudoTCP by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_CHROMOTING_HOST_H_ 5 #ifndef REMOTING_CHROMOTING_HOST_H_
6 #define REMOTING_CHROMOTING_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/base/encoder.h" 11 #include "remoting/base/encoder.h"
12 #include "remoting/host/access_verifier.h" 12 #include "remoting/host/access_verifier.h"
13 #include "remoting/host/capturer.h" 13 #include "remoting/host/capturer.h"
14 #include "remoting/host/heartbeat_sender.h" 14 #include "remoting/host/heartbeat_sender.h"
15 #include "remoting/jingle_glue/jingle_client.h" 15 #include "remoting/jingle_glue/jingle_client.h"
16 #include "remoting/jingle_glue/jingle_thread.h" 16 #include "remoting/jingle_glue/jingle_thread.h"
17 #include "remoting/protocol/session_manager.h" 17 #include "remoting/protocol/session_manager.h"
18 #include "remoting/protocol/connection_to_client.h" 18 #include "remoting/protocol/connection_to_client.h"
19 19
20 class Task; 20 class Task;
21 21
22 namespace remoting { 22 namespace remoting {
23 23
24 namespace protocol { 24 namespace protocol {
25 class ConnectionToClient; 25 class ConnectionToClient;
26 class HostStub; 26 class HostStub;
27 class InputStub; 27 class InputStub;
28 class SessionConfig; 28 class SessionConfig;
29 class CandidateSessionConfig;
29 } // namespace protocol 30 } // namespace protocol
30 31
31 class Capturer; 32 class Capturer;
32 class ChromotingHostContext; 33 class ChromotingHostContext;
33 class Encoder; 34 class Encoder;
34 class MutableHostConfig; 35 class MutableHostConfig;
35 class SessionManager; 36 class SessionManager;
36 37
37 // A class to implement the functionality of a host process. 38 // A class to implement the functionality of a host process.
38 // 39 //
(...skipping 17 matching lines...) Expand all
56 // 57 //
57 // 3. When the user is disconencted, we will pause the SessionManager 58 // 3. When the user is disconencted, we will pause the SessionManager
58 // and try to terminate the threads we have created. This will allow 59 // and try to terminate the threads we have created. This will allow
59 // all pending tasks to complete. After all of that completed we 60 // all pending tasks to complete. After all of that completed we
60 // return to the idle state. We then go to step (2) if there a new 61 // return to the idle state. We then go to step (2) if there a new
61 // incoming connection. 62 // incoming connection.
62 class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, 63 class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>,
63 public protocol::ConnectionToClient::EventHandler, 64 public protocol::ConnectionToClient::EventHandler,
64 public JingleClient::Callback { 65 public JingleClient::Callback {
65 public: 66 public:
66 ChromotingHost(ChromotingHostContext* context, MutableHostConfig* config);
67 ChromotingHost(ChromotingHostContext* context, MutableHostConfig* config, 67 ChromotingHost(ChromotingHostContext* context, MutableHostConfig* config,
dmac 2010/11/23 01:14:57 do we want to leave this exposed if we have the fa
Sergey Ulanov 2010/11/23 01:59:18 Done.
68 Capturer* capturer); 68 Capturer* capturer);
69 virtual ~ChromotingHost(); 69 virtual ~ChromotingHost();
70 70
71 static ChromotingHost* Create(ChromotingHostContext* context,
dmac 2010/11/23 01:14:57 Can we comment these?
Sergey Ulanov 2010/11/23 01:59:18 Done.
72 MutableHostConfig* config);
73 static ChromotingHost* Create(ChromotingHostContext* context,
74 MutableHostConfig* config,
75 Capturer* capturer);
76
71 // Asynchronously start the host process. 77 // Asynchronously start the host process.
72 // 78 //
73 // After this is invoked, the host process will connect to the talk 79 // After this is invoked, the host process will connect to the talk
74 // network and start listening for incoming connections. 80 // network and start listening for incoming connections.
75 // 81 //
76 // |shutdown_task| is called if Start() has failed ot Shutdown() is called 82 // |shutdown_task| is called if Start() has failed ot Shutdown() is called
77 // and all related operations are completed. 83 // and all related operations are completed.
78 // 84 //
79 // This method can only be called once during the lifetime of this object. 85 // This method can only be called once during the lifetime of this object.
80 void Start(Task* shutdown_task); 86 void Start(Task* shutdown_task);
(...skipping 15 matching lines...) Expand all
96 102
97 //////////////////////////////////////////////////////////////////////////// 103 ////////////////////////////////////////////////////////////////////////////
98 // JingleClient::Callback implementations 104 // JingleClient::Callback implementations
99 virtual void OnStateChange(JingleClient* client, JingleClient::State state); 105 virtual void OnStateChange(JingleClient* client, JingleClient::State state);
100 106
101 // Callback for ChromotingServer. 107 // Callback for ChromotingServer.
102 void OnNewClientSession( 108 void OnNewClientSession(
103 protocol::Session* session, 109 protocol::Session* session,
104 protocol::SessionManager::IncomingSessionResponse* response); 110 protocol::SessionManager::IncomingSessionResponse* response);
105 111
112 // Sets desired configuration for the protocol. Ownership of the
113 // |config| is transfered to the object. Must be called before Start().
dmac 2010/11/23 01:14:57 s/transfered/transferred
Sergey Ulanov 2010/11/23 01:59:18 Done.
114 void set_protocol_config(protocol::CandidateSessionConfig* config);
dmac 2010/11/23 01:14:57 Should we just pass it in in create?
Sergey Ulanov 2010/11/23 01:59:18 In most cases it is desired to use default config,
115
106 private: 116 private:
107 enum State { 117 enum State {
108 kInitial, 118 kInitial,
109 kStarted, 119 kStarted,
110 kStopped, 120 kStopped,
111 }; 121 };
112 122
113 // This method connects to the talk network and start listening for incoming
114 // connections.
115 void DoStart(Task* shutdown_task);
116
117 // Callback for protocol::SessionManager::Close(). 123 // Callback for protocol::SessionManager::Close().
118 void OnServerClosed(); 124 void OnServerClosed();
119 125
120 // Creates encoder for the specified configuration. 126 // Creates encoder for the specified configuration.
121 Encoder* CreateEncoder(const protocol::SessionConfig* config); 127 Encoder* CreateEncoder(const protocol::SessionConfig* config);
122 128
123 // The context that the chromoting host runs on. 129 // The context that the chromoting host runs on.
124 ChromotingHostContext* context_; 130 ChromotingHostContext* context_;
125 131
126 scoped_refptr<MutableHostConfig> config_; 132 scoped_refptr<MutableHostConfig> config_;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 scoped_ptr<Task> shutdown_task_; 167 scoped_ptr<Task> shutdown_task_;
162 168
163 // Tracks the internal state of the host. 169 // Tracks the internal state of the host.
164 // This variable is written on the main thread of ChromotingHostContext 170 // This variable is written on the main thread of ChromotingHostContext
165 // and read by jingle thread. 171 // and read by jingle thread.
166 State state_; 172 State state_;
167 173
168 // Lock is to lock the access to |state_|. 174 // Lock is to lock the access to |state_|.
169 Lock lock_; 175 Lock lock_;
170 176
177 // Configuration of the protocol.
178 scoped_ptr<protocol::CandidateSessionConfig> protocol_config_;
179
171 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); 180 DISALLOW_COPY_AND_ASSIGN(ChromotingHost);
172 }; 181 };
173 182
174 } // namespace remoting 183 } // namespace remoting
175 184
176 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ 185 #endif // REMOTING_HOST_CHROMOTING_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698