Commit 9b60b5b5 authored by Reilly Grant's avatar Reilly Grant Committed by Chromium LUCI CQ

Convert callbacks in //chrome/browser/chromeos/tether

This change converts callbacks from base::Bind and base::Callback to
Once/Repeating in //chrome/browser/chromeos/tether.

Bug: 1148570
Change-Id: Ic3b780c5714af71aae25691f77aad3fb69f5986d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2638571
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Commit-Queue: Ryan Hansberry <hansberry@chromium.org>
Auto-Submit: Reilly Grant <reillyg@chromium.org>
Reviewed-by: default avatarRyan Hansberry <hansberry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#844995}
parent 03514c1d
......@@ -460,10 +460,10 @@ void TetherService::GetBluetoothAdapter() {
// constructed yet. Post the GetAdapter call to avoid this.
auto* factory = device::BluetoothAdapterFactory::Get();
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&device::BluetoothAdapterFactory::GetAdapter,
base::Unretained(factory),
base::BindRepeating(
&TetherService::OnBluetoothAdapterFetched,
FROM_HERE,
base::BindOnce(&device::BluetoothAdapterFactory::GetAdapter,
base::Unretained(factory),
base::BindOnce(&TetherService::OnBluetoothAdapterFetched,
weak_ptr_factory_.GetWeakPtr())));
}
......
......@@ -124,16 +124,16 @@ class FakeTetherComponentWithDestructorCallback
: public chromeos::tether::FakeTetherComponent {
public:
FakeTetherComponentWithDestructorCallback(
const base::Closure& destructor_callback)
: FakeTetherComponent(false /* has_asynchronous_shutdown */),
destructor_callback_(destructor_callback) {}
base::OnceClosure destructor_callback)
: FakeTetherComponent(/*has_asynchronous_shutdown=*/false),
destructor_callback_(std::move(destructor_callback)) {}
~FakeTetherComponentWithDestructorCallback() override {
destructor_callback_.Run();
std::move(destructor_callback_).Run();
}
private:
base::Closure destructor_callback_;
base::OnceClosure destructor_callback_;
};
class TestTetherComponentFactory final
......@@ -163,9 +163,10 @@ class TestTetherComponentFactory final
chromeos::NetworkConnectionHandler* network_connection_handler,
scoped_refptr<device::BluetoothAdapter> adapter,
session_manager::SessionManager* session_manager) override {
active_tether_component_ = new FakeTetherComponentWithDestructorCallback(
base::Bind(&TestTetherComponentFactory::OnActiveTetherComponentDeleted,
base::Unretained(this)));
active_tether_component_ =
new FakeTetherComponentWithDestructorCallback(base::BindOnce(
&TestTetherComponentFactory::OnActiveTetherComponentDeleted,
base::Unretained(this)));
was_tether_component_active_ = true;
return base::WrapUnique(active_tether_component_);
}
......
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