Commit 354a5751 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

Migrate MessageLoop::current() to MessageLoopCurrent in /content/browser/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: I6dcd9290b2c6021b914375e8f7fb03065f6299ce
Reviewed-on: https://chromium-review.googlesource.com/1024871Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553309}
parent 19f256be
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "base/macros.h" #include "base/macros.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.h"
#include "base/message_loop/message_loop_current.h"
#include "base/metrics/field_trial.h" #include "base/metrics/field_trial.h"
#include "base/metrics/field_trial_params.h" #include "base/metrics/field_trial_params.h"
#include "base/path_service.h" #include "base/path_service.h"
...@@ -370,7 +371,7 @@ class CountingDownloadFile : public download::DownloadFileImpl { ...@@ -370,7 +371,7 @@ class CountingDownloadFile : public download::DownloadFileImpl {
download::GetDownloadTaskRunner()->PostTaskAndReply( download::GetDownloadTaskRunner()->PostTaskAndReply(
FROM_HERE, FROM_HERE,
base::BindOnce(&CountingDownloadFile::GetNumberActiveFiles, &result), base::BindOnce(&CountingDownloadFile::GetNumberActiveFiles, &result),
base::MessageLoop::current()->QuitWhenIdleClosure()); base::MessageLoopCurrent::Get()->QuitWhenIdleClosure());
base::RunLoop().Run(); base::RunLoop().Run();
DCHECK_NE(-1, result); DCHECK_NE(-1, result);
return result; return result;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/macros.h" #include "base/macros.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.h"
#include "base/message_loop/message_loop_current.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "content/browser/download/download_manager_impl.h" #include "content/browser/download/download_manager_impl.h"
#include "content/browser/download/drag_download_file.h" #include "content/browser/download/drag_download_file.h"
...@@ -54,7 +55,7 @@ class DragDownloadFileTest : public ContentBrowserTest { ...@@ -54,7 +55,7 @@ class DragDownloadFileTest : public ContentBrowserTest {
void Succeed() { void Succeed() {
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, BrowserThread::UI, FROM_HERE,
base::MessageLoopForUI::current()->QuitWhenIdleClosure()); base::MessageLoopCurrentForUI::Get()->QuitWhenIdleClosure());
} }
void FailFast() { void FailFast() {
......
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