Chromium Code Reviews| Index: remoting/host/chromoting_host_context.cc |
| diff --git a/remoting/host/chromoting_host_context.cc b/remoting/host/chromoting_host_context.cc |
| index 480de732922a9282de5dac6a984b884150f6f2ec..fac4b3fd0dd5f5e01414cdcf6f94ad727ef833ca 100644 |
| --- a/remoting/host/chromoting_host_context.cc |
| +++ b/remoting/host/chromoting_host_context.cc |
| @@ -8,6 +8,7 @@ |
| #include "base/bind.h" |
| #include "base/threading/thread.h" |
| +#include "remoting/base/auto_thread_task_runner.h" |
| #include "remoting/host/url_request_context.h" |
| namespace remoting { |
| @@ -36,26 +37,54 @@ bool ChromotingHostContext::Start() { |
| if (!started) |
| return false; |
| + // Wrap worker threads to |AutoThreadTaskRunner| two keep the main thread |
|
Wez
2012/08/30 23:56:43
nit: "Wrap worker threads with |AutoThreadTaskRunn
alexeypa (please no reviews)
2012/08/31 19:57:36
Done. I removed the last sentence because it is no
|
| + // alive until there are references to them. |
| + network_task_runner_ = |
| + new AutoThreadTaskRunner(network_thread_.message_loop_proxy(), |
| + ui_task_runner_); |
| + capture_task_runner_ = |
| + new AutoThreadTaskRunner(capture_thread_.message_loop_proxy(), |
| + ui_task_runner_); |
| + encode_task_runner_ = |
| + new AutoThreadTaskRunner(encode_thread_.message_loop_proxy(), |
| + ui_task_runner_); |
| + desktop_task_runner_ = |
| + new AutoThreadTaskRunner(desktop_thread_.message_loop_proxy(), |
| + ui_task_runner_); |
| + file_task_runner_ = |
| + new AutoThreadTaskRunner(file_thread_.message_loop_proxy(), |
| + ui_task_runner_); |
| + |
| url_request_context_getter_ = new URLRequestContextGetter( |
| ui_task_runner(), network_task_runner(), |
| static_cast<MessageLoopForIO*>(file_thread_.message_loop())); |
| return true; |
| } |
| +void ChromotingHostContext::Stop() { |
| + url_request_context_getter_ = NULL; |
| + network_task_runner_ = NULL; |
| + capture_task_runner_ = NULL; |
| + encode_task_runner_ = NULL; |
| + desktop_task_runner_ = NULL; |
| + file_task_runner_ = NULL; |
| + ui_task_runner_ = NULL; |
| +} |
| + |
| base::SingleThreadTaskRunner* ChromotingHostContext::capture_task_runner() { |
| - return capture_thread_.message_loop_proxy(); |
| + return capture_task_runner_; |
| } |
| base::SingleThreadTaskRunner* ChromotingHostContext::encode_task_runner() { |
| - return encode_thread_.message_loop_proxy(); |
| + return encode_task_runner_; |
| } |
| base::SingleThreadTaskRunner* ChromotingHostContext::network_task_runner() { |
| - return network_thread_.message_loop_proxy(); |
| + return network_task_runner_; |
| } |
| base::SingleThreadTaskRunner* ChromotingHostContext::desktop_task_runner() { |
| - return desktop_thread_.message_loop_proxy(); |
| + return desktop_task_runner_; |
| } |
| base::SingleThreadTaskRunner* ChromotingHostContext::ui_task_runner() { |
| @@ -63,7 +92,7 @@ base::SingleThreadTaskRunner* ChromotingHostContext::ui_task_runner() { |
| } |
| base::SingleThreadTaskRunner* ChromotingHostContext::file_task_runner() { |
| - return file_thread_.message_loop_proxy(); |
| + return file_task_runner_; |
| } |
| const scoped_refptr<net::URLRequestContextGetter>& |