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

Unified Diff: device/bluetooth/bluetooth_low_energy_device_mac.mm

Issue 1964123002: Finishing: https://codereview.chromium.org/1948763003 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updating comment Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_low_energy_device_mac.mm
diff --git a/device/bluetooth/bluetooth_low_energy_device_mac.mm b/device/bluetooth/bluetooth_low_energy_device_mac.mm
index 0573c2fc11b8cb11d9e70db97c3c4e87b78518d8..dc36c2f382b28b651905db8d4cdbfd3493e8f6f7 100644
--- a/device/bluetooth/bluetooth_low_energy_device_mac.mm
+++ b/device/bluetooth/bluetooth_low_energy_device_mac.mm
@@ -322,15 +322,11 @@ BluetoothLowEnergyDeviceMac::GetBluetoothRemoteGattService(
void BluetoothLowEnergyDeviceMac::DidDisconnectPeripheral(
BluetoothDevice::ConnectErrorCode error_code) {
SetGattServicesDiscoveryComplete(false);
- // Explicitly take and erase GATT services one by one to ensure that calling
- // GetGattService on removed service in GattServiceRemoved returns null.
- std::vector<std::string> service_keys;
- for (const auto& gatt_service : gatt_services_) {
- service_keys.push_back(gatt_service.first);
- }
- for (const auto& key : service_keys) {
- gatt_services_.take_and_erase(key);
- }
+ // Removing all services at once to ensure that calling GetGattService on
+ // removed service in GattServiceRemoved returns null.
+ GattServiceMap gatt_services_swapped;
+ gatt_services_swapped.swap(gatt_services_);
+ gatt_services_swapped.clear();
if (create_gatt_connection_error_callbacks_.empty()) {
// TODO(http://crbug.com/585897): Need to pass the error.
DidDisconnectGatt();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698