summaryrefslogtreecommitdiffstats
path: root/remoting/host/chromoting_host.cc
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-16 17:23:53 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-16 17:23:53 +0000
commitce404cae8c35d9c39b328e2f7207b852f482a15f (patch)
tree99624ecd8daa98c28eb35323aa465ca8819fd480 /remoting/host/chromoting_host.cc
parente921967a10108d9751709ff4f35abd67b49103f8 (diff)
downloadchromium_src-ce404cae8c35d9c39b328e2f7207b852f482a15f.zip
chromium_src-ce404cae8c35d9c39b328e2f7207b852f482a15f.tar.gz
chromium_src-ce404cae8c35d9c39b328e2f7207b852f482a15f.tar.bz2
Making DesktopEnvironment a factory class used by ClientSession to create audio/video capturers and event executor for a pacticular desktop environment.
Other related changes: - AudioCapturer and VideoFrameCapturer are owned by AudioScheduler and VideoScheduler correspondingly. - Both AudioScheduler and VideoScheduler can now be stopped completely asynchronously. - AudioScheduler::SetEnabled() changed to Pause() to match the corresponding method provided by VideoScheduler. - ClientSession::Stop() is synchronous now. BUG=104544 Review URL: https://chromiumcodereview.appspot.com/11778049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177161 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/chromoting_host.cc')
-rw-r--r--remoting/host/chromoting_host.cc27
1 files changed, 13 insertions, 14 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 9216fb0..9ac490b 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -11,7 +11,7 @@
#include "build/build_config.h"
#include "remoting/base/constants.h"
#include "remoting/host/chromoting_host_context.h"
-#include "remoting/host/desktop_environment_factory.h"
+#include "remoting/host/desktop_environment.h"
#include "remoting/host/event_executor.h"
#include "remoting/host/host_config.h"
#include "remoting/protocol/connection_to_client.h"
@@ -60,17 +60,20 @@ ChromotingHost::ChromotingHost(
DesktopEnvironmentFactory* desktop_environment_factory,
scoped_ptr<protocol::SessionManager> session_manager,
scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> network_task_runner)
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner)
: desktop_environment_factory_(desktop_environment_factory),
session_manager_(session_manager.Pass()),
audio_task_runner_(audio_task_runner),
+ input_task_runner_(input_task_runner),
video_capture_task_runner_(video_capture_task_runner),
video_encode_task_runner_(video_encode_task_runner),
network_task_runner_(network_task_runner),
+ ui_task_runner_(ui_task_runner),
signal_strategy_(signal_strategy),
- clients_count_(0),
state_(kInitial),
protocol_config_(protocol::CandidateSessionConfig::CreateDefault()),
login_backoff_(&kDefaultBackoffPolicy),
@@ -140,7 +143,7 @@ void ChromotingHost::Shutdown(const base::Closure& shutdown_task) {
}
// Run the remaining shutdown tasks.
- if (state_ == kStopping && !clients_count_)
+ if (state_ == kStopping)
ShutdownFinish();
break;
@@ -241,8 +244,11 @@ void ChromotingHost::OnSessionClosed(ClientSession* client) {
OnClientDisconnected(client->client_jid()));
}
- client->Stop(base::Bind(&ChromotingHost::OnClientStopped, this));
+ client->Stop();
clients_.erase(it);
+
+ if (state_ == kStopping && clients_.empty())
+ ShutdownFinish();
}
void ChromotingHost::OnSessionSequenceNumber(ClientSession* session,
@@ -314,14 +320,15 @@ void ChromotingHost::OnIncomingSession(
scoped_refptr<ClientSession> client = new ClientSession(
this,
audio_task_runner_,
+ input_task_runner_,
video_capture_task_runner_,
video_encode_task_runner_,
network_task_runner_,
+ ui_task_runner_,
connection.Pass(),
desktop_environment_factory_,
max_session_duration_);
clients_.push_back(client);
- clients_count_++;
}
void ChromotingHost::set_protocol_config(
@@ -380,14 +387,6 @@ void ChromotingHost::SetUiStrings(const UiStrings& ui_strings) {
ui_strings_ = ui_strings;
}
-void ChromotingHost::OnClientStopped() {
- DCHECK(network_task_runner_->BelongsToCurrentThread());
-
- --clients_count_;
- if (state_ == kStopping && !clients_count_)
- ShutdownFinish();
-}
-
void ChromotingHost::ShutdownFinish() {
DCHECK(network_task_runner_->BelongsToCurrentThread());
DCHECK_EQ(state_, kStopping);