Chromium Code Reviews| Index: remoting/client/client_context.cc |
| diff --git a/remoting/client/client_context.cc b/remoting/client/client_context.cc |
| index ca12714cf6dc8c2877ff25e9b6329ec5c0eaf79e..908602e864b281ad1773257d6f7ff9426ad00104 100644 |
| --- a/remoting/client/client_context.cc |
| +++ b/remoting/client/client_context.cc |
| @@ -4,8 +4,21 @@ |
| #include "remoting/client/client_context.h" |
| +#include "base/bind.h" |
| +#include "base/synchronization/waitable_event.h" |
| + |
| namespace remoting { |
| +namespace { |
|
awong
2011/08/15 20:17:53
add newline.
Sergey Ulanov
2011/08/15 22:39:52
This code is gone now.
|
| +void InitializeMessageLoopProxy( |
| + scoped_refptr<base::MessageLoopProxy>* proxy, |
| + base::WaitableEvent* done) { |
| + *proxy = base::MessageLoopProxy::CreateForCurrentThread(); |
| + done->Signal(); |
| +} |
| + |
| +} // namespace |
| + |
| ClientContext::ClientContext() |
| : main_thread_("ChromotingClientMainThread"), |
| decode_thread_("ChromotingClientDecodeThread"), |
| @@ -21,6 +34,12 @@ void ClientContext::Start() { |
| decode_thread_.Start(); |
| network_thread_.StartWithOptions( |
| base::Thread::Options(MessageLoop::TYPE_IO, 0)); |
| + |
| + // Initialize |network_message_loop_| on the network thread. |
| + base::WaitableEvent proxy_event(true, false); |
| + network_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( |
| + &InitializeMessageLoopProxy, &network_message_loop_, &proxy_event)); |
| + proxy_event.Wait(); |
| } |
| void ClientContext::Stop() { |
| @@ -39,7 +58,7 @@ MessageLoop* ClientContext::decode_message_loop() { |
| } |
| base::MessageLoopProxy* ClientContext::network_message_loop() { |
| - return network_thread_.message_loop_proxy(); |
| + return network_message_loop_; |
| } |
| } // namespace remoting |