OLD | NEW |
1 // Copyright (c) 2011 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_CLIENT_CLIENT_CONTEXT_H_ | 5 #ifndef REMOTING_CLIENT_CLIENT_CONTEXT_H_ |
6 #define REMOTING_CLIENT_CLIENT_CONTEXT_H_ | 6 #define REMOTING_CLIENT_CLIENT_CONTEXT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
11 #include "remoting/jingle_glue/jingle_thread.h" | 11 #include "remoting/jingle_glue/jingle_thread.h" |
12 | 12 |
13 namespace remoting { | 13 namespace remoting { |
14 | 14 |
15 // A class that manages threads and running context for the chromoting client | 15 // A class that manages threads and running context for the chromoting client |
16 // process. This class is not designed to be subclassed. | 16 // process. |
17 class ClientContext { | 17 class ClientContext { |
18 public: | 18 public: |
19 ClientContext(); | 19 ClientContext(); |
20 ~ClientContext(); | 20 virtual ~ClientContext(); |
21 | 21 |
22 // Start and Stop must be called from the main plugin thread. | |
23 void Start(); | 22 void Start(); |
24 void Stop(); | 23 void Stop(); |
25 | 24 |
26 JingleThread* jingle_thread(); | 25 JingleThread* jingle_thread(); |
27 | 26 |
28 MessageLoop* main_message_loop(); | 27 MessageLoop* main_message_loop(); |
29 MessageLoop* decode_message_loop(); | 28 MessageLoop* decode_message_loop(); |
30 MessageLoop* network_message_loop(); | 29 MessageLoop* network_message_loop(); |
31 | 30 |
32 private: | 31 private: |
33 // A thread that handles Jingle network operations (used in | 32 // A thread that handles Jingle network operations (used in |
34 // JingleHostConnection). | 33 // JingleHostConnection). |
35 JingleThread jingle_thread_; | 34 JingleThread jingle_thread_; |
36 | 35 |
37 // A thread that handles capture rate control and sending data to the | 36 // A thread that handles capture rate control and sending data to the |
38 // HostConnection. | 37 // HostConnection. |
39 base::Thread main_thread_; | 38 base::Thread main_thread_; |
40 | 39 |
41 // A thread that handles all decode operations. | 40 // A thread that handles all decode operations. |
42 base::Thread decode_thread_; | 41 base::Thread decode_thread_; |
43 | 42 |
44 // True if Start() was called on the context. | |
45 bool started_; | |
46 | |
47 DISALLOW_COPY_AND_ASSIGN(ClientContext); | 43 DISALLOW_COPY_AND_ASSIGN(ClientContext); |
48 }; | 44 }; |
49 | 45 |
50 } // namespace remoting | 46 } // namespace remoting |
51 | 47 |
52 #endif // REMOTING_CLIENT_CLIENT_CONTEXT_H_ | 48 #endif // REMOTING_CLIENT_CLIENT_CONTEXT_H_ |
OLD | NEW |