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

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

Issue 2906923002: bluetooth: macOS: Remove c-style casting (Closed)
Patch Set: Merge from top of tree 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_characteristic_mac.h" 5 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 CBCharacteristic* cb_characteristic) 71 CBCharacteristic* cb_characteristic)
72 : is_discovery_complete_(false), 72 : is_discovery_complete_(false),
73 discovery_pending_count_(0), 73 discovery_pending_count_(0),
74 gatt_service_(gatt_service), 74 gatt_service_(gatt_service),
75 cb_characteristic_(cb_characteristic, base::scoped_policy::RETAIN), 75 cb_characteristic_(cb_characteristic, base::scoped_policy::RETAIN),
76 weak_ptr_factory_(this) { 76 weak_ptr_factory_(this) {
77 uuid_ = BluetoothAdapterMac::BluetoothUUIDWithCBUUID( 77 uuid_ = BluetoothAdapterMac::BluetoothUUIDWithCBUUID(
78 [cb_characteristic_.get() UUID]); 78 [cb_characteristic_.get() UUID]);
79 identifier_ = base::SysNSStringToUTF8( 79 identifier_ = base::SysNSStringToUTF8(
80 [NSString stringWithFormat:@"%s-%p", uuid_.canonical_value().c_str(), 80 [NSString stringWithFormat:@"%s-%p", uuid_.canonical_value().c_str(),
81 (void*)cb_characteristic_]); 81 cb_characteristic_.get()]);
82 } 82 }
83 83
84 BluetoothRemoteGattCharacteristicMac::~BluetoothRemoteGattCharacteristicMac() { 84 BluetoothRemoteGattCharacteristicMac::~BluetoothRemoteGattCharacteristicMac() {
85 if (HasPendingRead()) { 85 if (HasPendingRead()) {
86 std::pair<ValueCallback, ErrorCallback> callbacks; 86 std::pair<ValueCallback, ErrorCallback> callbacks;
87 callbacks.swap(read_characteristic_value_callbacks_); 87 callbacks.swap(read_characteristic_value_callbacks_);
88 callbacks.second.Run(BluetoothGattService::GATT_ERROR_FAILED); 88 callbacks.second.Run(BluetoothGattService::GATT_ERROR_FAILED);
89 } 89 }
90 if (HasPendingWrite()) { 90 if (HasPendingWrite()) {
91 std::pair<base::Closure, ErrorCallback> callbacks; 91 std::pair<base::Closure, ErrorCallback> callbacks;
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 const BluetoothRemoteGattServiceMac* service_mac = 467 const BluetoothRemoteGattServiceMac* service_mac =
468 static_cast<const BluetoothRemoteGattServiceMac*>( 468 static_cast<const BluetoothRemoteGattServiceMac*>(
469 characteristic.GetService()); 469 characteristic.GetService());
470 return out << "<BluetoothRemoteGattCharacteristicMac " 470 return out << "<BluetoothRemoteGattCharacteristicMac "
471 << characteristic.GetUUID().canonical_value() << "/" 471 << characteristic.GetUUID().canonical_value() << "/"
472 << &characteristic 472 << &characteristic
473 << ", service: " << service_mac->GetUUID().canonical_value() << "/" 473 << ", service: " << service_mac->GetUUID().canonical_value() << "/"
474 << service_mac << ">"; 474 << service_mac << ">";
475 } 475 }
476 } // namespace device. 476 } // namespace device.
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_adapter_mac_unittest.mm ('k') | device/bluetooth/bluetooth_remote_gatt_descriptor_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698