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_CHROMOTING_HOST_CONTEXT_H_ | 5 #ifndef REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_ |
6 #define REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_ | 6 #define REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/threading/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
13 #include "remoting/jingle_glue/jingle_thread.h" | 13 #include "remoting/jingle_glue/jingle_thread.h" |
14 | 14 |
15 namespace remoting { | 15 namespace remoting { |
16 | 16 |
17 // A class that manages threads and running context for the chromoting host | 17 // A class that manages threads and running context for the chromoting host |
18 // process. This class is virtual only for testing purposes (see below). | 18 // process. This class is virtual only for testing purposes (see below). |
19 class ChromotingHostContext { | 19 class ChromotingHostContext { |
20 public: | 20 public: |
21 // Create a context. | 21 // Create a context. |
22 ChromotingHostContext(base::MessageLoopProxy* io_message_loop, | 22 ChromotingHostContext(base::MessageLoopProxy* ui_message_loop); |
23 base::MessageLoopProxy* ui_message_loop); | |
24 virtual ~ChromotingHostContext(); | 23 virtual ~ChromotingHostContext(); |
25 | 24 |
26 // TODO(ajwong): Move the Start method out of this class. Then | 25 // TODO(ajwong): Move the Start method out of this class. Then |
27 // create a static factory for construction, and destruction. We | 26 // create a static factory for construction, and destruction. We |
28 // should be able to remove the need for virtual functions below | 27 // should be able to remove the need for virtual functions below |
29 // with that design, while preserving the relative simplicity of | 28 // with that design, while preserving the relative simplicity of |
30 // this API. | 29 // this API. |
31 virtual bool Start(); | 30 virtual bool Start(); |
32 | 31 |
33 virtual JingleThread* jingle_thread(); | 32 virtual JingleThread* jingle_thread(); |
34 | 33 |
35 virtual base::MessageLoopProxy* io_message_loop(); | |
36 virtual base::MessageLoopProxy* ui_message_loop(); | |
37 virtual MessageLoop* main_message_loop(); | 34 virtual MessageLoop* main_message_loop(); |
38 virtual MessageLoop* encode_message_loop(); | 35 virtual MessageLoop* encode_message_loop(); |
39 virtual base::MessageLoopProxy* network_message_loop(); | 36 virtual base::MessageLoopProxy* network_message_loop(); |
40 virtual MessageLoop* desktop_message_loop(); | 37 virtual MessageLoop* desktop_message_loop(); |
38 virtual base::MessageLoopProxy* ui_message_loop(); | |
Wez
2012/04/17 01:14:59
Why have you moved this?
Sergey Ulanov
2012/04/17 01:28:09
So that the main message loop is the first in the
| |
39 virtual MessageLoop* file_message_loop(); | |
41 | 40 |
42 private: | 41 private: |
43 FRIEND_TEST_ALL_PREFIXES(ChromotingHostContextTest, StartAndStop); | 42 FRIEND_TEST_ALL_PREFIXES(ChromotingHostContextTest, StartAndStop); |
44 | 43 |
45 // A thread that hosts all network operations. | 44 // A thread that hosts all network operations. |
46 JingleThread jingle_thread_; | 45 JingleThread jingle_thread_; |
47 | 46 |
48 // A thread that hosts ChromotingHost and performs rate control. | 47 // TODO(sergeyu): The "main" thread is used just by the |
48 // capturer. Should it be renamed to capturer_thread? | |
Wez
2012/04/17 01:14:59
I agree that the name is unhelpful but let's discu
Sergey Ulanov
2012/04/17 01:28:09
Changed the comment to "Consider renaming it."
| |
49 base::Thread main_thread_; | 49 base::Thread main_thread_; |
50 | 50 |
51 // A thread that hosts all encode operations. | 51 // A thread that hosts all encode operations. |
52 base::Thread encode_thread_; | 52 base::Thread encode_thread_; |
53 | 53 |
54 // A thread that hosts desktop integration (capture, input injection, etc) | 54 // A thread that hosts desktop integration (capture, input injection, etc) |
55 // This is NOT a Chrome-style UI thread. | 55 // This is NOT a Chrome-style UI thread. |
56 base::Thread desktop_thread_; | 56 base::Thread desktop_thread_; |
57 | 57 |
58 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 58 // Thread for blocking IO operations. |
59 base::Thread file_thread_; | |
60 | |
59 scoped_refptr<base::MessageLoopProxy> ui_message_loop_; | 61 scoped_refptr<base::MessageLoopProxy> ui_message_loop_; |
60 | 62 |
61 DISALLOW_COPY_AND_ASSIGN(ChromotingHostContext); | 63 DISALLOW_COPY_AND_ASSIGN(ChromotingHostContext); |
62 }; | 64 }; |
63 | 65 |
64 } // namespace remoting | 66 } // namespace remoting |
65 | 67 |
66 #endif // REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_ | 68 #endif // REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_ |
OLD | NEW |