OLD | NEW |
1 // Copyright (c) 2011 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> | 7 #include <string> |
8 | 8 |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "remoting/client/plugin/pepper_util.h" | |
11 #include "remoting/jingle_glue/jingle_thread.h" | 10 #include "remoting/jingle_glue/jingle_thread.h" |
12 | 11 |
13 namespace remoting { | 12 namespace remoting { |
14 | 13 |
15 ClientContext::ClientContext() | 14 ClientContext::ClientContext() |
16 : main_thread_("ChromotingClientMainThread"), | 15 : main_thread_("ChromotingClientMainThread"), |
17 decode_thread_("ChromotingClientDecodeThread"), | 16 decode_thread_("ChromotingClientDecodeThread") { |
18 started_(false) { | |
19 } | 17 } |
20 | 18 |
21 ClientContext::~ClientContext() { | 19 ClientContext::~ClientContext() { |
22 } | 20 } |
23 | 21 |
24 void ClientContext::Start() { | 22 void ClientContext::Start() { |
25 // Start all the threads. | 23 // Start all the threads. |
26 DCHECK(CurrentlyOnPluginThread()); | |
27 main_thread_.Start(); | 24 main_thread_.Start(); |
28 decode_thread_.Start(); | 25 decode_thread_.Start(); |
29 jingle_thread_.Start(); | 26 jingle_thread_.Start(); |
30 started_ = true; | |
31 } | 27 } |
32 | 28 |
33 void ClientContext::Stop() { | 29 void ClientContext::Stop() { |
34 DCHECK(CurrentlyOnPluginThread()); | 30 // Stop all the threads. |
35 if (started_) { | 31 jingle_thread_.Stop(); |
36 // Stop all the threads. | 32 decode_thread_.Stop(); |
37 jingle_thread_.Stop(); | 33 main_thread_.Stop(); |
38 decode_thread_.Stop(); | |
39 main_thread_.Stop(); | |
40 started_ = false; | |
41 } | |
42 } | 34 } |
43 | 35 |
44 JingleThread* ClientContext::jingle_thread() { | 36 JingleThread* ClientContext::jingle_thread() { |
45 return &jingle_thread_; | 37 return &jingle_thread_; |
46 } | 38 } |
47 | 39 |
48 MessageLoop* ClientContext::main_message_loop() { | 40 MessageLoop* ClientContext::main_message_loop() { |
49 return main_thread_.message_loop(); | 41 return main_thread_.message_loop(); |
50 } | 42 } |
51 | 43 |
52 MessageLoop* ClientContext::decode_message_loop() { | 44 MessageLoop* ClientContext::decode_message_loop() { |
53 return decode_thread_.message_loop(); | 45 return decode_thread_.message_loop(); |
54 } | 46 } |
55 | 47 |
56 MessageLoop* ClientContext::network_message_loop() { | 48 MessageLoop* ClientContext::network_message_loop() { |
57 return jingle_thread_.message_loop(); | 49 return jingle_thread_.message_loop(); |
58 } | 50 } |
59 | 51 |
60 } // namespace remoting | 52 } // namespace remoting |
OLD | NEW |