Use base::BindOnce for PostTask callbacks.
TaskRunner::PostTask() takes a OnceCallback. Replace usage of
base::Bind(), which produces a RepeatingCallback, with base::BindOnce()
when the callback is created as a temporary inside of PostTask(). The
following regex was used to find instances that could be replaced:
(Post(?:Delayed)?Task)\((?:\n\s*)?FROM_HERE,(?:\n)?\s*base::Bind\(
Also replace any usage of base::Passed(&var) with std::move(var) for
variables passed to base::BindOnce(). base::Passed() isn't needed for
move-only types with OnceCallbacks.
This CL was uploaded by git cl split.
R=stevenjb@chromium.org
Bug: 714018
Change-Id: I70dce39d3975123cf0709f1787cc68f49ba9a57d
Reviewed-on: https://chromium-review.googlesource.com/c/1475733
Auto-Submit: kylechar <kylechar@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#633334}
diff --git a/dbus/object_manager.cc b/dbus/object_manager.cc
index 9bca1c0e..05d4b2d 100644
--- a/dbus/object_manager.cc
+++ b/dbus/object_manager.cc
@@ -308,10 +308,8 @@
// |signal| to NotifyPropertiesChanged, which will handle the clean up.
Signal* released_signal = signal.release();
bus_->GetOriginTaskRunner()->PostTask(
- FROM_HERE,
- base::Bind(&ObjectManager::NotifyPropertiesChanged,
- this, path,
- released_signal));
+ FROM_HERE, base::BindOnce(&ObjectManager::NotifyPropertiesChanged, this,
+ path, released_signal));
} else {
// If the D-Bus thread is not used, just call the callback on the
// current thread. Transfer the ownership of |signal| to
@@ -334,8 +332,7 @@
// Delete the message on the D-Bus thread. See comments in HandleMessage.
bus_->GetDBusTaskRunner()->PostTask(
- FROM_HERE,
- base::Bind(&base::DeletePointer<Signal>, signal));
+ FROM_HERE, base::BindOnce(&base::DeletePointer<Signal>, signal));
}
void ObjectManager::NotifyPropertiesChangedHelper(