Commit d493f211 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

Migrate MessageLoop::current() to MessageLoopCurrent in /components/safe_browsing

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.

R=vakh@chromium.org

Bug: 825327
Change-Id: Ic8c07068f4f567da6191716241a39fb3a68e6647
Reviewed-on: https://chromium-review.googlesource.com/1024318
Commit-Queue: Varun Khaneja <vakh@chromium.org>
Reviewed-by: default avatarVarun Khaneja <vakh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553206}
parent cedac690
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h" #include "base/files/scoped_temp_dir.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop_current.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/test/test_simple_task_runner.h" #include "base/test/test_simple_task_runner.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
...@@ -105,7 +105,7 @@ class FakeV4Database : public V4Database { ...@@ -105,7 +105,7 @@ class FakeV4Database : public V4Database {
bool stores_available) { bool stores_available) {
// Mimics V4Database::Create // Mimics V4Database::Create
const scoped_refptr<base::SingleThreadTaskRunner>& callback_task_runner = const scoped_refptr<base::SingleThreadTaskRunner>& callback_task_runner =
base::MessageLoop::current()->task_runner(); base::MessageLoopCurrent::Get()->task_runner();
db_task_runner->PostTask( db_task_runner->PostTask(
FROM_HERE, base::BindOnce(&FakeV4Database::CreateOnTaskRunner, FROM_HERE, base::BindOnce(&FakeV4Database::CreateOnTaskRunner,
db_task_runner, std::move(store_map), db_task_runner, std::move(store_map),
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_current.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/test/mock_callback.h" #include "base/test/mock_callback.h"
#include "base/test/test_mock_time_task_runner.h" #include "base/test/test_mock_time_task_runner.h"
...@@ -55,7 +56,7 @@ class WhitelistCheckerClientTest : public testing::Test { ...@@ -55,7 +56,7 @@ class WhitelistCheckerClientTest : public testing::Test {
base::TimeTicks::Now()); base::TimeTicks::Now());
message_loop_.reset(new base::MessageLoop); message_loop_.reset(new base::MessageLoop);
io_thread_ = std::make_unique<content::TestBrowserThread>( io_thread_ = std::make_unique<content::TestBrowserThread>(
content::BrowserThread::IO, base::MessageLoop::current()); content::BrowserThread::IO, base::MessageLoopCurrent::Get());
message_loop_->SetTaskRunner(task_runner_); message_loop_->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