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

Unified Diff: device/bluetooth/test/mock_bluetooth_adapter.cc

Issue 2567903004: Replace ScopedVector/ScopedPtrHashMap with std::vector and std::unordered_map (Closed)
Patch Set: Mac bustage 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/test/mock_bluetooth_adapter.cc
diff --git a/device/bluetooth/test/mock_bluetooth_adapter.cc b/device/bluetooth/test/mock_bluetooth_adapter.cc
index 2667650f40bf97e3f6678254e9593f482b1f128c..cdc71350395aea57d2bea70848512695e920ba74 100644
--- a/device/bluetooth/test/mock_bluetooth_adapter.cc
+++ b/device/bluetooth/test/mock_bluetooth_adapter.cc
@@ -69,28 +69,28 @@ void MockBluetoothAdapter::AddMockDevice(
std::unique_ptr<MockBluetoothDevice> MockBluetoothAdapter::RemoveMockDevice(
const std::string& address) {
for (auto it = mock_devices_.begin(); it != mock_devices_.end(); ++it) {
- if ((*it)->GetAddress() != address) {
+ if ((*it)->GetAddress() != address)
continue;
- }
- std::unique_ptr<MockBluetoothDevice> removed_device(*it);
- mock_devices_.weak_erase(it);
- return removed_device;
+
+ auto result = std::move(*it);
+ mock_devices_.erase(it);
+ return result;
}
return nullptr;
}
BluetoothAdapter::ConstDeviceList MockBluetoothAdapter::GetConstMockDevices() {
BluetoothAdapter::ConstDeviceList devices;
- for (auto* it : mock_devices_) {
- devices.push_back(it);
+ for (auto& device : mock_devices_) {
+ devices.push_back(device.get());
}
return devices;
}
BluetoothAdapter::DeviceList MockBluetoothAdapter::GetMockDevices() {
BluetoothAdapter::DeviceList devices;
- for (auto* it : mock_devices_) {
- devices.push_back(it);
+ for (auto& device : mock_devices_) {
+ devices.push_back(device.get());
}
return devices;
}

Powered by Google App Engine
This is Rietveld 408576698