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

Migrate MessageLoop::current() to MessageLoopCurrent in /content/browser/renderer_host/media

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

Bug: 825327
Change-Id: Ifccb0682900e0015ef59bed96592d03275217e24
Reviewed-on: https://chromium-review.googlesource.com/1024663Reviewed-by: default avatarFredrik Hubinette <hubbe@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553804}
parent 501957dd
......@@ -1379,7 +1379,7 @@ void MediaStreamManager::InitializeMaybeAsync(
// We want to be notified of IO message loop destruction to delete the thread
// and the device managers.
base::MessageLoop::current()->AddDestructionObserver(this);
base::MessageLoopCurrent::Get()->AddDestructionObserver(this);
video_capture_manager_ =
new VideoCaptureManager(std::move(video_capture_provider),
......
......@@ -38,6 +38,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_current.h"
#include "base/power_monitor/power_observer.h"
#include "base/threading/thread.h"
#include "build/build_config.h"
......@@ -71,7 +72,7 @@ class VideoCaptureProvider;
// using callbacks.
class CONTENT_EXPORT MediaStreamManager
: public MediaStreamProviderListener,
public base::MessageLoop::DestructionObserver,
public base::MessageLoopCurrent::DestructionObserver,
public base::PowerObserver {
public:
// Callback to deliver the result of a media access request.
......@@ -228,12 +229,10 @@ class CONTENT_EXPORT MediaStreamManager
// This object gets deleted on the UI thread after the IO thread has been
// destroyed. So we need to know when IO thread is being destroyed so that
// we can delete VideoCaptureManager and AudioInputDeviceManager. Normally
// this is handled by
// base::MessageLoop::DestructionObserver::WillDestroyCurrentMessageLoop.
// But for some tests which use TestBrowserThreadBundle, we need to call
// WillDestroyCurrentMessageLoop explicitly because the notification happens
// too late. (see http://crbug.com/247525#c14).
// we can delete VideoCaptureManager and AudioInputDeviceManager.
// Note: In tests it is sometimes necessary to invoke this explicitly when
// using TestBrowserThreadBundle because the notification happens too late.
// (see http://crbug.com/247525#c14).
void WillDestroyCurrentMessageLoop() override;
// Sends log messages to the render process hosts whose corresponding render
......
......@@ -210,7 +210,7 @@ class MediaStreamManagerTest : public ::testing::Test {
}
// media_stream_manager_ needs to outlive thread_bundle_ because it is a
// MessageLoop::DestructionObserver. audio_manager_ needs to outlive
// MessageLoopCurrent::DestructionObserver. audio_manager_ needs to outlive
// thread_bundle_ because it uses the underlying message loop.
std::unique_ptr<MediaStreamManager> media_stream_manager_;
std::unique_ptr<MockMediaObserver> media_observer_;
......
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