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

Side by Side Diff: device/bluetooth/bluetooth_low_energy_discovery_manager_mac.h

Issue 1228863002: Runtime checks so that CoreBluetooth only used on >= 10.10 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@timeinfo
Patch Set: CHECK->DCHECK Created 5 years, 5 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 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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DISCOVERY_MANAGER_MAC_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DISCOVERY_MANAGER_MAC_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DISCOVERY_MANAGER_MAC_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DISCOVERY_MANAGER_MAC_H_
7 7
8 #if defined(OS_IOS) 8 #if defined(OS_IOS)
9 #import <CoreBluetooth/CoreBluetooth.h> 9 #import <CoreBluetooth/CoreBluetooth.h>
10 #else 10 #else
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // CoreBluetooth is available. 74 // CoreBluetooth is available.
75 virtual void SetManagerForTesting(CBCentralManager* manager); 75 virtual void SetManagerForTesting(CBCentralManager* manager);
76 76
77 friend class BluetoothLowEnergyDiscoveryManagerMacDelegate; 77 friend class BluetoothLowEnergyDiscoveryManagerMacDelegate;
78 friend class BluetoothAdapterMacTest; 78 friend class BluetoothAdapterMacTest;
79 79
80 // Observer interested in notifications from us. 80 // Observer interested in notifications from us.
81 Observer* observer_; 81 Observer* observer_;
82 82
83 // Underlying CoreBluetooth central manager. 83 // Underlying CoreBluetooth central manager.
84 //
85 // Note: Intentionally leaked. Deallocating CBCentralManager
86 // results in a crash, at least when running OSX 10.9.5 on a
87 // mac_chromuim_rel_ng trybot. On the other hand, restricting |manager_| use
88 // to 10.10 and later would mean the code is unrun and untested by the current
89 // trybots. To work around this we call retain on |manager_| after allocation,
90 // so that the object is leaked.
91 base::scoped_nsobject<CBCentralManager> manager_; 84 base::scoped_nsobject<CBCentralManager> manager_;
92 85
93 // Discovery has been initiated by calling the API StartDiscovery(). 86 // Discovery has been initiated by calling the API StartDiscovery().
94 bool discovering_; 87 bool discovering_;
95 88
96 // A discovery has been initiated but has not started yet because it's 89 // A discovery has been initiated but has not started yet because it's
97 // waiting for Bluetooth to turn on. 90 // waiting for Bluetooth to turn on.
98 bool pending_; 91 bool pending_;
99 92
100 // Delegate of the central manager. 93 // Delegate of the central manager.
101 base::scoped_nsobject<BluetoothLowEnergyDiscoveryManagerMacBridge> bridge_; 94 base::scoped_nsobject<BluetoothLowEnergyDiscoveryManagerMacBridge> bridge_;
102 95
103 // List of service UUIDs to scan. 96 // List of service UUIDs to scan.
104 BluetoothDevice::UUIDList services_uuids_; 97 BluetoothDevice::UUIDList services_uuids_;
105 98
106 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDiscoveryManagerMac); 99 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDiscoveryManagerMac);
107 }; 100 };
108 101
109 } // namespace device 102 } // namespace device
110 103
111 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DISCOVERY_MANAGER_MAC_H_ 104 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DISCOVERY_MANAGER_MAC_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_low_energy_device_mac.mm ('k') | device/bluetooth/bluetooth_low_energy_discovery_manager_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698