Commit 471891bc authored by fdoray's avatar fdoray Committed by Commit bot

Revert of Remove use of deprecated MessageLoop methods in ipc. (patchset #1...

Revert of Remove use of deprecated MessageLoop methods in ipc. (patchset #1 id:1 of https://codereview.chromium.org/2037853002/ )

Reason for revert:
MessageLoopForIO::current() has a DCHECK but ThreadTaskRunnerHandle::Get() doesn't. See discussion https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/Wj_cNO2l2qE

Original issue's description:
> Remove use of deprecated MessageLoop methods in ipc.
>
> 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=cpu@chromium.org
>
> Committed: https://crrev.com/2eb9714a01e03a8b091a8ea34f023e24f62e5a9f
> Cr-Commit-Position: refs/heads/master@{#398040}

TBR=cpu@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=616447

Review-Url: https://codereview.chromium.org/2038363004
Cr-Commit-Position: refs/heads/master@{#398140}
parent 1115180c
......@@ -11,17 +11,14 @@
#include "base/auto_reset.h"
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/pickle.h"
#include "base/process/process_handle.h"
#include "base/rand_util.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_checker.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/win/scoped_handle.h"
#include "ipc/attachment_broker.h"
#include "ipc/ipc_listener.h"
......@@ -415,10 +412,13 @@ bool ChannelWin::Connect() {
// Complete setup asynchronously. By not setting input_state_.is_pending
// to true, we indicate to OnIOCompleted that this is the special
// initialization signal.
base::ThreadTaskRunnerHandle::Get()->PostTask(
base::MessageLoopForIO::current()->PostTask(
FROM_HERE,
base::Bind(&ChannelWin::OnIOCompleted, weak_factory_.GetWeakPtr(),
&input_state_.context, 0, 0));
base::Bind(&ChannelWin::OnIOCompleted,
weak_factory_.GetWeakPtr(),
&input_state_.context,
0,
0));
}
if (!waiting_connect_)
......
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