Chromium Code Reviews| 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/memory/singleton.h" | |
| 10 #include "remoting/base/url_request_context_getter.h" | |
| 11 | |
| 12 namespace { | |
| 13 | |
| 14 void DoNothing() {} | |
| 15 } // namespace | |
| 16 | |
| 17 namespace remoting { | |
| 18 | |
| 19 ChromotingClientRuntimeIos::ChromotingClientRuntime() { | |
|
Sergey Ulanov
2016/03/04 22:50:17
There is nothing in this class that's specific to
nicholss
2016/03/07 18:32:36
The Android runtime has a bunch of jni connections
| |
| 20 if (!base::MessageLoop::current()) { | |
| 21 VLOG(1) << "Starting main message loop"; | |
| 22 ui_loop_ = new base::MessageLoop(base::MessageLoop::TYPE_UI); | |
| 23 base::MessageLoopForUI::current()->Attach(); | |
| 24 } else { | |
| 25 VLOG(1) << "Using existing main message loop"; | |
| 26 ui_loop_ = base::MessageLoopForUI::current(); | |
| 27 } | |
| 28 | |
| 29 // |ui_loop_| runs on the main thread, so |ui_task_runner_| will run on the | |
| 30 // main thread. We can not kill the main thread when the message loop becomes | |
| 31 // idle so the callback function does nothing (as opposed to the typical | |
| 32 // base::MessageLoop::QuitClosure()) | |
| 33 ui_task_runner_ = new AutoThreadTaskRunner(ui_loop_->task_runner(), | |
| 34 base::Bind(&::DoNothing)); | |
| 35 | |
| 36 network_task_runner_ = AutoThread::CreateWithType( | |
| 37 "native_net", ui_task_runner_, base::MessageLoop::TYPE_IO); | |
| 38 file_task_runner_ = AutoThread::CreateWithType("native_file", ui_task_runner_, | |
| 39 base::MessageLoop::TYPE_IO); | |
| 40 | |
| 41 url_requester_ = | |
| 42 new URLRequestContextGetter(network_task_runner_, file_task_runner_); | |
| 43 } | |
| 44 | |
| 45 // static | |
| 46 ChromotingClientRuntime* ChromotingClientRuntimeIos::GetInstance() { | |
| 47 return base::Singleton<ChromotingClientRuntime>::get(); | |
| 48 } | |
| 49 | |
| 50 ChromotingClientRuntimeIos::~ChromotingClientRuntime() {} | |
|
Sergey Ulanov
2016/03/04 22:50:17
You are missing Ios suffix in the name, so this co
nicholss
2016/03/07 18:32:36
Acknowledged.
| |
| 51 | |
| 52 scoped_refptr<AutoThreadTaskRunner> | |
| 53 ChromotingClientRuntimeIos::network_task_runner() { | |
| 54 return network_task_runner_; | |
| 55 } | |
| 56 | |
| 57 scoped_refptr<AutoThreadTaskRunner> | |
| 58 ChromotingClientRuntimeIos::display_task_runner() { | |
| 59 return ui_task_runner_; | |
| 60 } | |
| 61 | |
| 62 scoped_refptr<AutoThreadTaskRunner> | |
| 63 ChromotingClientRuntimeIos::file_task_runner() { | |
| 64 return file_task_runner_; | |
| 65 } | |
| 66 | |
| 67 scoped_refptr<net::URLRequestContextGetter> | |
| 68 ChromotingClientRuntimeIos::url_requester() { | |
| 69 return url_requester_; | |
| 70 } | |
| 71 | |
| 72 } // namespace remoting | |
| OLD | NEW |