Commit 12c0fc10 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

Use modern base APIs to avoid base::MessageLoop::current() calls in /remoting

This is a precusor cleanup extracted from
https://chromium-review.googlesource.com/c/chromium/src/+/957760/7
in the broader effort to restrict usage of MessageLoop::current().

This CL was uploaded by git cl split.

R=jamiewalch@chromium.org

Bug: 825327
Change-Id: Iaf8fde959a9c7848200e2c08d9c43236b1b331aa
Reviewed-on: https://chromium-review.googlesource.com/986536Reviewed-by: default avatarJoe Downing <joedow@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547069}
parent 1871283a
......@@ -31,19 +31,17 @@ ChromotingClientRuntime* ChromotingClientRuntime::GetInstance() {
ChromotingClientRuntime::ChromotingClientRuntime() {
base::TaskScheduler::CreateAndStartWithDefaultParams("Remoting");
if (!base::MessageLoop::current()) {
VLOG(1) << "Starting main message loop";
ui_loop_.reset(new base::MessageLoopForUI());
DCHECK(!base::MessageLoop::current());
VLOG(1) << "Starting main message loop";
ui_loop_.reset(new base::MessageLoopForUI());
#if defined(OS_ANDROID)
// On Android, the UI thread is managed by Java, so we need to attach and
// start a special type of message loop to allow Chromium code to run tasks.
ui_loop_->Start();
// On Android, the UI thread is managed by Java, so we need to attach and
// start a special type of message loop to allow Chromium code to run tasks.
ui_loop_->Start();
#elif defined(OS_IOS)
base::MessageLoopForUI::current()->Attach();
ui_loop_->Attach();
#endif // OS_ANDROID, OS_IOS
} else {
ui_loop_.reset(base::MessageLoopForUI::current());
}
#if defined(DEBUG)
net::URLFetcher::SetIgnoreCertificateRequests(true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment