summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-25 22:23:44 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-25 22:23:44 +0000
commit875a5dee67aab7a1f0c6d212517f04e026bdabf5 (patch)
tree3b162e88893054006a92111fdc56fa47c146fa02 /remoting
parentfd56eb74590b02848622598ce79fd6b595fcbc96 (diff)
downloadchromium_src-875a5dee67aab7a1f0c6d212517f04e026bdabf5.zip
chromium_src-875a5dee67aab7a1f0c6d212517f04e026bdabf5.tar.gz
chromium_src-875a5dee67aab7a1f0c6d212517f04e026bdabf5.tar.bz2
Don't restart the host to disconnect clients
Currently the host is restarted when user clicks Disconnect button on the connection dialog. This isn't necessary - clients can be disconnected without restarting the host. Review URL: https://chromiumcodereview.appspot.com/10455008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139133 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/chromoting_host.cc14
-rw-r--r--remoting/host/chromoting_host.h8
-rw-r--r--remoting/host/remoting_me2me_host.cc12
3 files changed, 26 insertions, 8 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 5071400..e091ca7 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -373,6 +373,20 @@ void ChromotingHost::PauseSession(bool pause) {
}
}
+void ChromotingHost::DisconnectAllClients() {
+ if (!context_->network_message_loop()->BelongsToCurrentThread()) {
+ context_->network_message_loop()->PostTask(
+ FROM_HERE, base::Bind(&ChromotingHost::DisconnectAllClients, this));
+ return;
+ }
+
+ while (!clients_.empty()) {
+ size_t size = clients_.size();
+ clients_.front()->Disconnect();
+ CHECK_EQ(clients_.size(), size - 1);
+ }
+}
+
void ChromotingHost::SetUiStrings(const UiStrings& ui_strings) {
DCHECK(context_->network_message_loop()->BelongsToCurrentThread());
DCHECK_EQ(state_, kInitial);
diff --git a/remoting/host/chromoting_host.h b/remoting/host/chromoting_host.h
index 0c88bfb..fabd441 100644
--- a/remoting/host/chromoting_host.h
+++ b/remoting/host/chromoting_host.h
@@ -133,9 +133,15 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>,
void LocalMouseMoved(const SkIPoint& new_pos);
// Pause or unpause the session. While the session is paused, remote input
- // is ignored.
+ // is ignored. Can be called from any thread.
void PauseSession(bool pause);
+ // Disconnects all active clients. Clients are disconnected
+ // asynchronously when this method is called on a thread other than
+ // the network thread. Potentically this may cause disconnection of
+ // clients that were not connected when this method is called.
+ void DisconnectAllClients();
+
const UiStrings& ui_strings() { return ui_strings_; }
// Set localized strings. Must be called before host is started.
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index 2045347..7564f4a 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -394,8 +394,8 @@ class HostProcess
#if defined(OS_MACOSX) || defined(OS_WIN)
host_user_interface_->Start(
- host_,
- base::Bind(&HostProcess::OnRestartHostRequest, base::Unretained(this)));
+ host_, base::Bind(&HostProcess::OnDisconnectRequested,
+ base::Unretained(this)));
#endif
host_->Start();
@@ -407,14 +407,12 @@ class HostProcess
Shutdown(kInvalidOauthCredentialsExitCode);
}
- // Invoked from when the user uses the Disconnect windows to terminate
+ // Invoked when the user uses the Disconnect windows to terminate
// the sessions.
- void OnRestartHostRequest() {
+ void OnDisconnectRequested() {
DCHECK(message_loop_.message_loop_proxy()->BelongsToCurrentThread());
- context_->network_message_loop()->PostTask(
- FROM_HERE,
- base::Bind(&HostProcess::RestartHost, base::Unretained(this)));
+ host_->DisconnectAllClients();
}
void RestartHost() {