diff options
author | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-02 21:26:39 +0000 |
---|---|---|
committer | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-02 21:26:39 +0000 |
commit | b592165f7de822d7bcaa3812ec11a4c4125d845a (patch) | |
tree | 20cf34d01683fbae5d0df04fedd1aed5bd9e8eb5 /remoting/host/plugin | |
parent | 3764dddb64111f17e929e76de2835a63088593b8 (diff) | |
download | chromium_src-b592165f7de822d7bcaa3812ec11a4c4125d845a.zip chromium_src-b592165f7de822d7bcaa3812ec11a4c4125d845a.tar.gz chromium_src-b592165f7de822d7bcaa3812ec11a4c4125d845a.tar.bz2 |
Fix ChromotingHost and DesktopEnvironmentFactory references to TaskRunners.
These classes previously referenced TaskRunners indirectly via a supplied
ChromotingHostContext, causing them to fail unexpectedly when trying to use the
TaskRunners after they had been detached from the ChromotingHostContext during
shutdown. This CL has them take their own references to the TaskRunners they
need.
This CL also renames the "desktop" TaskRunner to "input" TaskRunner, reflecting
its current purpose.
BUG=145856
Review URL: https://chromiumcodereview.appspot.com/11018004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159771 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/plugin')
-rw-r--r-- | remoting/host/plugin/host_script_object.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc index e2352a7..16be2b6 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(); |