| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "remoting/client/chromoting_client_runtime.h" | |
| 6 | |
| 7 #include "base/bind.h" | |
| 8 #include "base/logging.h" | |
| 9 #include "base/message_loop/message_loop.h" | |
| 10 #include "remoting/base/url_request_context_getter.h" | |
| 11 | |
| 12 namespace remoting { | |
| 13 | |
| 14 scoped_ptr<ChromotingClientRuntime> ChromotingClientRuntime::Create( | |
| 15 base::MessageLoopForUI* ui_loop) { | |
| 16 DCHECK(ui_loop); | |
| 17 | |
| 18 // |ui_loop_| runs on the main thread, so |ui_task_runner_| will run on the | |
| 19 // main thread. We can not kill the main thread when the message loop becomes | |
| 20 // idle so the callback function does nothing (as opposed to the typical | |
| 21 // base::MessageLoop::QuitClosure()) | |
| 22 scoped_refptr<AutoThreadTaskRunner> ui_task_runner = new AutoThreadTaskRunner( | |
| 23 ui_loop->task_runner(), base::Bind(&base::DoNothing)); | |
| 24 | |
| 25 scoped_refptr<AutoThreadTaskRunner> display_task_runner = | |
| 26 AutoThread::Create("native_disp", ui_task_runner); | |
| 27 scoped_refptr<AutoThreadTaskRunner> network_task_runner = | |
| 28 AutoThread::CreateWithType("native_net", ui_task_runner, | |
| 29 base::MessageLoop::TYPE_IO); | |
| 30 scoped_refptr<AutoThreadTaskRunner> file_task_runner = | |
| 31 AutoThread::CreateWithType("native_file", ui_task_runner, | |
| 32 base::MessageLoop::TYPE_IO); | |
| 33 scoped_refptr<net::URLRequestContextGetter> url_requester = | |
| 34 new URLRequestContextGetter(network_task_runner, file_task_runner); | |
| 35 | |
| 36 return make_scoped_ptr( | |
| 37 new ChromotingClientRuntime(display_task_runner, network_task_runner, | |
| 38 file_task_runner, url_requester)); | |
| 39 } | |
| 40 | |
| 41 ChromotingClientRuntime::ChromotingClientRuntime( | |
| 42 scoped_refptr<AutoThreadTaskRunner> display_task_runner, | |
| 43 scoped_refptr<AutoThreadTaskRunner> network_task_runner, | |
| 44 scoped_refptr<AutoThreadTaskRunner> file_task_runner, | |
| 45 scoped_refptr<net::URLRequestContextGetter> url_requester) | |
| 46 : display_task_runner_(display_task_runner), | |
| 47 network_task_runner_(network_task_runner), | |
| 48 file_task_runner_(file_task_runner), | |
| 49 url_requester_(url_requester) {} | |
| 50 | |
| 51 ChromotingClientRuntime::~ChromotingClientRuntime() {} | |
| 52 | |
| 53 } // namespace remoting | |
| OLD | NEW |