Commit 02f1ffc4 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

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

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=battre@chromium.org

Bug: 825327
Change-Id: I09f2ec144a8cd311d705ad3cfe3ac6da75cc4ca8
Reviewed-on: https://chromium-review.googlesource.com/1024319
Commit-Queue: Gabriel Charette <gab@chromium.org>
Commit-Queue: Charlie Harrison <csharrison@chromium.org>
Reviewed-by: default avatarCharlie Harrison <csharrison@chromium.org>
Reviewed-by: default avatarDominic Battré <battre@chromium.org>
Cr-Commit-Position: refs/heads/master@{#552925}
parent 58239836
......@@ -10,7 +10,7 @@
#include <utility>
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_current.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/test/histogram_tester.h"
......@@ -137,7 +137,7 @@ class ContentSubresourceFilterThrottleManagerTest
// tests, to ensure that the NavigationSimulator properly runs all necessary
// tasks while waiting for throttle checks to finish.
dealer_handle_ = std::make_unique<VerifiedRulesetDealer::Handle>(
base::MessageLoop::current()->task_runner());
base::MessageLoopCurrent::Get()->task_runner());
dealer_handle_->TryOpenAndSetRulesetFile(test_ruleset_pair_.indexed.path,
base::DoNothing());
......
......@@ -7,7 +7,7 @@
#include <memory>
#include "base/callback.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_current.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/test/histogram_tester.h"
......@@ -71,7 +71,7 @@ class SubframeNavigationFilteringThrottleTest
// tests, to ensure that the NavigationSimulator properly runs all necessary
// tasks while waiting for throttle checks to finish.
dealer_handle_ = std::make_unique<VerifiedRulesetDealer::Handle>(
base::MessageLoop::current()->task_runner());
base::MessageLoopCurrent::Get()->task_runner());
dealer_handle_->TryOpenAndSetRulesetFile(test_ruleset_pair_.indexed.path,
base::DoNothing());
ruleset_handle_ =
......
......@@ -11,7 +11,7 @@
#include <utility>
#include <vector>
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_current.h"
#include "base/metrics/field_trial.h"
#include "base/run_loop.h"
#include "base/test/histogram_tester.h"
......@@ -183,7 +183,7 @@ class SubresourceFilterSafeBrowsingActivationThrottleTest
ASSERT_NO_FATAL_FAILURE(test_ruleset_creator_.CreateRulesetWithRules(
rules, &test_ruleset_pair_));
auto ruleset_dealer = std::make_unique<VerifiedRulesetDealer::Handle>(
base::MessageLoop::current()->task_runner());
base::MessageLoopCurrent::Get()->task_runner());
ruleset_dealer->TryOpenAndSetRulesetFile(test_ruleset_pair_.indexed.path,
base::DoNothing());
client_ =
......
......@@ -9,7 +9,7 @@
#include "base/bind.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_current.h"
#include "components/subresource_filter/core/common/activation_state.h"
#include "components/subresource_filter/core/common/load_policy.h"
#include "components/subresource_filter/core/common/memory_mapped_ruleset.h"
......@@ -164,7 +164,7 @@ WebDocumentSubresourceFilterImpl::BuilderImpl::BuilderImpl(
ruleset_file_(std::move(ruleset_file)),
first_disallowed_load_callback_(
std::move(first_disallowed_load_callback)),
main_task_runner_(base::MessageLoop::current()->task_runner()),
main_task_runner_(base::MessageLoopCurrent::Get()->task_runner()),
is_associated_with_ad_subframe_(is_associated_with_ad_subframe) {}
WebDocumentSubresourceFilterImpl::BuilderImpl::~BuilderImpl() {}
......
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