diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-24 21:51:42 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-24 21:51:42 +0000 |
commit | 9c910e4187919cbb2d0dccdb8e720de869dabd2f (patch) | |
tree | 8791c509540b91971d63d6a22fa166de140d5a8c /remoting/client/chromoting_client.cc | |
parent | 5ee0a182a58cf59c24ccd485a0804e3f327ef412 (diff) | |
download | chromium_src-9c910e4187919cbb2d0dccdb8e720de869dabd2f.zip chromium_src-9c910e4187919cbb2d0dccdb8e720de869dabd2f.tar.gz chromium_src-9c910e4187919cbb2d0dccdb8e720de869dabd2f.tar.bz2 |
Cleanup client shutdown sequence.
BUG=None
TEST=Client doesn't crash when reloading the tab.
Review URL: http://codereview.chromium.org/7241016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90443 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client/chromoting_client.cc')
-rw-r--r-- | remoting/client/chromoting_client.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/remoting/client/chromoting_client.cc b/remoting/client/chromoting_client.cc index 8161089..d7eee8e 100644 --- a/remoting/client/chromoting_client.cc +++ b/remoting/client/chromoting_client.cc @@ -4,6 +4,7 @@ #include "remoting/client/chromoting_client.h" +#include "base/bind.h" #include "base/message_loop.h" #include "remoting/base/tracer.h" #include "remoting/client/chromoting_view.h" @@ -57,17 +58,22 @@ void ChromotingClient::Start(scoped_refptr<XmppProxy> xmpp_proxy) { } } -void ChromotingClient::Stop() { +void ChromotingClient::Stop(const base::Closure& shutdown_task) { if (message_loop() != MessageLoop::current()) { message_loop()->PostTask( - FROM_HERE, - NewRunnableMethod(this, &ChromotingClient::Stop)); + FROM_HERE, base::Bind(&ChromotingClient::Stop, + base::Unretained(this), shutdown_task)); return; } - connection_->Disconnect(); + connection_->Disconnect(base::Bind(&ChromotingClient::OnDisconnected, + base::Unretained(this), shutdown_task)); +} +void ChromotingClient::OnDisconnected(const base::Closure& shutdown_task) { view_->TearDown(); + + shutdown_task.Run(); } void ChromotingClient::ClientDone() { |