Allow base::DoNothing() to handle any argument list.

This changes the form of DoNothing() from a simple no-arg function to a class
that produces callbacks via templated operator().  This allows callers to
replace base::Bind(&base::DoNothing) with base::DoNothing() for a small
boilerplate reduction; more importantly, it allows using DoNothing() to replace
existing no-op functions/lambdas that took more than zero args, and thus had to
be manually declared.  This removes dozens of such functions and around 600 LOC
total.

In a few places, DoNothing() can't be used directly, and this change also adds
explicit callback-generating Once<>() and Repeatedly<>() members that will
produce a callback with a specific signature.

BUG=811554
TEST=none

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_mojo;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_vr;master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I37f87b35c6c079a6a8c03ff18ec3a54e1237f126
Reviewed-on: https://chromium-review.googlesource.com/903416
Commit-Queue: Peter Kasting <[email protected]>
Reviewed-by: Jochen Eisinger <[email protected]>
Reviewed-by: Gabriel Charette <[email protected]>
Cr-Commit-Position: refs/heads/master@{#538953}
diff --git a/base/message_loop/message_pump_glib_unittest.cc b/base/message_loop/message_pump_glib_unittest.cc
index f7868c7..451c6f5 100644
--- a/base/message_loop/message_pump_glib_unittest.cc
+++ b/base/message_loop/message_pump_glib_unittest.cc
@@ -203,24 +203,24 @@
   // If changes cause this test to fail, it is reasonable to change it, but
   // TestWorkWhileWaitingForEvents and TestEventsWhileWaitingForWork have to be
   // changed accordingly, otherwise they can become flaky.
-  injector()->AddEventAsTask(0, BindOnce(&DoNothing));
+  injector()->AddEventAsTask(0, DoNothing());
   OnceClosure check_task =
       BindOnce(&ExpectProcessedEvents, Unretained(injector()), 2);
   OnceClosure posted_task =
       BindOnce(&PostMessageLoopTask, FROM_HERE, std::move(check_task));
   injector()->AddEventAsTask(0, std::move(posted_task));
-  injector()->AddEventAsTask(0, BindOnce(&DoNothing));
+  injector()->AddEventAsTask(0, DoNothing());
   injector()->AddEvent(0, MessageLoop::QuitWhenIdleClosure());
   RunLoop().Run();
   EXPECT_EQ(4, injector()->processed_events());
 
   injector()->Reset();
-  injector()->AddEventAsTask(0, BindOnce(&DoNothing));
+  injector()->AddEventAsTask(0, DoNothing());
   check_task = BindOnce(&ExpectProcessedEvents, Unretained(injector()), 2);
   posted_task =
       BindOnce(&PostMessageLoopTask, FROM_HERE, std::move(check_task));
   injector()->AddEventAsTask(0, std::move(posted_task));
-  injector()->AddEventAsTask(10, BindOnce(&DoNothing));
+  injector()->AddEventAsTask(10, DoNothing());
   injector()->AddEvent(0, MessageLoop::QuitWhenIdleClosure());
   RunLoop().Run();
   EXPECT_EQ(4, injector()->processed_events());
@@ -376,8 +376,8 @@
   injector->AddEvent(0, MessageLoop::QuitWhenIdleClosure());
 
   // Post a couple of dummy tasks
-  ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, BindOnce(&DoNothing));
-  ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, BindOnce(&DoNothing));
+  ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, DoNothing());
+  ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, DoNothing());
 
   // Drain the events
   while (g_main_context_pending(nullptr)) {