Commit 90994f60 authored by danakj's avatar danakj Committed by Commit Bot

Convert Callbacks to OnceCallbacks for //content/common/

Use OnceCallback where possible, and BindRepeating where it is meant to
be called more than once.

R=avi@chromium.org
TBR=dpranke

Bug: 953861
Change-Id: I324303b817f72ac38fa253609785565aec0c241d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1932667Reviewed-by: default avatarCamille Lamy <clamy@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719181}
parent 5b3adc3c
......@@ -392,7 +392,6 @@ _NOT_CONVERTED_TO_MODERN_BIND_AND_CALLBACK = '|'.join((
'^content/app/',
'^content/browser/',
'^content/child/',
'^content/common/',
'^content/public/',
'^content/renderer/android/',
'^content/renderer/fetchers/',
......
......@@ -365,8 +365,8 @@ service_manager::Connector* ServiceManagerConnectionImpl::GetConnector() {
}
void ServiceManagerConnectionImpl::SetConnectionLostClosure(
const base::Closure& closure) {
connection_lost_handler_ = closure;
base::OnceClosure closure) {
connection_lost_handler_ = std::move(closure);
}
void ServiceManagerConnectionImpl::AddServiceRequestHandler(
......@@ -388,7 +388,7 @@ void ServiceManagerConnectionImpl::SetDefaultServiceRequestHandler(
void ServiceManagerConnectionImpl::OnConnectionLost() {
if (!connection_lost_handler_.is_null())
connection_lost_handler_.Run();
std::move(connection_lost_handler_).Run();
}
void ServiceManagerConnectionImpl::GetInterface(
......
......@@ -38,7 +38,7 @@ class CONTENT_EXPORT ServiceManagerConnectionImpl
void Start() override;
void Stop() override;
service_manager::Connector* GetConnector() override;
void SetConnectionLostClosure(const base::Closure& closure) override;
void SetConnectionLostClosure(base::OnceClosure closure) override;
void AddServiceRequestHandler(
const std::string& name,
const ServiceRequestHandler& handler) override;
......@@ -56,7 +56,7 @@ class CONTENT_EXPORT ServiceManagerConnectionImpl
std::unique_ptr<service_manager::Connector> connector_;
scoped_refptr<IOThreadContext> context_;
base::Closure connection_lost_handler_;
base::OnceClosure connection_lost_handler_;
base::WeakPtrFactory<ServiceManagerConnectionImpl> weak_factory_{this};
......
......@@ -83,7 +83,7 @@ class CONTENT_EXPORT ServiceManagerConnection {
// Sets a closure that is called when the connection is lost. Note that
// connection may already have been closed, in which case |closure| will be
// run immediately before returning from this function.
virtual void SetConnectionLostClosure(const base::Closure& closure) = 0;
virtual void SetConnectionLostClosure(base::OnceClosure closure) = 0;
// Adds a generic ServiceRequestHandler for a given service name. This
// will be used to satisfy any incoming calls to CreateService() which
......
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