0

[code health]Convert content/common away from base::Bind

base::Bind is deprecated in favor of either base::BindOnce or
base::BindRepeating, depending on whether the callback is invoked once
or multiple times.

Bug: 1007762
Change-Id: I138c46449a3c998eb35e6cca5a9beb1050727b92
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1924175
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Commit-Queue: Yuzu Saijo <yuzus@chromium.org>
Cr-Commit-Position: refs/heads/master@{#716930}
This commit is contained in:
Yuzu Saijo
2019-11-20 10:19:17 +00:00
committed by Commit Bot
parent 44964b29ce
commit 741ba863a7

@ -70,12 +70,12 @@ class ServiceManagerConnectionImpl::IOThreadContext
}
// Safe to call from any thread.
void Start(const base::Closure& stop_callback) {
void Start(base::OnceClosure stop_callback) {
DCHECK(!started_);
started_ = true;
callback_task_runner_ = base::ThreadTaskRunnerHandle::Get();
stop_callback_ = stop_callback;
stop_callback_ = std::move(stop_callback);
io_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&IOThreadContext::StartOnIOThread, this));
}
@ -290,7 +290,7 @@ class ServiceManagerConnectionImpl::IOThreadContext
void OnDisconnected() override {
ClearConnectionFiltersOnIOThread();
callback_task_runner_->PostTask(FROM_HERE, stop_callback_);
callback_task_runner_->PostTask(FROM_HERE, std::move(stop_callback_));
}
base::ThreadChecker io_thread_checker_;
@ -311,7 +311,7 @@ class ServiceManagerConnectionImpl::IOThreadContext
scoped_refptr<base::SequencedTaskRunner> callback_task_runner_;
// Callback to run if the service is stopped by the service manager.
base::Closure stop_callback_;
base::OnceClosure stop_callback_;
std::unique_ptr<service_manager::ServiceBinding> service_binding_;
@ -408,8 +408,8 @@ ServiceManagerConnectionImpl::~ServiceManagerConnectionImpl() {
void ServiceManagerConnectionImpl::Start() {
context_->Start(
base::Bind(&ServiceManagerConnectionImpl::OnConnectionLost,
weak_factory_.GetWeakPtr()));
base::BindOnce(&ServiceManagerConnectionImpl::OnConnectionLost,
weak_factory_.GetWeakPtr()));
}
void ServiceManagerConnectionImpl::Stop() {