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

Unified Diff: device/bluetooth/bluetooth_classic_device_mac.mm

Issue 2282763004: bluetooth: mac: Improve classic device discovery and update (Closed)
Patch Set: Store a TimeDelta instead of int Created 4 years, 3 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_classic_device_mac.mm
diff --git a/device/bluetooth/bluetooth_classic_device_mac.mm b/device/bluetooth/bluetooth_classic_device_mac.mm
index cc2fafb6e2632aa9bb6e1fdce078457a7a287035..f677f11fe4e8eeadac5322910244e67cd73c3e1c 100644
--- a/device/bluetooth/bluetooth_classic_device_mac.mm
+++ b/device/bluetooth/bluetooth_classic_device_mac.mm
@@ -62,7 +62,9 @@ BluetoothUUID ExtractUuid(IOBluetoothSDPDataElement* service_class_data) {
BluetoothClassicDeviceMac::BluetoothClassicDeviceMac(
BluetoothAdapterMac* adapter,
IOBluetoothDevice* device)
- : BluetoothDeviceMac(adapter), device_([device retain]) {}
+ : BluetoothDeviceMac(adapter), device_([device retain]) {
+ UpdateTimestamp();
+}
BluetoothClassicDeviceMac::~BluetoothClassicDeviceMac() {
}
@@ -255,8 +257,14 @@ void BluetoothClassicDeviceMac::CreateGattConnection(
}
base::Time BluetoothClassicDeviceMac::GetLastUpdateTime() const {
- return base::Time::FromDoubleT(
- [[device_ getLastInquiryUpdate] timeIntervalSince1970]);
+ // Even when a device is discovered during an inquiry procedure this returns
Jeffrey Yasskin 2016/09/14 20:35:57 "Even when a device is discovered during an inquir
ortuno 2016/09/20 04:31:33 I've actually never seen this function return a no
Jeffrey Yasskin 2016/09/23 22:25:21 Removing the use sounds reasonable if you've never
ortuno 2016/09/26 08:45:28 Done.
+ // nil so we implement out own last_update_time_ which gets updated whenever
+ // the device is found.
+ NSDate* inquiry_update = [device_ getLastInquiryUpdate];
+ if (inquiry_update != nil) {
+ return base::Time::FromDoubleT([inquiry_update timeIntervalSince1970]);
Jeffrey Yasskin 2016/09/14 20:35:57 Should you update the last_update_time_ in this ca
ortuno 2016/09/20 04:31:33 See comment above. I think we should just remove t
+ }
+ return last_update_time_;
}
int BluetoothClassicDeviceMac::GetHostTransmitPower(

Powered by Google App Engine
This is Rietveld 408576698