Chromium Code Reviews| Index: device/bluetooth/bluetooth_adapter_mac.mm |
| diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm |
| index e9586ad42068d7a2bb0fb495fe32b6ce0738aaf3..0dfb7991ca4587d78faca8c4378900d86dbc08a7 100644 |
| --- a/device/bluetooth/bluetooth_adapter_mac.mm |
| +++ b/device/bluetooth/bluetooth_adapter_mac.mm |
| @@ -31,14 +31,13 @@ namespace { |
| // The frequency with which to poll the adapter for updates. |
| const int kPollIntervalMs = 500; |
| -// The length of time that must elapse since the last Inquiry response before a |
| -// discovered Classic device is considered to be no longer available. |
| -const NSTimeInterval kDiscoveryTimeoutSec = 3 * 60; // 3 minutes |
| - |
| } // namespace |
| namespace device { |
| +const NSTimeInterval BluetoothAdapterMac::kDiscoveryTimeoutSec = |
| + 3 * 60; // 3 minutes |
|
armansito
2015/07/07 19:07:21
s/3 * 60/180/
What you have isn't any more readab
krstnmnlsn
2015/07/07 21:58:01
Sure.
|
| + |
| // static |
| base::WeakPtr<BluetoothAdapter> BluetoothAdapter::CreateAdapter( |
| const InitCallback& init_callback) { |
| @@ -296,7 +295,6 @@ void BluetoothAdapterMac::Init() { |
| void BluetoothAdapterMac::InitForTest( |
| scoped_refptr<base::SequencedTaskRunner> ui_task_runner) { |
| ui_task_runner_ = ui_task_runner; |
| - PollAdapter(); |
| } |
| void BluetoothAdapterMac::PollAdapter() { |
| @@ -359,8 +357,15 @@ void BluetoothAdapterMac::PollAdapter() { |
| // is fixed. |
| tracked_objects::ScopedTracker tracking_profile5( |
| FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| - "461181 BluetoothAdapterMac::PollAdapter::UpdateDevices")); |
| - UpdateDevices(); |
| + "461181 BluetoothAdapterMac::PollAdapter::RemoveTimedOutDevices")); |
| + RemoveTimedOutDevices(); |
| + |
| + // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/461181 |
|
armansito
2015/07/07 19:07:21
Is this bug still valid? Are your changes somehow
krstnmnlsn
2015/07/07 21:58:01
Yep this is a separate issue. Each method call he
|
| + // is fixed. |
| + tracked_objects::ScopedTracker tracking_profile6( |
| + FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| + "461181 BluetoothAdapterMac::PollAdapter::AddPairedDevices")); |
| + AddPairedDevices(); |
| ui_task_runner_->PostDelayedTask( |
| FROM_HERE, |
| @@ -383,15 +388,14 @@ void BluetoothAdapterMac::ClassicDeviceAdded(IOBluetoothDevice* device) { |
| DeviceAdded(this, devices_[device_address])); |
| } |
| -// TODO(krstnmnlsn): This method to be implemented as soon as UpdateDevices can |
| -// handle instances of LowEnergyBluetoothDevice in |devices_|. crbug.com/498009 |
| +// TODO(krstnmnlsn): Implement method. http://crbug.com/496987. |
| void BluetoothAdapterMac::LowEnergyDeviceUpdated( |
| CBPeripheral* peripheral, |
| NSDictionary* advertisementData, |
| int rssi) { |
| } |
| -void BluetoothAdapterMac::UpdateDevices() { |
| +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. |
| @@ -417,7 +421,9 @@ void BluetoothAdapterMac::UpdateDevices() { |
| 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]) { |
| ClassicDeviceAdded(device); |