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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/bluetooth_low_energy_device_mac.h" 5 #include "device/bluetooth/bluetooth_low_energy_device_mac.h"
6 6
7 #import <CoreFoundation/CoreFoundation.h> 7 #import <CoreFoundation/CoreFoundation.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 static_cast<BluetoothRemoteGattServiceMac*>(gatt_service); 315 static_cast<BluetoothRemoteGattServiceMac*>(gatt_service);
316 if (gatt_service_mac->GetService() == cb_service) 316 if (gatt_service_mac->GetService() == cb_service)
317 return gatt_service_mac; 317 return gatt_service_mac;
318 } 318 }
319 return nullptr; 319 return nullptr;
320 } 320 }
321 321
322 void BluetoothLowEnergyDeviceMac::DidDisconnectPeripheral( 322 void BluetoothLowEnergyDeviceMac::DidDisconnectPeripheral(
323 BluetoothDevice::ConnectErrorCode error_code) { 323 BluetoothDevice::ConnectErrorCode error_code) {
324 SetGattServicesDiscoveryComplete(false); 324 SetGattServicesDiscoveryComplete(false);
325 // Explicitly take and erase GATT services one by one to ensure that calling 325 // Removing all services at once.
ortuno 2016/05/10 19:40:14 nit: Keep the part of the comment about GetGattSer
326 // GetGattService on removed service in GattServiceRemoved returns null. 326 GattServiceMap gatt_services_swapped;
327 std::vector<std::string> service_keys; 327 gatt_services_swapped.swap(gatt_services_);
328 for (const auto& gatt_service : gatt_services_) { 328 gatt_services_swapped.clear();
329 service_keys.push_back(gatt_service.first);
330 }
331 for (const auto& key : service_keys) {
332 gatt_services_.take_and_erase(key);
333 }
334 if (create_gatt_connection_error_callbacks_.empty()) { 329 if (create_gatt_connection_error_callbacks_.empty()) {
335 // TODO(http://crbug.com/585897): Need to pass the error. 330 // TODO(http://crbug.com/585897): Need to pass the error.
336 DidDisconnectGatt(); 331 DidDisconnectGatt();
337 } else { 332 } else {
338 DidFailToConnectGatt(error_code); 333 DidFailToConnectGatt(error_code);
339 } 334 }
340 } 335 }
OLDNEW
« 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