Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(562)

Side by Side Diff: remoting/client/client_context.cc

Issue 7562016: Future proof against things like http://crbug.com/91521 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: respond to awong's issues Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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> 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"
10 #include "remoting/jingle_glue/jingle_thread.h" 11 #include "remoting/jingle_glue/jingle_thread.h"
11 12
12 namespace remoting { 13 namespace remoting {
13 14
14 ClientContext::ClientContext() 15 ClientContext::ClientContext()
15 : main_thread_("ChromotingClientMainThread"), 16 : main_thread_("ChromotingClientMainThread"),
16 decode_thread_("ChromotingClientDecodeThread") { 17 decode_thread_("ChromotingClientDecodeThread"),
18 started_(false) {
17 } 19 }
18 20
19 ClientContext::~ClientContext() { 21 ClientContext::~ClientContext() {
20 } 22 }
21 23
22 void ClientContext::Start() { 24 void ClientContext::Start() {
23 // Start all the threads. 25 // Start all the threads.
26 DCHECK(CurrentlyOnPluginThread());
24 main_thread_.Start(); 27 main_thread_.Start();
25 decode_thread_.Start(); 28 decode_thread_.Start();
26 jingle_thread_.Start(); 29 jingle_thread_.Start();
30 started_ = true;
27 } 31 }
28 32
29 void ClientContext::Stop() { 33 void ClientContext::Stop() {
30 // Stop all the threads. 34 DCHECK(CurrentlyOnPluginThread());
31 jingle_thread_.Stop(); 35 if (started_) {
32 decode_thread_.Stop(); 36 // Stop all the threads.
33 main_thread_.Stop(); 37 jingle_thread_.Stop();
38 decode_thread_.Stop();
39 main_thread_.Stop();
40 started_ = false;
41 }
34 } 42 }
35 43
36 JingleThread* ClientContext::jingle_thread() { 44 JingleThread* ClientContext::jingle_thread() {
37 return &jingle_thread_; 45 return &jingle_thread_;
38 } 46 }
39 47
40 MessageLoop* ClientContext::main_message_loop() { 48 MessageLoop* ClientContext::main_message_loop() {
41 return main_thread_.message_loop(); 49 return main_thread_.message_loop();
42 } 50 }
43 51
44 MessageLoop* ClientContext::decode_message_loop() { 52 MessageLoop* ClientContext::decode_message_loop() {
45 return decode_thread_.message_loop(); 53 return decode_thread_.message_loop();
46 } 54 }
47 55
48 MessageLoop* ClientContext::network_message_loop() { 56 MessageLoop* ClientContext::network_message_loop() {
49 return jingle_thread_.message_loop(); 57 return jingle_thread_.message_loop();
50 } 58 }
51 59
52 } // namespace remoting 60 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698