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 #include "remoting/host/chromoting_host_context.h" | 5 #include "remoting/host/chromoting_host_context.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
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 ChromotingHostContext::ChromotingHostContext( | 15 ChromotingHostContext::ChromotingHostContext( |
| 16 base::MessageLoopProxy* io_message_loop, |
16 base::MessageLoopProxy* ui_message_loop) | 17 base::MessageLoopProxy* ui_message_loop) |
17 : main_thread_("ChromotingMainThread"), | 18 : main_thread_("ChromotingMainThread"), |
18 encode_thread_("ChromotingEncodeThread"), | 19 encode_thread_("ChromotingEncodeThread"), |
19 desktop_thread_("ChromotingDesktopThread"), | 20 desktop_thread_("ChromotingDesktopThread"), |
| 21 io_message_loop_(io_message_loop), |
20 ui_message_loop_(ui_message_loop) { | 22 ui_message_loop_(ui_message_loop) { |
21 } | 23 } |
22 | 24 |
23 ChromotingHostContext::~ChromotingHostContext() { | 25 ChromotingHostContext::~ChromotingHostContext() { |
24 } | 26 } |
25 | 27 |
26 bool ChromotingHostContext::Start() { | 28 bool ChromotingHostContext::Start() { |
27 // Start all the threads. | 29 // Start all the threads. |
28 return main_thread_.Start() && encode_thread_.Start() && | 30 return main_thread_.Start() && encode_thread_.Start() && |
29 jingle_thread_.Start() && desktop_thread_.Start(); | 31 jingle_thread_.Start() && desktop_thread_.Start(); |
30 } | 32 } |
31 | 33 |
32 JingleThread* ChromotingHostContext::jingle_thread() { | 34 JingleThread* ChromotingHostContext::jingle_thread() { |
33 return &jingle_thread_; | 35 return &jingle_thread_; |
34 } | 36 } |
35 | 37 |
| 38 base::MessageLoopProxy* ChromotingHostContext::io_message_loop() { |
| 39 return io_message_loop_; |
| 40 } |
| 41 |
36 base::MessageLoopProxy* ChromotingHostContext::ui_message_loop() { | 42 base::MessageLoopProxy* ChromotingHostContext::ui_message_loop() { |
37 return ui_message_loop_; | 43 return ui_message_loop_; |
38 } | 44 } |
39 | 45 |
40 MessageLoop* ChromotingHostContext::main_message_loop() { | 46 MessageLoop* ChromotingHostContext::main_message_loop() { |
41 return main_thread_.message_loop(); | 47 return main_thread_.message_loop(); |
42 } | 48 } |
43 | 49 |
44 MessageLoop* ChromotingHostContext::encode_message_loop() { | 50 MessageLoop* ChromotingHostContext::encode_message_loop() { |
45 return encode_thread_.message_loop(); | 51 return encode_thread_.message_loop(); |
46 } | 52 } |
47 | 53 |
48 base::MessageLoopProxy* ChromotingHostContext::network_message_loop() { | 54 base::MessageLoopProxy* ChromotingHostContext::network_message_loop() { |
49 return jingle_thread_.message_loop_proxy(); | 55 return jingle_thread_.message_loop_proxy(); |
50 } | 56 } |
51 | 57 |
52 MessageLoop* ChromotingHostContext::desktop_message_loop() { | 58 MessageLoop* ChromotingHostContext::desktop_message_loop() { |
53 return desktop_thread_.message_loop(); | 59 return desktop_thread_.message_loop(); |
54 } | 60 } |
55 | 61 |
56 } // namespace remoting | 62 } // namespace remoting |
OLD | NEW |