Commit 5e98e638 authored by fdoray's avatar fdoray Committed by Commit bot

Remove use of deprecated MessageLoop methods in cc.

MessageLoop::PostTask/PostDelayedTask/DeleteSoon/ReleaseSoon
are deprecated. This CL makes the following replacements to
remove some uses of these methods:

"MessageLoop(ForUI|ForIO)::current()->PostTask" ->
  "ThreadTaskRunnerHandle::Get()->PostTask"
"MessageLoop(ForUI|ForIO)::current()->PostDelayedTask" ->
  "ThreadTaskRunnerHandle::Get()->PostDelayedTask"
"MessageLoop(ForUI|ForIO)::current()->DeleteSoon" ->
  "ThreadTaskRunnerHandle::Get()->DeleteSoon"
"MessageLoop(ForUI|ForIO)::current()->ReleaseSoon" ->
  "ThreadTaskRunnerHandle::Get()->ReleaseSoon"

In files where these replacements are made, it adds these includes:
  #include "base/location.h"
  #include "base/single_thread_task_runner.h"
  #include "base/threading/thread_task_runner_handle.h"

And removes this include if it is no longer required:
  #include "base/message_loop/message_loop.h"

Why ThreadTaskRunnerHandle::Get() instead of
MessageLoop::current()->task_runner()?
 - The two are equivalent on threads that run a MessageLoop.
 - MessageLoop::current() doesn't work in base/task_scheduler
   because the scheduler's thread don't run MessageLoops.
   This CL will therefore facilitate the migration of browser
   threads to base/task_scheduler.

Steps to generate this patch:
1. Run message_loop_cleanup.py (see code on the bug).
2. Run tools/sort-headers.py on modified files.
3. Run git cl format.

BUG=616447
R=danakj@chromium.org
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel

Review-Url: https://codereview.chromium.org/2034913002
Cr-Commit-Position: refs/heads/master@{#398064}
parent 0983a7c3
......@@ -4,7 +4,10 @@
#include <stddef.h>
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "cc/layers/layer_iterator.h"
#include "cc/output/copy_output_request.h"
#include "cc/output/copy_output_result.h"
......@@ -47,7 +50,7 @@ class LayerTreeHostCopyRequestTestMultipleRequests
void DidCommit() override { WaitForCallback(); }
void WaitForCallback() {
base::MessageLoop::current()->PostTask(
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&LayerTreeHostCopyRequestTestMultipleRequests::NextStep,
base::Unretained(this)));
......
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