Migrate MessageLoop::ScopedNestableTaskAllower to RunLoop::Type::kNestableTasksAllowed when used in same scope as a RunLoop variable.

Scripted via https://bugs.chromium.org/p/chromium/issues/detail?id=781352#c1

The script should have replaced a MessageLoop::ScopedNestableTaskAllower
in the same scope as a RunLoop with a RunLoop of
Type::kNestableTasksAllowed. If there was a comment above the
MessageLoop::ScopedNestableTaskAllower, it should have been moved
alongside the augmented RunLoop.

Please CQ if LGTY

This CL was uploaded by git cl split.

[email protected]

Bug: 781352
Change-Id: I1eba95f6d8329b772a81081ad6b9e5a7cd2a6aed
Reviewed-on: https://chromium-review.googlesource.com/757641
Reviewed-by: Tom Sepez <[email protected]>
Commit-Queue: Gabriel Charette <[email protected]>
Cr-Commit-Position: refs/heads/master@{#514924}
diff --git a/ipc/ipc_mojo_perftest.cc b/ipc/ipc_mojo_perftest.cc
index df5e966..299c1f29 100644
--- a/ipc/ipc_mojo_perftest.cc
+++ b/ipc/ipc_mojo_perftest.cc
@@ -337,14 +337,11 @@
     mojo::MessagePipeHandle mp_handle(mp);
     mojo::ScopedMessagePipeHandle scoped_mp(mp_handle);
 
+    LockThreadAffinity thread_locker(kSharedCore);
     // In single process mode, this is running in a task and by default other
     // tasks (in particular, the binding) won't run. To keep the single process
     // and multi-process code paths the same, enable nestable tasks.
-    base::MessageLoop::ScopedNestableTaskAllower nest_loop(
-        base::MessageLoop::current());
-
-    LockThreadAffinity thread_locker(kSharedCore);
-    base::RunLoop run_loop;
+    base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed);
     ReflectorImpl impl(std::move(scoped_mp), run_loop.QuitWhenIdleClosure());
     run_loop.Run();
     return 0;
@@ -508,14 +505,11 @@
     mojo::MessagePipeHandle mp_handle(mp);
     mojo::ScopedMessagePipeHandle scoped_mp(mp_handle);
 
+    LockThreadAffinity thread_locker(kSharedCore);
     // In single process mode, this is running in a task and by default other
     // tasks (in particular, the binding) won't run. To keep the single process
     // and multi-process code paths the same, enable nestable tasks.
-    base::MessageLoop::ScopedNestableTaskAllower nest_loop(
-        base::MessageLoop::current());
-
-    LockThreadAffinity thread_locker(kSharedCore);
-    base::RunLoop run_loop;
+    base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed);
     InterfacePassingTestDriverImpl impl(std::move(scoped_mp),
                                         run_loop.QuitWhenIdleClosure());
     run_loop.Run();
diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc
index dd636b5..eca1d76 100644
--- a/ipc/ipc_sync_channel.cc
+++ b/ipc/ipc_sync_channel.cc
@@ -682,9 +682,7 @@
 }
 
 void SyncChannel::WaitForReplyWithNestedMessageLoop(SyncContext* context) {
-  base::MessageLoop::ScopedNestableTaskAllower allow(
-      base::MessageLoop::current());
-  base::RunLoop nested_loop;
+  base::RunLoop nested_loop(base::RunLoop::Type::kNestableTasksAllowed);
   ReceivedSyncMsgQueue::NestedSendDoneWatcher watcher(context, &nested_loop);
   nested_loop.Run();
 }