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

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: Better 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..8b84c726670a8f2a9e1506024f57def370548caa 100644
--- a/device/bluetooth/bluetooth_low_energy_device_mac.mm
+++ b/device/bluetooth/bluetooth_low_energy_device_mac.mm
@@ -322,15 +322,10 @@ 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.
ortuno 2016/05/10 19:40:14 nit: Keep the part of the comment about GetGattSer
+ 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