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

Unified Diff: remoting/host/plugin/host_script_object.cc

Issue 11018004: Fix ChromotingHost and DesktopEnvironmentFactory references to TaskRunners. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows build. Created 8 years, 2 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/desktop_environment_factory.cc ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/plugin/host_script_object.cc
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc
index 2d441f3969fef2dab0ce6f9146acbb7df46a56a7..bedd57789c7fbfc14713706cb0144c8add66b55e 100644
--- a/remoting/host/plugin/host_script_object.cc
+++ b/remoting/host/plugin/host_script_object.cc
@@ -93,7 +93,6 @@ HostNPScriptObject::HostNPScriptObject(
np_thread_id_(base::PlatformThread::CurrentId()),
plugin_task_runner_(
new PluginThreadTaskRunner(plugin_thread_delegate)),
- desktop_environment_factory_(new DesktopEnvironmentFactory()),
failed_login_attempts_(0),
nat_traversal_enabled_(false),
policy_received_(false),
@@ -134,6 +133,7 @@ bool HostNPScriptObject::Init() {
DCHECK(plugin_task_runner_->BelongsToCurrentThread());
VLOG(2) << "Init";
+ // Create threads for the Chromoting host & desktop environment to use.
scoped_refptr<AutoThreadTaskRunner> auto_plugin_task_runner =
new AutoThreadTaskRunner(plugin_task_runner_,
base::Bind(&PluginThreadTaskRunner::Quit,
@@ -145,6 +145,11 @@ bool HostNPScriptObject::Init() {
return false;
}
+ // Create the desktop environment factory.
+ desktop_environment_factory_.reset(new DesktopEnvironmentFactory(
+ host_context_->input_task_runner(), host_context_->ui_task_runner()));
+
+ // Start monitoring configured policies.
policy_watcher_.reset(
policy_hack::PolicyWatcher::Create(host_context_->network_task_runner()));
policy_watcher_->StartWatching(
@@ -561,10 +566,13 @@ void HostNPScriptObject::FinishConnect(
// Create the host.
host_ = new ChromotingHost(
- host_context_.get(), signal_strategy_.get(),
+ signal_strategy_.get(),
desktop_environment_factory_.get(),
CreateHostSessionManager(network_settings,
- host_context_->url_request_context_getter()));
+ host_context_->url_request_context_getter()),
+ host_context_->capture_task_runner(),
+ host_context_->encode_task_runner(),
+ host_context_->network_task_runner());
host_->AddStatusObserver(this);
log_to_server_.reset(
new LogToServer(host_, ServerLogEntry::IT2ME, signal_strategy_.get()));
@@ -914,6 +922,9 @@ void HostNPScriptObject::OnShutdownFinished() {
// unregister it from this thread).
it2me_host_user_interface_.reset();
+ // Destroy the DesktopEnvironmentFactory, to free thread references.
+ desktop_environment_factory_.reset();
+
// Release the context's TaskRunner references for the threads, so they can
// exit when no objects need them.
host_context_->ReleaseTaskRunners();
« no previous file with comments | « remoting/host/desktop_environment_factory.cc ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698