Chromium Code Reviews| Index: remoting/host/it2me_host_user_interface.cc |
| diff --git a/remoting/host/it2me_host_user_interface.cc b/remoting/host/it2me_host_user_interface.cc |
| index 6a150b31d95003372d7d03f16ad26ef3fe38cec7..4b898a9118c16803fb8642c84167dc8bcef1b2c4 100644 |
| --- a/remoting/host/it2me_host_user_interface.cc |
| +++ b/remoting/host/it2me_host_user_interface.cc |
| @@ -32,7 +32,8 @@ It2MeHostUserInterface::It2MeHostUserInterface(ChromotingHost* host, |
| : host_(host), |
| context_(context), |
| is_monitoring_local_inputs_(false), |
| - ui_thread_proxy_(context->ui_message_loop()) { |
| + ui_thread_proxy_(context->ui_message_loop()), |
| + callback_complete_(false, false) { |
| } |
| It2MeHostUserInterface::~It2MeHostUserInterface() { |
| @@ -66,16 +67,19 @@ void It2MeHostUserInterface::OnClientAuthenticated(const std::string& jid) { |
| std::string username = jid.substr(0, jid.find('/')); |
| ui_thread_proxy_.PostTask(FROM_HERE, base::Bind( |
| - &It2MeHostUserInterface::ProcessOnConnect, base::Unretained(this), |
| + &It2MeHostUserInterface::ProcessOnClientAuthenticated, |
| + base::Unretained(this), |
| username)); |
| + CHECK(callback_complete_.TimedWait(base::TimeDelta::FromSeconds(10))); |
| } |
| void It2MeHostUserInterface::OnClientDisconnected(const std::string& jid) { |
| if (jid == authenticated_jid_) { |
| authenticated_jid_.clear(); |
| ui_thread_proxy_.PostTask(FROM_HERE, base::Bind( |
| - &It2MeHostUserInterface::ProcessOnLastDisconnect, |
| + &It2MeHostUserInterface::ProcessOnClientDisconnected, |
| base::Unretained(this))); |
| + CHECK(callback_complete_.TimedWait(base::TimeDelta::FromSeconds(10))); |
|
Sergey Ulanov
2011/12/01 20:35:24
I don't think that blocking network thread on the
|
| } |
| } |
| @@ -96,33 +100,24 @@ void It2MeHostUserInterface::Shutdown() { |
| ui_thread_proxy_.Detach(); |
| } |
| -void It2MeHostUserInterface::OnConnect(const std::string& username) { |
| - ui_thread_proxy_.PostTask(FROM_HERE, base::Bind( |
| - &It2MeHostUserInterface::ProcessOnConnect, base::Unretained(this), |
| - username)); |
| -} |
| - |
| -void It2MeHostUserInterface::OnLastDisconnect() { |
| - ui_thread_proxy_.PostTask(FROM_HERE, base::Bind( |
| - &It2MeHostUserInterface::ProcessOnLastDisconnect, |
| - base::Unretained(this))); |
| -} |
| - |
| -void It2MeHostUserInterface::ProcessOnConnect(const std::string& username) { |
| +void It2MeHostUserInterface::ProcessOnClientAuthenticated( |
| + const std::string& username) { |
| DCHECK(context_->ui_message_loop()->BelongsToCurrentThread()); |
| MonitorLocalInputs(true); |
| ShowDisconnectWindow(true, username); |
| StartContinueWindowTimer(true); |
| + callback_complete_.Signal(); |
| } |
| -void It2MeHostUserInterface::ProcessOnLastDisconnect() { |
| +void It2MeHostUserInterface::ProcessOnClientDisconnected() { |
| DCHECK(context_->ui_message_loop()->BelongsToCurrentThread()); |
| MonitorLocalInputs(false); |
| ShowDisconnectWindow(false, std::string()); |
| ShowContinueWindow(false); |
| StartContinueWindowTimer(false); |
| + callback_complete_.Signal(); |
| } |
| void It2MeHostUserInterface::MonitorLocalInputs(bool enable) { |