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

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

Issue 7635030: Add PluginMessageLoopProxy and use it for Host plugin UI thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix clang 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
« no previous file with comments | « remoting/client/client_context.h ('k') | remoting/host/chromoting_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/bind.h"
8 #include "base/synchronization/waitable_event.h"
9
7 namespace remoting { 10 namespace remoting {
8 11
12 namespace {
awong 2011/08/15 20:17:53 add newline.
Sergey Ulanov 2011/08/15 22:39:52 This code is gone now.
13 void InitializeMessageLoopProxy(
14 scoped_refptr<base::MessageLoopProxy>* proxy,
15 base::WaitableEvent* done) {
16 *proxy = base::MessageLoopProxy::CreateForCurrentThread();
17 done->Signal();
18 }
19
20 } // namespace
21
9 ClientContext::ClientContext() 22 ClientContext::ClientContext()
10 : main_thread_("ChromotingClientMainThread"), 23 : main_thread_("ChromotingClientMainThread"),
11 decode_thread_("ChromotingClientDecodeThread"), 24 decode_thread_("ChromotingClientDecodeThread"),
12 network_thread_("ChromotingClientNetworkThread") { 25 network_thread_("ChromotingClientNetworkThread") {
13 } 26 }
14 27
15 ClientContext::~ClientContext() { 28 ClientContext::~ClientContext() {
16 } 29 }
17 30
18 void ClientContext::Start() { 31 void ClientContext::Start() {
19 // Start all the threads. 32 // Start all the threads.
20 main_thread_.Start(); 33 main_thread_.Start();
21 decode_thread_.Start(); 34 decode_thread_.Start();
22 network_thread_.StartWithOptions( 35 network_thread_.StartWithOptions(
23 base::Thread::Options(MessageLoop::TYPE_IO, 0)); 36 base::Thread::Options(MessageLoop::TYPE_IO, 0));
37
38 // Initialize |network_message_loop_| on the network thread.
39 base::WaitableEvent proxy_event(true, false);
40 network_thread_.message_loop()->PostTask(FROM_HERE, base::Bind(
41 &InitializeMessageLoopProxy, &network_message_loop_, &proxy_event));
42 proxy_event.Wait();
24 } 43 }
25 44
26 void ClientContext::Stop() { 45 void ClientContext::Stop() {
27 // Stop all the threads. 46 // Stop all the threads.
28 network_thread_.Stop(); 47 network_thread_.Stop();
29 decode_thread_.Stop(); 48 decode_thread_.Stop();
30 main_thread_.Stop(); 49 main_thread_.Stop();
31 } 50 }
32 51
33 MessageLoop* ClientContext::main_message_loop() { 52 MessageLoop* ClientContext::main_message_loop() {
34 return main_thread_.message_loop(); 53 return main_thread_.message_loop();
35 } 54 }
36 55
37 MessageLoop* ClientContext::decode_message_loop() { 56 MessageLoop* ClientContext::decode_message_loop() {
38 return decode_thread_.message_loop(); 57 return decode_thread_.message_loop();
39 } 58 }
40 59
41 base::MessageLoopProxy* ClientContext::network_message_loop() { 60 base::MessageLoopProxy* ClientContext::network_message_loop() {
42 return network_thread_.message_loop_proxy(); 61 return network_message_loop_;
43 } 62 }
44 63
45 } // namespace remoting 64 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/client_context.h ('k') | remoting/host/chromoting_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698