Commit 3a57477f authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

Migrate MessageLoop::current() to MessageLoopCurrent in /content/common/service_manager

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

Bug: 825327
Change-Id: I17d3542e3e7b2e1f6f53c52a7f985a64bf2d076c
Reviewed-on: https://chromium-review.googlesource.com/1024713Reviewed-by: default avatarKen Rockot <rockot@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553112}
parent d0252e22
......@@ -14,6 +14,7 @@
#include "base/lazy_instance.h"
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_current.h"
#include "base/threading/thread_checker.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/common/child.mojom.h"
......@@ -133,15 +134,16 @@ class ServiceManagerConnectionImpl::IOThreadContext
private:
friend class base::RefCountedThreadSafe<IOThreadContext>;
class MessageLoopObserver : public base::MessageLoop::DestructionObserver {
class MessageLoopObserver
: public base::MessageLoopCurrent::DestructionObserver {
public:
explicit MessageLoopObserver(base::WeakPtr<IOThreadContext> context)
: context_(context) {
base::MessageLoop::current()->AddDestructionObserver(this);
base::MessageLoopCurrent::Get()->AddDestructionObserver(this);
}
~MessageLoopObserver() override {
base::MessageLoop::current()->RemoveDestructionObserver(this);
base::MessageLoopCurrent::Get()->RemoveDestructionObserver(this);
}
void ShutDown() {
......
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