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

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

Issue 2906883004: bluetooth: macOS: Removing useless |.get()| (Closed)
Patch Set: Created 3 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_remote_gatt_service_mac.h" 5 #include "device/bluetooth/bluetooth_remote_gatt_service_mac.h"
6 6
7 #import <CoreBluetooth/CoreBluetooth.h> 7 #import <CoreBluetooth/CoreBluetooth.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "device/bluetooth/bluetooth_adapter_mac.h" 12 #include "device/bluetooth/bluetooth_adapter_mac.h"
13 #include "device/bluetooth/bluetooth_low_energy_device_mac.h" 13 #include "device/bluetooth/bluetooth_low_energy_device_mac.h"
14 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h" 14 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h"
15 #include "device/bluetooth/bluetooth_uuid.h" 15 #include "device/bluetooth/bluetooth_uuid.h"
16 16
17 namespace device { 17 namespace device {
18 18
19 BluetoothRemoteGattServiceMac::BluetoothRemoteGattServiceMac( 19 BluetoothRemoteGattServiceMac::BluetoothRemoteGattServiceMac(
20 BluetoothLowEnergyDeviceMac* bluetooth_device_mac, 20 BluetoothLowEnergyDeviceMac* bluetooth_device_mac,
21 CBService* service, 21 CBService* service,
22 bool is_primary) 22 bool is_primary)
23 : bluetooth_device_mac_(bluetooth_device_mac), 23 : bluetooth_device_mac_(bluetooth_device_mac),
24 service_(service, base::scoped_policy::RETAIN), 24 service_(service, base::scoped_policy::RETAIN),
25 is_primary_(is_primary), 25 is_primary_(is_primary),
26 is_discovery_complete_(false), 26 is_discovery_complete_(false),
27 discovery_pending_count_(0) { 27 discovery_pending_count_(0) {
28 uuid_ = BluetoothAdapterMac::BluetoothUUIDWithCBUUID([service_.get() UUID]); 28 uuid_ = BluetoothAdapterMac::BluetoothUUIDWithCBUUID([service_ UUID]);
29 identifier_ = 29 identifier_ =
30 [NSString stringWithFormat:@"%s-%p", uuid_.canonical_value().c_str(), 30 [NSString stringWithFormat:@"%s-%p", uuid_.canonical_value().c_str(),
31 (void*)service_] 31 (void*)service_]
32 .UTF8String; 32 .UTF8String;
33 } 33 }
34 34
35 BluetoothRemoteGattServiceMac::~BluetoothRemoteGattServiceMac() {} 35 BluetoothRemoteGattServiceMac::~BluetoothRemoteGattServiceMac() {}
36 36
37 std::string BluetoothRemoteGattServiceMac::GetIdentifier() const { 37 std::string BluetoothRemoteGattServiceMac::GetIdentifier() const {
38 return identifier_; 38 return identifier_;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 BluetoothAdapterMac* BluetoothRemoteGattServiceMac::GetMacAdapter() const { 208 BluetoothAdapterMac* BluetoothRemoteGattServiceMac::GetMacAdapter() const {
209 return bluetooth_device_mac_->GetMacAdapter(); 209 return bluetooth_device_mac_->GetMacAdapter();
210 } 210 }
211 211
212 CBPeripheral* BluetoothRemoteGattServiceMac::GetCBPeripheral() const { 212 CBPeripheral* BluetoothRemoteGattServiceMac::GetCBPeripheral() const {
213 return bluetooth_device_mac_->GetPeripheral(); 213 return bluetooth_device_mac_->GetPeripheral();
214 } 214 }
215 215
216 CBService* BluetoothRemoteGattServiceMac::GetService() const { 216 CBService* BluetoothRemoteGattServiceMac::GetService() const {
217 return service_.get(); 217 return service_;
218 } 218 }
219 219
220 BluetoothRemoteGattCharacteristicMac* 220 BluetoothRemoteGattCharacteristicMac*
221 BluetoothRemoteGattServiceMac::GetBluetoothRemoteGattCharacteristicMac( 221 BluetoothRemoteGattServiceMac::GetBluetoothRemoteGattCharacteristicMac(
222 CBCharacteristic* characteristic) const { 222 CBCharacteristic* characteristic) const {
223 auto found = std::find_if( 223 auto found = std::find_if(
224 gatt_characteristic_macs_.begin(), gatt_characteristic_macs_.end(), 224 gatt_characteristic_macs_.begin(), gatt_characteristic_macs_.end(),
225 [characteristic]( 225 [characteristic](
226 const std::pair< 226 const std::pair<
227 const std::string, 227 const std::string,
(...skipping 12 matching lines...) Expand all
240 const BluetoothRemoteGattServiceMac& service) { 240 const BluetoothRemoteGattServiceMac& service) {
241 const BluetoothLowEnergyDeviceMac* bluetooth_device_mac_ = 241 const BluetoothLowEnergyDeviceMac* bluetooth_device_mac_ =
242 static_cast<const BluetoothLowEnergyDeviceMac*>(service.GetDevice()); 242 static_cast<const BluetoothLowEnergyDeviceMac*>(service.GetDevice());
243 return out << "<BluetoothRemoteGattServiceMac " 243 return out << "<BluetoothRemoteGattServiceMac "
244 << service.GetUUID().canonical_value() << "/" << &service 244 << service.GetUUID().canonical_value() << "/" << &service
245 << ", device: " << bluetooth_device_mac_->GetAddress() << "/" 245 << ", device: " << bluetooth_device_mac_->GetAddress() << "/"
246 << bluetooth_device_mac_ << ">"; 246 << bluetooth_device_mac_ << ">";
247 } 247 }
248 248
249 } // namespace device 249 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698