OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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* ui_message_loop) | 16 base::MessageLoopProxy* ui_message_loop) |
17 : main_thread_("ChromotingMainThread"), | 17 : main_thread_("ChromotingMainThread"), |
18 encode_thread_("ChromotingEncodeThread"), | 18 encode_thread_("ChromotingEncodeThread"), |
19 desktop_thread_("ChromotingDesktopThread"), | 19 desktop_thread_("ChromotingDesktopThread"), |
20 ui_message_loop_(ui_message_loop) { | 20 ui_message_loop_(ui_message_loop) { |
21 } | 21 } |
22 | 22 |
23 ChromotingHostContext::~ChromotingHostContext() { | 23 ChromotingHostContext::~ChromotingHostContext() { |
24 } | 24 } |
25 | 25 |
26 void ChromotingHostContext::Start() { | 26 bool ChromotingHostContext::Start() { |
27 // Start all the threads. | 27 // Start all the threads. |
28 main_thread_.Start(); | 28 return main_thread_.Start() && encode_thread_.Start() && |
29 encode_thread_.Start(); | 29 jingle_thread_.Start() && desktop_thread_.Start(); |
30 jingle_thread_.Start(); | |
31 desktop_thread_.Start(); | |
32 } | 30 } |
33 | 31 |
34 void ChromotingHostContext::Stop() { | 32 void ChromotingHostContext::Stop() { |
35 // Stop all the threads. | 33 // Stop all the threads. |
36 jingle_thread_.Stop(); | 34 jingle_thread_.Stop(); |
37 encode_thread_.Stop(); | 35 encode_thread_.Stop(); |
38 main_thread_.Stop(); | 36 main_thread_.Stop(); |
39 desktop_thread_.Stop(); | 37 desktop_thread_.Stop(); |
40 } | 38 } |
41 | 39 |
(...skipping 15 matching lines...) Expand all Loading... |
57 | 55 |
58 base::MessageLoopProxy* ChromotingHostContext::network_message_loop() { | 56 base::MessageLoopProxy* ChromotingHostContext::network_message_loop() { |
59 return jingle_thread_.message_loop_proxy(); | 57 return jingle_thread_.message_loop_proxy(); |
60 } | 58 } |
61 | 59 |
62 MessageLoop* ChromotingHostContext::desktop_message_loop() { | 60 MessageLoop* ChromotingHostContext::desktop_message_loop() { |
63 return desktop_thread_.message_loop(); | 61 return desktop_thread_.message_loop(); |
64 } | 62 } |
65 | 63 |
66 } // namespace remoting | 64 } // namespace remoting |
OLD | NEW |