Commit 664ce498 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

Migrate MessageLoop::current() to MessageLoopCurrent in /content/browser/browser_main_loop.cc

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

Bug: 825327
Change-Id: If410a2423e1780c769a768ea4dd533b37cc39488
Reviewed-on: https://chromium-review.googlesource.com/1024655
Commit-Queue: Gabriel Charette <gab@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#552890}
parent fa5482eb
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "base/memory/memory_coordinator_proxy.h" #include "base/memory/memory_coordinator_proxy.h"
#include "base/memory/memory_pressure_monitor.h" #include "base/memory/memory_pressure_monitor.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/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics.h"
...@@ -653,7 +654,7 @@ void BrowserMainLoop::MainMessageLoopStart() { ...@@ -653,7 +654,7 @@ void BrowserMainLoop::MainMessageLoopStart() {
TRACE_EVENT0("startup", "BrowserMainLoop::MainMessageLoopStart"); TRACE_EVENT0("startup", "BrowserMainLoop::MainMessageLoopStart");
// Create a MessageLoop if one does not already exist for the current thread. // Create a MessageLoop if one does not already exist for the current thread.
if (!base::MessageLoop::current()) if (!base::MessageLoopCurrent::Get())
main_message_loop_.reset(new base::MessageLoopForUI); main_message_loop_.reset(new base::MessageLoopForUI);
InitializeMainThread(); InitializeMainThread();
...@@ -1176,7 +1177,7 @@ void BrowserMainLoop::InitializeMainThread() { ...@@ -1176,7 +1177,7 @@ void BrowserMainLoop::InitializeMainThread() {
// Register the main thread. The main thread's task runner should already have // Register the main thread. The main thread's task runner should already have
// been initialized in MainMessageLoopStart() (or before if // been initialized in MainMessageLoopStart() (or before if
// MessageLoop::current() was externally provided). // MessageLoopCurrent::Get() was externally provided).
DCHECK(base::ThreadTaskRunnerHandle::IsSet()); DCHECK(base::ThreadTaskRunnerHandle::IsSet());
main_thread_.reset(new BrowserThreadImpl( main_thread_.reset(new BrowserThreadImpl(
BrowserThread::UI, base::ThreadTaskRunnerHandle::Get())); BrowserThread::UI, base::ThreadTaskRunnerHandle::Get()));
......
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