Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: device/bluetooth/bluetooth_adapter_mac.mm

Issue 1842223003: Remove outdated devices from Android device chooser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't purge devices continuously. Added more tests. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_adapter_mac.mm
diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
index d3475d435b5b7748bba84673b0b5c90782869f9b..f24fb7c690de80297b69de0186dcea9be70e944d 100644
--- a/device/bluetooth/bluetooth_adapter_mac.mm
+++ b/device/bluetooth/bluetooth_adapter_mac.mm
@@ -40,10 +40,6 @@ const int kPollIntervalMs = 500;
namespace device {
// static
-const NSTimeInterval BluetoothAdapterMac::kDiscoveryTimeoutSec =
- 180; // 3 minutes
-
-// static
base::WeakPtr<BluetoothAdapter> BluetoothAdapter::CreateAdapter(
const InitCallback& init_callback) {
return BluetoothAdapterMac::CreateAdapter();
@@ -528,34 +524,6 @@ void BluetoothAdapterMac::LowEnergyDeviceUpdated(
// TODO(krstnmnlsn): Implement. crbug.com/511025
void BluetoothAdapterMac::LowEnergyCentralManagerUpdatedState() {}
-void BluetoothAdapterMac::RemoveTimedOutDevices() {
- // Notify observers if any previously seen devices are no longer available,
- // i.e. if they are no longer paired, connected, nor recently discovered via
- // an inquiry.
- std::set<std::string> removed_devices;
- for (DevicesMap::const_iterator it = devices_.begin(); it != devices_.end();
- ++it) {
- BluetoothDevice* device = it->second;
- if (device->IsPaired() || device->IsConnected())
- continue;
-
- NSDate* last_update_time =
- static_cast<BluetoothDeviceMac*>(device)->GetLastUpdateTime();
- if (last_update_time &&
- -[last_update_time timeIntervalSinceNow] < kDiscoveryTimeoutSec)
- continue;
-
- FOR_EACH_OBSERVER(
- BluetoothAdapter::Observer, observers_, DeviceRemoved(this, device));
- removed_devices.insert(it->first);
- // The device will be erased from the map in the loop immediately below.
- }
- for (const std::string& device_address : removed_devices) {
- size_t num_removed = devices_.erase(device_address);
- DCHECK_EQ(num_removed, 1U);
- }
-}
-
void BluetoothAdapterMac::AddPairedDevices() {
// Add any new paired devices.
for (IOBluetoothDevice* device in [IOBluetoothDevice pairedDevices]) {

Powered by Google App Engine
This is Rietveld 408576698