OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "remoting/host/chromoting_host_context.h" |
| 6 |
| 7 #include <string> |
| 8 |
| 9 #include "base/thread.h" |
| 10 #include "remoting/jingle_glue/jingle_thread.h" |
| 11 |
| 12 namespace remoting { |
| 13 |
| 14 ChromotingHostContext::ChromotingHostContext() |
| 15 : main_thread_("ChromotingMainThread"), |
| 16 capture_thread_("ChromotingCaptureThread"), |
| 17 encode_thread_("ChromotingEncodeThread") { |
| 18 } |
| 19 |
| 20 ChromotingHostContext::~ChromotingHostContext() { |
| 21 } |
| 22 |
| 23 void ChromotingHostContext::Start() { |
| 24 // Start all the threads. |
| 25 main_thread_.StartWithOptions( |
| 26 base::Thread::Options(MessageLoop::TYPE_UI, 0)); |
| 27 capture_thread_.Start(); |
| 28 encode_thread_.Start(); |
| 29 jingle_thread_.Start(); |
| 30 } |
| 31 |
| 32 void ChromotingHostContext::Stop() { |
| 33 // Stop all the threads. |
| 34 jingle_thread_.Stop(); |
| 35 encode_thread_.Stop(); |
| 36 capture_thread_.Stop(); |
| 37 main_thread_.Stop(); |
| 38 } |
| 39 |
| 40 JingleThread* ChromotingHostContext::jingle_thread() { |
| 41 return &jingle_thread_; |
| 42 } |
| 43 |
| 44 MessageLoop* ChromotingHostContext::main_message_loop() { |
| 45 return main_thread_.message_loop(); |
| 46 } |
| 47 |
| 48 MessageLoop* ChromotingHostContext::capture_message_loop() { |
| 49 return capture_thread_.message_loop(); |
| 50 } |
| 51 |
| 52 MessageLoop* ChromotingHostContext::encode_message_loop() { |
| 53 return encode_thread_.message_loop(); |
| 54 } |
| 55 |
| 56 } // namespace remoting |
OLD | NEW |