| OLD | NEW |
| 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 #include "remoting/client/client_context.h" | 5 #include "remoting/client/client_context.h" |
| 6 | 6 |
| 7 #include <string> | |
| 8 | |
| 9 #include "base/threading/thread.h" | |
| 10 #include "remoting/jingle_glue/jingle_thread.h" | |
| 11 | |
| 12 namespace remoting { | 7 namespace remoting { |
| 13 | 8 |
| 14 ClientContext::ClientContext() | 9 ClientContext::ClientContext() |
| 15 : main_thread_("ChromotingClientMainThread"), | 10 : main_thread_("ChromotingClientMainThread"), |
| 16 decode_thread_("ChromotingClientDecodeThread") { | 11 decode_thread_("ChromotingClientDecodeThread"), |
| 12 network_thread_("ChromotingClientNetworkThread") { |
| 17 } | 13 } |
| 18 | 14 |
| 19 ClientContext::~ClientContext() { | 15 ClientContext::~ClientContext() { |
| 20 } | 16 } |
| 21 | 17 |
| 22 void ClientContext::Start() { | 18 void ClientContext::Start() { |
| 23 // Start all the threads. | 19 // Start all the threads. |
| 24 main_thread_.Start(); | 20 main_thread_.Start(); |
| 25 decode_thread_.Start(); | 21 decode_thread_.Start(); |
| 26 jingle_thread_.Start(); | 22 network_thread_.StartWithOptions( |
| 23 base::Thread::Options(MessageLoop::TYPE_IO, 0)); |
| 27 } | 24 } |
| 28 | 25 |
| 29 void ClientContext::Stop() { | 26 void ClientContext::Stop() { |
| 30 // Stop all the threads. | 27 // Stop all the threads. |
| 31 jingle_thread_.Stop(); | 28 network_thread_.Stop(); |
| 32 decode_thread_.Stop(); | 29 decode_thread_.Stop(); |
| 33 main_thread_.Stop(); | 30 main_thread_.Stop(); |
| 34 } | 31 } |
| 35 | 32 |
| 36 JingleThread* ClientContext::jingle_thread() { | |
| 37 return &jingle_thread_; | |
| 38 } | |
| 39 | |
| 40 MessageLoop* ClientContext::main_message_loop() { | 33 MessageLoop* ClientContext::main_message_loop() { |
| 41 return main_thread_.message_loop(); | 34 return main_thread_.message_loop(); |
| 42 } | 35 } |
| 43 | 36 |
| 44 MessageLoop* ClientContext::decode_message_loop() { | 37 MessageLoop* ClientContext::decode_message_loop() { |
| 45 return decode_thread_.message_loop(); | 38 return decode_thread_.message_loop(); |
| 46 } | 39 } |
| 47 | 40 |
| 48 MessageLoop* ClientContext::network_message_loop() { | 41 MessageLoop* ClientContext::network_message_loop() { |
| 49 return jingle_thread_.message_loop(); | 42 return network_thread_.message_loop(); |
| 50 } | 43 } |
| 51 | 44 |
| 52 } // namespace remoting | 45 } // namespace remoting |
| OLD | NEW |