Commit 9592d4ed authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

Migrate MessageLoop::current() to MessageLoopCurrent in /services/ui

These changes were scripted as part of the effort to restrict exposure of the
raw MessageLoop*.

Note that many static methods exposed on MessageLoopCurrent are also deprecated
so it is very well possible that this is migrating to an already deprecated
method.

The goal of this pass is to reduce usage of MessageLoop::current() (and
ultimately make it impossible to obtain the MessageLoop* statically).

As such I will not edit this CL unless the script did something logically wrong.
I defer to owners to fix highlighted usage of already deprecated APIs.

Possible script screw ups / things to look out for in this review:
 - Storing MessageLoopCurrent in a MessageLoop* variable or comparing it against
   one (I will go over that in a separate pass).

Includes should have been stripped if that was the last usage of message_loop.h
in that file.

Please CQ if LGTY

This CL was uploaded by git cl split.

TBR=ben@chromium.org

Bug: 825327
Change-Id: Iff0e9fcf49b0a61b24cbd992b0503365f879a40c
Reviewed-on: https://chromium-review.googlesource.com/1024752Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553644}
parent 3ce84d2d
......@@ -7,6 +7,7 @@
#include <utility>
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop_current.h"
#include "base/strings/string_number_conversions.h"
#include "components/viz/common/frame_sinks/copy_output_request.h"
#include "gpu/ipc/client/gpu_channel_host.h"
......@@ -577,7 +578,7 @@ TestWindowServerDelegate::GetThreadedImageCursorsFactory() {
WindowServerTestHelper::WindowServerTestHelper()
: cursor_(ui::CursorType::kNull), platform_display_factory_(&cursor_) {
// Some tests create their own message loop, for example to add a task runner.
if (!base::MessageLoop::current())
if (!base::MessageLoopCurrent::Get())
message_loop_ = std::make_unique<base::MessageLoop>();
PlatformDisplay::set_factory_for_testing(&platform_display_factory_);
window_server_ = std::make_unique<WindowServer>(&window_server_delegate_,
......@@ -666,7 +667,7 @@ void WindowEventTargetingHelper::CreateSecondaryTree(
void WindowEventTargetingHelper::SetTaskRunner(
scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
base::MessageLoop::current()->SetTaskRunner(task_runner);
base::MessageLoopCurrent::Get()->SetTaskRunner(task_runner);
}
// ----------------------------------------------------------------------------
......
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