Index: remoting/host/it2me/it2me_host.cc |
diff --git a/remoting/host/it2me/it2me_host.cc b/remoting/host/it2me/it2me_host.cc |
index b9a17f8c9431b159fddbcd15a586eb438b315995..f5ad77f44f779a1d2c78834142de2d560d8848dc 100644 |
--- a/remoting/host/it2me/it2me_host.cc |
+++ b/remoting/host/it2me/it2me_host.cc |
@@ -6,7 +6,6 @@ |
#include "base/bind.h" |
#include "base/strings/string_util.h" |
-#include "base/synchronization/waitable_event.h" |
#include "base/threading/platform_thread.h" |
#include "net/socket/client_socket_factory.h" |
#include "remoting/base/auto_thread.h" |
@@ -36,7 +35,7 @@ const int kMaxLoginAttempts = 5; |
} // namespace |
It2MeHost::It2MeHost( |
- ChromotingHostContext* host_context, |
+ scoped_refptr<ChromotingHostContext> host_context, |
scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
base::WeakPtr<It2MeHost::Observer> observer, |
const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, |
@@ -257,13 +256,16 @@ void It2MeHost::ShutdownOnUiThread() { |
// Stop listening for policy updates. |
if (policy_watcher_.get()) { |
- base::WaitableEvent policy_watcher_stopped_(true, false); |
- policy_watcher_->StopWatching(&policy_watcher_stopped_); |
- policy_watcher_stopped_.Wait(); |
- policy_watcher_.reset(); |
+ policy_watcher_->StopWatching( |
+ base::Bind(&It2MeHost::OnPolicyWatcherShutdown, this)); |
+ return; |
} |
} |
+void It2MeHost::OnPolicyWatcherShutdown() { |
+ policy_watcher_.reset(); |
+} |
+ |
void It2MeHost::OnAccessDenied(const std::string& jid) { |
DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); |
@@ -464,13 +466,16 @@ It2MeHostFactory::It2MeHostFactory() {} |
It2MeHostFactory::~It2MeHostFactory() {} |
scoped_refptr<It2MeHost> It2MeHostFactory::CreateIt2MeHost( |
- ChromotingHostContext* context, |
+ scoped_refptr<ChromotingHostContext> context, |
scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
base::WeakPtr<It2MeHost::Observer> observer, |
const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, |
const std::string& directory_bot_jid) { |
- return new It2MeHost( |
- context, task_runner, observer, xmpp_server_config, directory_bot_jid); |
+ return new It2MeHost(context, |
+ task_runner, |
+ observer, |
+ xmpp_server_config, |
+ directory_bot_jid); |
} |
} // namespace remoting |