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

Migrate MessageLoop::current() to MessageLoopCurrent in /media/audio

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

Bug: 825327
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I296b69513d2205d1cba2d75d6a89891ec60a5b38
Reviewed-on: https://chromium-review.googlesource.com/1024249Reviewed-by: default avatarOlga Sharonova <olka@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553166}
parent 0b61ff47
......@@ -7,7 +7,7 @@
#include <utility>
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_current.h"
namespace media {
......@@ -46,7 +46,7 @@ AliveChecker::AliveChecker(
PowerObserverHelperFactoryCallback power_observer_helper_factory_callback)
: check_interval_(check_interval),
timeout_(timeout),
task_runner_(base::MessageLoop::current()->task_runner()),
task_runner_(base::MessageLoopCurrent::Get()->task_runner()),
dead_callback_(std::move(dead_callback)),
stop_at_first_alive_notification_(stop_at_first_alive_notification),
weak_factory_(this) {
......
......@@ -131,8 +131,9 @@ class MEDIA_EXPORT AudioInputDevice : public AudioCapturerSource,
void SetVolumeOnIOThread(double volume);
void SetAutomaticGainControlOnIOThread(bool enabled);
// base::MessageLoop::DestructionObserver implementation for the IO loop.
// If the IO loop dies before we do, we shut down the audio thread from here.
// base::MessageLoopCurrent::DestructionObserver implementation for the IO
// loop. If the IO loop dies before we do, we shut down the audio thread from
// here.
void WillDestroyCurrentMessageLoop() override;
// This is called by |alive_checker_| if it detects that the input stream is
......
......@@ -161,8 +161,9 @@ class MEDIA_EXPORT AudioOutputDevice : public AudioRendererSink,
void NotifyRenderCallbackOfError();
// base::MessageLoop::DestructionObserver implementation for the IO loop.
// If the IO loop dies before we do, we shut down the audio thread from here.
// base::MessageLoopCurrent::DestructionObserver implementation for the IO
// loop. If the IO loop dies before we do, we shut down the audio thread from
// here.
void WillDestroyCurrentMessageLoop() override;
AudioParameters audio_parameters_;
......
......@@ -24,7 +24,7 @@ void ScopedTaskRunnerObserver::ObserveLoopDestruction(
base::WaitableEvent* done) {
// Note: |done| may be NULL.
if (task_runner_->BelongsToCurrentThread()) {
base::MessageLoop* loop = base::MessageLoop::current();
base::MessageLoopCurrent loop = base::MessageLoopCurrent::Get();
if (enable) {
loop->AddDestructionObserver(this);
} else {
......
......@@ -8,6 +8,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_current.h"
namespace base {
class SingleThreadTaskRunner;
......@@ -23,7 +24,7 @@ namespace media {
// NOTE: The class that inherits from this class must implement the
// WillDestroyCurrentMessageLoop virtual method from DestructionObserver.
class ScopedTaskRunnerObserver
: public base::MessageLoop::DestructionObserver {
: public base::MessageLoopCurrent::DestructionObserver {
public:
explicit ScopedTaskRunnerObserver(
const scoped_refptr<base::SingleThreadTaskRunner>& 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