| Index: remoting/host/chromoting_host_context.cc
|
| diff --git a/remoting/host/chromoting_host_context.cc b/remoting/host/chromoting_host_context.cc
|
| index e2943ff329d98f5917aaadb05d892d2521aaaf6a..319cc77f1784f17a2b392d90eda5a372d646df76 100644
|
| --- a/remoting/host/chromoting_host_context.cc
|
| +++ b/remoting/host/chromoting_host_context.cc
|
| @@ -4,8 +4,8 @@
|
|
|
| #include "remoting/host/chromoting_host_context.h"
|
|
|
| -#include "base/bind.h"
|
| #include "base/threading/thread_restrictions.h"
|
| +#include "content/public/browser/browser_thread.h"
|
| #include "remoting/base/auto_thread.h"
|
| #include "remoting/base/url_request_context_getter.h"
|
|
|
| @@ -127,39 +127,50 @@
|
| }
|
|
|
| #if defined(OS_CHROMEOS)
|
| +namespace {
|
| +// Retrieves the task_runner from the browser thread with |id|.
|
| +scoped_refptr<AutoThreadTaskRunner> WrapBrowserThread(
|
| + content::BrowserThread::ID id) {
|
| + // AutoThreadTaskRunner is a TaskRunner with the special property that it will
|
| + // continue to process tasks until no references remain, at least. The
|
| + // QuitClosure we usually pass does the simple thing of stopping the
|
| + // underlying TaskRunner. Since we are re-using the ui_task_runner of the
|
| + // browser thread, we cannot stop it explicitly. Therefore, base::DoNothing
|
| + // is passed in as the quit closure.
|
| + // TODO(kelvinp): Fix this (See crbug.com/428187).
|
| + return new AutoThreadTaskRunner(
|
| + content::BrowserThread::GetMessageLoopProxyForThread(id).get(),
|
| + base::Bind(&base::DoNothing));
|
| +}
|
| +
|
| +} // namespace
|
|
|
| // static
|
| scoped_ptr<ChromotingHostContext> ChromotingHostContext::CreateForChromeOS(
|
| - scoped_refptr<net::URLRequestContextGetter> url_request_context_getter,
|
| - scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
|
| - scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
|
| - scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) {
|
| + scoped_refptr<net::URLRequestContextGetter> url_request_context_getter) {
|
| DCHECK(url_request_context_getter.get());
|
|
|
| + // Use BrowserThread::FILE as the joiner as it is the only browser-thread
|
| + // that allows blocking I/O, which is required by thread joining.
|
| + // TODO(kelvinp): Fix AutoThread so that it can be joinable on task runners
|
| + // that disallow I/O (crbug.com/428466).
|
| + scoped_refptr<AutoThreadTaskRunner> file_task_runner =
|
| + WrapBrowserThread(content::BrowserThread::FILE);
|
|
|
| - // AutoThreadTaskRunner is a TaskRunner with the special property that it will
|
| - // continue to process tasks until no references remain, at least. The
|
| - // QuitClosure we usually pass does the simple thing of stopping the
|
| - // underlying TaskRunner. Since we are re-using browser's threads, we cannot
|
| - // stop them explicitly. Therefore, base::DoNothing is passed in as the quit
|
| - // closure.
|
| - scoped_refptr<AutoThreadTaskRunner> io_auto_task_runner =
|
| - new AutoThreadTaskRunner(io_task_runner, base::Bind(&base::DoNothing));
|
| - scoped_refptr<AutoThreadTaskRunner> file_auto_task_runner =
|
| - new AutoThreadTaskRunner(file_task_runner, base::Bind(&base::DoNothing));
|
| - scoped_refptr<AutoThreadTaskRunner> ui_auto_task_runner =
|
| - new AutoThreadTaskRunner(ui_task_runner, base::Bind(&base::DoNothing));
|
| + scoped_refptr<AutoThreadTaskRunner> ui_task_runner =
|
| + WrapBrowserThread(content::BrowserThread::UI);
|
|
|
| - // Use browser's file thread as the joiner as it is the only browser-thread
|
| - // that allows blocking I/O, which is required by thread joining.
|
| return make_scoped_ptr(new ChromotingHostContext(
|
| - ui_auto_task_runner,
|
| - AutoThread::Create("ChromotingAudioThread", file_auto_task_runner),
|
| - file_auto_task_runner,
|
| - ui_auto_task_runner, // input_task_runner
|
| - io_auto_task_runner, // network_task_runner
|
| - ui_auto_task_runner, // video_capture_task_runner
|
| - AutoThread::Create("ChromotingEncodeThread", file_auto_task_runner),
|
| + ui_task_runner,
|
| + AutoThread::CreateWithType("ChromotingAudioThread", file_task_runner,
|
| + base::MessageLoop::TYPE_IO),
|
| + file_task_runner,
|
| + AutoThread::CreateWithType("ChromotingInputThread", file_task_runner,
|
| + base::MessageLoop::TYPE_IO),
|
| + WrapBrowserThread(content::BrowserThread::IO), // network_task_runner
|
| + ui_task_runner, // video_capture_task_runner
|
| + AutoThread::CreateWithType("ChromotingEncodeThread", file_task_runner,
|
| + base::MessageLoop::TYPE_IO),
|
| url_request_context_getter));
|
| }
|
| #endif // defined(OS_CHROMEOS)
|
|
|