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

Side by Side Diff: device/bluetooth/bluetooth_low_energy_device_mac.mm

Issue 2235313004: Revert of Bluetooth: mac: Crash while loging nil error. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « device/bluetooth/bluetooth_low_energy_device_mac.h ('k') | 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 it != gatt_services_.end(); ++it) { 383 it != gatt_services_.end(); ++it) {
384 device::BluetoothRemoteGattService* gatt_service = it->second; 384 device::BluetoothRemoteGattService* gatt_service = it->second;
385 device::BluetoothRemoteGattServiceMac* gatt_service_mac = 385 device::BluetoothRemoteGattServiceMac* gatt_service_mac =
386 static_cast<BluetoothRemoteGattServiceMac*>(gatt_service); 386 static_cast<BluetoothRemoteGattServiceMac*>(gatt_service);
387 if (gatt_service_mac->GetService() == cb_service) 387 if (gatt_service_mac->GetService() == cb_service)
388 return gatt_service_mac; 388 return gatt_service_mac;
389 } 389 }
390 return nullptr; 390 return nullptr;
391 } 391 }
392 392
393 void BluetoothLowEnergyDeviceMac::DidDisconnectPeripheral() { 393 void BluetoothLowEnergyDeviceMac::DidDisconnectPeripheral(
394 BluetoothDevice::ConnectErrorCode error_code) {
394 SetGattServicesDiscoveryComplete(false); 395 SetGattServicesDiscoveryComplete(false);
395 // Removing all services at once to ensure that calling GetGattService on 396 // Removing all services at once to ensure that calling GetGattService on
396 // removed service in GattServiceRemoved returns null. 397 // removed service in GattServiceRemoved returns null.
397 GattServiceMap gatt_services_swapped; 398 GattServiceMap gatt_services_swapped;
398 gatt_services_swapped.swap(gatt_services_); 399 gatt_services_swapped.swap(gatt_services_);
399 gatt_services_swapped.clear(); 400 gatt_services_swapped.clear();
400 DCHECK(create_gatt_connection_error_callbacks_.empty()); 401 if (create_gatt_connection_error_callbacks_.empty()) {
401 DidDisconnectGatt(); 402 // TODO(http://crbug.com/585897): Need to pass the error.
403 DidDisconnectGatt();
404 } else {
405 DidFailToConnectGatt(error_code);
406 }
402 } 407 }
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_low_energy_device_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698