| Index: device/bluetooth/bluetooth_adapter.cc
|
| diff --git a/device/bluetooth/bluetooth_adapter.cc b/device/bluetooth/bluetooth_adapter.cc
|
| index 382928e264429d59a25a932508c8b19c03a73b7c..ce2556dee06b72b4fefe6dd1ac9300b789234cc6 100644
|
| --- a/device/bluetooth/bluetooth_adapter.cc
|
| +++ b/device/bluetooth/bluetooth_adapter.cc
|
| @@ -110,10 +110,8 @@ BluetoothAdapter::DeviceList BluetoothAdapter::GetDevices() {
|
|
|
| BluetoothAdapter::ConstDeviceList BluetoothAdapter::GetDevices() const {
|
| ConstDeviceList devices;
|
| - for (DevicesMap::const_iterator iter = devices_.begin();
|
| - iter != devices_.end();
|
| - ++iter)
|
| - devices.push_back(iter->second);
|
| + for (auto& device : devices_)
|
| + devices.push_back(device.second.get());
|
|
|
| return devices;
|
| }
|
| @@ -132,7 +130,7 @@ const BluetoothDevice* BluetoothAdapter::GetDevice(
|
|
|
| DevicesMap::const_iterator iter = devices_.find(canonicalized_address);
|
| if (iter != devices_.end())
|
| - return iter->second;
|
| + return iter->second.get();
|
|
|
| return nullptr;
|
| }
|
| @@ -377,7 +375,7 @@ BluetoothAdapter::GetMergedDiscoveryFilterHelper(
|
|
|
| void BluetoothAdapter::RemoveTimedOutDevices() {
|
| for (DevicesMap::iterator it = devices_.begin(); it != devices_.end();) {
|
| - BluetoothDevice* device = it->second;
|
| + BluetoothDevice* device = it->second.get();
|
| if (device->IsPaired() || device->IsConnected() ||
|
| device->IsGattConnected()) {
|
| ++it;
|
| @@ -400,8 +398,8 @@ void BluetoothAdapter::RemoveTimedOutDevices() {
|
| VLOG(1) << "Removing device: " << device->GetAddress();
|
| DevicesMap::iterator next = it;
|
| next++;
|
| - std::unique_ptr<BluetoothDevice> removed_device =
|
| - devices_.take_and_erase(it);
|
| + std::unique_ptr<BluetoothDevice> removed_device = std::move(it->second);
|
| + devices_.erase(it);
|
| it = next;
|
|
|
| for (auto& observer : observers_)
|
|
|