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

Unified Diff: device/bluetooth/bluetooth_low_energy_discovery_manager_mac.h

Issue 1165053003: Adding support for Low Energy device discovery to BluetoothAdapterMac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment nit on SetManagerForTesting. Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_low_energy_discovery_manager_mac.h
diff --git a/device/bluetooth/bluetooth_low_energy_discovery_manager_mac.h b/device/bluetooth/bluetooth_low_energy_discovery_manager_mac.h
index 29ad5297e623b95d13fa0fa50a994d372715517c..e714edf32c82cada2e70ef822335b80f63144e6d 100644
--- a/device/bluetooth/bluetooth_low_energy_discovery_manager_mac.h
+++ b/device/bluetooth/bluetooth_low_energy_discovery_manager_mac.h
@@ -28,11 +28,10 @@ class BluetoothLowEnergyDiscoveryManagerMac {
// Interface for being notified of events during a device discovery session.
class Observer {
public:
- // Called when |this| manager has found a device.
- virtual void DeviceFound(BluetoothLowEnergyDeviceMac* device) = 0;
-
- // Called when |this| manager has updated on a device.
- virtual void DeviceUpdated(BluetoothLowEnergyDeviceMac* device) = 0;
+ // Called when |this| manager has found a device or an update on a device.
+ virtual void LowEnergyDeviceUpdated(CBPeripheral* peripheral,
+ NSDictionary* advertisementData,
+ int rssi) = 0;
protected:
virtual ~Observer() {}
@@ -69,14 +68,24 @@ class BluetoothLowEnergyDiscoveryManagerMac {
private:
explicit BluetoothLowEnergyDiscoveryManagerMac(Observer* observer);
- void ClearDevices();
+
+ // Private method for testing. Resets |manager_| to |manager| and set
+ // |bridge_| as its delegate. Only for use on OSX 10.7 or later, where
+ // CoreBluetooth is available.
+ virtual void SetManagerForTesting(CBCentralManager* manager);
friend class BluetoothLowEnergyDiscoveryManagerMacDelegate;
+ friend class BluetoothAdapterMacTest;
// Observer interested in notifications from us.
Observer* observer_;
- // Underlaying CoreBluetooth central manager.
+ // Underlying CoreBluetooth central manager. Deallocating CBCentralManager
scheib 2015/06/24 23:24:24 // Underlying CoreBluetooth central manager. //
krstnmnlsn 2015/06/24 23:42:26 Done.
+ // results in a crash, at least when running OSX 10.9.5 on a
+ // mac_chromuim_rel_ng trybot. On the other hand, restricting |manager_| use
+ // to 10.10 and later would mean the code is unrun and untested by the current
+ // trybots. To work around this we call retain on |manager_| after allocation,
+ // so that the object is leaked.
base::scoped_nsobject<CBCentralManager> manager_;
// Discovery has been initiated by calling the API StartDiscovery().
@@ -89,9 +98,6 @@ class BluetoothLowEnergyDiscoveryManagerMac {
// Delegate of the central manager.
base::scoped_nsobject<BluetoothLowEnergyDiscoveryManagerMacBridge> bridge_;
- // Map of the device identifiers to the discovered device.
- std::map<const std::string, BluetoothLowEnergyDeviceMac*> devices_;
-
// List of service UUIDs to scan.
BluetoothDevice::UUIDList services_uuids_;

Powered by Google App Engine
This is Rietveld 408576698