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(( ...@@ -392,7 +392,6 @@ _NOT_CONVERTED_TO_MODERN_BIND_AND_CALLBACK = '|'.join((
'^content/app/', '^content/app/',
'^content/browser/', '^content/browser/',
'^content/child/', '^content/child/',
'^content/common/',
'^content/public/', '^content/public/',
'^content/renderer/android/', '^content/renderer/android/',
'^content/renderer/fetchers/', '^content/renderer/fetchers/',
......
...@@ -365,8 +365,8 @@ service_manager::Connector* ServiceManagerConnectionImpl::GetConnector() { ...@@ -365,8 +365,8 @@ service_manager::Connector* ServiceManagerConnectionImpl::GetConnector() {
} }
void ServiceManagerConnectionImpl::SetConnectionLostClosure( void ServiceManagerConnectionImpl::SetConnectionLostClosure(
const base::Closure& closure) { base::OnceClosure closure) {
connection_lost_handler_ = closure; connection_lost_handler_ = std::move(closure);
} }
void ServiceManagerConnectionImpl::AddServiceRequestHandler( void ServiceManagerConnectionImpl::AddServiceRequestHandler(
...@@ -388,7 +388,7 @@ void ServiceManagerConnectionImpl::SetDefaultServiceRequestHandler( ...@@ -388,7 +388,7 @@ void ServiceManagerConnectionImpl::SetDefaultServiceRequestHandler(
void ServiceManagerConnectionImpl::OnConnectionLost() { void ServiceManagerConnectionImpl::OnConnectionLost() {
if (!connection_lost_handler_.is_null()) if (!connection_lost_handler_.is_null())
connection_lost_handler_.Run(); std::move(connection_lost_handler_).Run();
} }
void ServiceManagerConnectionImpl::GetInterface( void ServiceManagerConnectionImpl::GetInterface(
......
...@@ -38,7 +38,7 @@ class CONTENT_EXPORT ServiceManagerConnectionImpl ...@@ -38,7 +38,7 @@ class CONTENT_EXPORT ServiceManagerConnectionImpl
void Start() override; void Start() override;
void Stop() override; void Stop() override;
service_manager::Connector* GetConnector() override; service_manager::Connector* GetConnector() override;
void SetConnectionLostClosure(const base::Closure& closure) override; void SetConnectionLostClosure(base::OnceClosure closure) override;
void AddServiceRequestHandler( void AddServiceRequestHandler(
const std::string& name, const std::string& name,
const ServiceRequestHandler& handler) override; const ServiceRequestHandler& handler) override;
...@@ -56,7 +56,7 @@ class CONTENT_EXPORT ServiceManagerConnectionImpl ...@@ -56,7 +56,7 @@ class CONTENT_EXPORT ServiceManagerConnectionImpl
std::unique_ptr<service_manager::Connector> connector_; std::unique_ptr<service_manager::Connector> connector_;
scoped_refptr<IOThreadContext> context_; scoped_refptr<IOThreadContext> context_;
base::Closure connection_lost_handler_; base::OnceClosure connection_lost_handler_;
base::WeakPtrFactory<ServiceManagerConnectionImpl> weak_factory_{this}; base::WeakPtrFactory<ServiceManagerConnectionImpl> weak_factory_{this};
......
...@@ -83,7 +83,7 @@ class CONTENT_EXPORT ServiceManagerConnection { ...@@ -83,7 +83,7 @@ class CONTENT_EXPORT ServiceManagerConnection {
// Sets a closure that is called when the connection is lost. Note that // 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 // connection may already have been closed, in which case |closure| will be
// run immediately before returning from this function. // 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 // Adds a generic ServiceRequestHandler for a given service name. This
// will be used to satisfy any incoming calls to CreateService() which // 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