| Index: remoting/host/plugin/host_script_object.cc
|
| ===================================================================
|
| --- remoting/host/plugin/host_script_object.cc (revision 170590)
|
| +++ remoting/host/plugin/host_script_object.cc (working copy)
|
| @@ -15,8 +15,8 @@
|
| #include "base/utf_string_conversions.h"
|
| #include "base/values.h"
|
| #include "net/base/net_util.h"
|
| +#include "remoting/base/auto_thread_task_runner.h"
|
| #include "remoting/base/auth_token_util.h"
|
| -#include "remoting/base/auto_thread.h"
|
| #include "remoting/host/chromoting_host.h"
|
| #include "remoting/host/chromoting_host_context.h"
|
| #include "remoting/host/desktop_environment_factory.h"
|
| @@ -666,13 +666,12 @@
|
| am_currently_logging_(false),
|
| state_(kDisconnected),
|
| daemon_controller_(DaemonController::Create()),
|
| + worker_thread_("RemotingHostPlugin"),
|
| ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
|
| weak_ptr_(weak_factory_.GetWeakPtr()) {
|
| DCHECK(plugin_task_runner_->BelongsToCurrentThread());
|
|
|
| - // Create worker thread for encryption key generation.
|
| - worker_thread_ = AutoThread::Create("ChromotingWorkerThread",
|
| - plugin_task_runner_);
|
| + worker_thread_.Start();
|
| }
|
|
|
| HostNPScriptObject::~HostNPScriptObject() {
|
| @@ -685,6 +684,9 @@
|
| it2me_impl_->Disconnect();
|
| it2me_impl_ = NULL;
|
| }
|
| +
|
| + // Stop the worker thread.
|
| + worker_thread_.Stop();
|
| }
|
|
|
| bool HostNPScriptObject::HasMethod(const std::string& method_name) {
|
| @@ -953,9 +955,9 @@
|
| }
|
|
|
| // Create threads for the Chromoting host & desktop environment to use.
|
| - scoped_ptr<ChromotingHostContext> host_context =
|
| - ChromotingHostContext::Create(plugin_task_runner_);
|
| - if (host_context) {
|
| + scoped_ptr<ChromotingHostContext> host_context(
|
| + new ChromotingHostContext(plugin_task_runner_));
|
| + if (!host_context->Start()) {
|
| SetException("connect: failed to start threads");
|
| return false;
|
| }
|
| @@ -1058,7 +1060,7 @@
|
| // TODO(wez): HostNPScriptObject needn't be touched on worker
|
| // thread, so make DoGenerateKeyPair static and pass it a callback
|
| // to run (crbug.com/156257).
|
| - worker_thread_->PostTask(
|
| + worker_thread_.message_loop_proxy()->PostTask(
|
| FROM_HERE, base::Bind(&HostNPScriptObject::DoGenerateKeyPair,
|
| base::Unretained(this), callback_obj));
|
| return true;
|
|
|