Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Unified Diff: remoting/host/chromoting_host.cc

Issue 11778049: Making DesktopEnvironment a factory class used by ClientSession to create audio/video capturers and… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/chromoting_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/chromoting_host.cc
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 9216fb0598df98e904c69676dd877686885b48b3..9ac490b1882355466eaaee6516a039972526d922 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);
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/chromoting_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698