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

Unified Diff: device/bluetooth/bluetooth_adapter_mac.mm

Issue 2606823002: Remove base::ScopedPtrHashMap from device/. (Closed)
Patch Set: one last fix Created 4 years 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 10f763901184d4b89d06938545d72d305cd030cd..ce30081169a0f8a8368803983f9188ec91be55c9 100644
--- a/device/bluetooth/bluetooth_adapter_mac.mm
+++ b/device/bluetooth/bluetooth_adapter_mac.mm
@@ -502,7 +502,7 @@ void BluetoothAdapterMac::ClassicDeviceAdded(IOBluetoothDevice* device) {
}
device_classic = new BluetoothClassicDeviceMac(this, device);
- devices_.set(device_address, base::WrapUnique(device_classic));
+ devices_[device_address] = base::WrapUnique(device_classic);
VLOG(1) << "Adding new classic device: " << device_classic->GetAddress();
for (auto& observer : observers_)
@@ -566,7 +566,7 @@ void BluetoothAdapterMac::LowEnergyDeviceUpdated(
if (is_new_device) {
std::string device_address =
BluetoothLowEnergyDeviceMac::GetPeripheralHashAddress(peripheral);
- devices_.add(device_address, std::unique_ptr<BluetoothDevice>(device_mac));
+ devices_[device_address] = base::WrapUnique(device_mac);
for (auto& observer : observers_)
observer.DeviceAdded(this, device_mac);
} else {
@@ -620,8 +620,7 @@ BluetoothAdapterMac::RetrieveGattConnectedDevicesWithService(
device_mac = new BluetoothLowEnergyDeviceMac(this, peripheral);
std::string device_address =
BluetoothLowEnergyDeviceMac::GetPeripheralHashAddress(peripheral);
- devices_.add(device_address,
- std::unique_ptr<BluetoothDevice>(device_mac));
+ devices_[device_address] = base::WrapUnique(device_mac);
for (auto& observer : observers_) {
observer.DeviceAdded(this, device_mac);
}
@@ -694,11 +693,11 @@ BluetoothLowEnergyDeviceMac*
BluetoothAdapterMac::GetBluetoothLowEnergyDeviceMac(CBPeripheral* peripheral) {
std::string device_address =
BluetoothLowEnergyDeviceMac::GetPeripheralHashAddress(peripheral);
- DevicesMap::const_iterator iter = devices_.find(device_address);
+ auto iter = devices_.find(device_address);
if (iter == devices_.end()) {
return nil;
}
- return static_cast<BluetoothLowEnergyDeviceMac*>(iter->second);
+ return static_cast<BluetoothLowEnergyDeviceMac*>(iter->second.get());
}
bool BluetoothAdapterMac::DoesCollideWithKnownDevice(

Powered by Google App Engine
This is Rietveld 408576698