Commit 152262c6 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

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

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

Bug: 825327
Change-Id: I74a210d1851a7f98217ee43c83bad9c369740f0a
Reviewed-on: https://chromium-review.googlesource.com/1024762Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553440}
parent 89d4da18
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop_current.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/threading/sequenced_task_runner_handle.h" #include "base/threading/sequenced_task_runner_handle.h"
#include "base/time/time.h" #include "base/time/time.h"
...@@ -147,7 +147,7 @@ DownloadFileImpl::DownloadFileImpl( ...@@ -147,7 +147,7 @@ DownloadFileImpl::DownloadFileImpl(
bytes_seen_without_parallel_streams_(0), bytes_seen_without_parallel_streams_(0),
is_paused_(false), is_paused_(false),
download_id_(download_id), download_id_(download_id),
main_task_runner_(base::MessageLoop::current()->task_runner()), main_task_runner_(base::MessageLoopCurrent::Get()->task_runner()),
observer_(observer), observer_(observer),
weak_factory_(this) { weak_factory_(this) {
TRACE_EVENT_INSTANT0("download", "DownloadFileCreated", TRACE_EVENT_INSTANT0("download", "DownloadFileCreated",
......
...@@ -721,8 +721,8 @@ void TestRenameCompletionCallback(const base::Closure& closure, ...@@ -721,8 +721,8 @@ void TestRenameCompletionCallback(const base::Closure& closure,
// succeed. // succeed.
// //
// Note that there is only one queue of tasks to run, and that is in the tests' // Note that there is only one queue of tasks to run, and that is in the tests'
// base::MessageLoop::current(). Each RunLoop processes that queue until it sees // base::MessageLoopCurrent::Get(). Each RunLoop processes that queue until it
// a QuitClosure() targeted at itself, at which point it stops processing. // sees a QuitClosure() targeted at itself, at which point it stops processing.
TEST_P(DownloadFileTestWithRename, RenameWithErrorRetry) { TEST_P(DownloadFileTestWithRename, RenameWithErrorRetry) {
ASSERT_TRUE(CreateDownloadFile(0, true)); ASSERT_TRUE(CreateDownloadFile(0, true));
base::FilePath initial_path(download_file_->FullPath()); base::FilePath initial_path(download_file_->FullPath());
......
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