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

Issue 2282763004: bluetooth: mac: Improve classic device discovery and update (Closed)

Created:
4 years, 3 months ago by ortuno
Modified:
4 years, 2 months ago
Reviewers:
Jeffrey Yasskin, scheib
CC:
chromium-reviews, jlebel, ortuno+watch_chromium.org, rkc, scheib+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

bluetooth: mac: Improve classic device discovery and update There are a couple of problems with the current implementation of classic device discovery: 1. IOBluetoothDeviceInquiry's cache is never cleaned which means that only the first discovery session will find the device. (Since the device is still in the cache future discovery session will not be notified of the device being found.) We could send notifications for all devices in the cache but then we could be notifying of devices that are no longer around. 2. IOBluetoothDevice getLastInquiryUpdate returns nil even for devices that have just been discovered during an inquiry procedure. This causes us to immediately remove a device that we just discovered. 3. IOBluetoothDevice pairedDevices sometimes returns devices that are not paired which causes us to add a non paired device. Solutions: 1. Clean cache every time StartDiscovery is called. This means new sessions will be notified of previously seen. Which allows us to implement the solution for 2. 2. Now that we notify whenever we see a device, we can update our cross platform last_update_time_. Then when we are removing outdated devices we can check last_update_time_ to see if the device should be removed. 3. Check [IOBluetoothDevice isPaired] before adding a device. Also changes some VLOG(1)s to VLOG(3) since they were spamming the logs. BUG=618650, 638715 Committed: https://crrev.com/154da849a1f7106c4efb3b514d88eac45a39afaa Cr-Commit-Position: refs/heads/master@{#421069}

Patch Set 1 #

Patch Set 2 : Clean up #

Total comments: 2

Patch Set 3 : Add comment and fix comment #

Total comments: 2

Patch Set 4 : Store a TimeDelta instead of int #

Total comments: 14

Patch Set 5 : Override getlastupdate and make constexpr #

Total comments: 4

Patch Set 6 : Remove timer #

Patch Set 7 : Clean up #

Patch Set 8 : Clean up #

Total comments: 2

Patch Set 9 : Address moar comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+42 lines, -17 lines) Patch
M device/bluetooth/bluetooth_adapter.cc View 3 chunks +5 lines, -3 lines 0 comments Download
M device/bluetooth/bluetooth_adapter_mac.mm View 1 2 3 4 5 6 7 8 2 chunks +14 lines, -3 lines 0 comments Download
M device/bluetooth/bluetooth_classic_device_mac.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M device/bluetooth/bluetooth_classic_device_mac.mm View 1 2 3 4 5 2 chunks +6 lines, -3 lines 0 comments Download
M device/bluetooth/bluetooth_device.h View 1 2 3 4 5 6 7 8 2 chunks +6 lines, -5 lines 0 comments Download
M device/bluetooth/bluetooth_device.cc View 1 2 3 4 1 chunk +4 lines, -0 lines 0 comments Download
M device/bluetooth/bluetooth_discovery_manager_mac.mm View 1 2 3 4 5 6 2 chunks +5 lines, -1 line 0 comments Download
M device/bluetooth/bluetooth_low_energy_discovery_manager_mac.mm View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 38 (22 generated)
ortuno
jyasskin: PTAL. This is my attempt to fix device discovery. I looked into writing tests ...
4 years, 3 months ago (2016-08-26 23:29:19 UTC) #4
scheib
LGTM https://codereview.chromium.org/2282763004/diff/20001/device/bluetooth/bluetooth_discovery_manager_mac.mm File device/bluetooth/bluetooth_discovery_manager_mac.mm (right): https://codereview.chromium.org/2282763004/diff/20001/device/bluetooth/bluetooth_discovery_manager_mac.mm#newcode37 device/bluetooth/bluetooth_discovery_manager_mac.mm:37: const int kCleanCacheTimer = 1; Comment explaining why ...
4 years, 3 months ago (2016-08-29 02:42:32 UTC) #10
scheib
cc jlebel
4 years, 3 months ago (2016-08-29 02:43:22 UTC) #12
ortuno
Thanks! https://codereview.chromium.org/2282763004/diff/20001/device/bluetooth/bluetooth_discovery_manager_mac.mm File device/bluetooth/bluetooth_discovery_manager_mac.mm (right): https://codereview.chromium.org/2282763004/diff/20001/device/bluetooth/bluetooth_discovery_manager_mac.mm#newcode37 device/bluetooth/bluetooth_discovery_manager_mac.mm:37: const int kCleanCacheTimer = 1; On 2016/08/29 at ...
4 years, 3 months ago (2016-09-13 08:02:04 UTC) #16
Jeffrey Yasskin
https://codereview.chromium.org/2282763004/diff/40001/device/bluetooth/bluetooth_discovery_manager_mac.mm File device/bluetooth/bluetooth_discovery_manager_mac.mm (right): https://codereview.chromium.org/2282763004/diff/40001/device/bluetooth/bluetooth_discovery_manager_mac.mm#newcode39 device/bluetooth/bluetooth_discovery_manager_mac.mm:39: const int kCleanCacheTimer = 1; I think you can ...
4 years, 3 months ago (2016-09-13 20:58:05 UTC) #19
ortuno
https://codereview.chromium.org/2282763004/diff/40001/device/bluetooth/bluetooth_discovery_manager_mac.mm File device/bluetooth/bluetooth_discovery_manager_mac.mm (right): https://codereview.chromium.org/2282763004/diff/40001/device/bluetooth/bluetooth_discovery_manager_mac.mm#newcode39 device/bluetooth/bluetooth_discovery_manager_mac.mm:39: const int kCleanCacheTimer = 1; On 2016/09/13 at 20:58:05, ...
4 years, 3 months ago (2016-09-14 04:48:25 UTC) #20
Jeffrey Yasskin
https://codereview.chromium.org/2282763004/diff/60001/device/bluetooth/bluetooth_adapter_mac.mm File device/bluetooth/bluetooth_adapter_mac.mm (right): https://codereview.chromium.org/2282763004/diff/60001/device/bluetooth/bluetooth_adapter_mac.mm#newcode577 device/bluetooth/bluetooth_adapter_mac.mm:577: if ([device isPaired]) { Could you comment why this ...
4 years, 3 months ago (2016-09-14 20:35:58 UTC) #21
ortuno
https://codereview.chromium.org/2282763004/diff/60001/device/bluetooth/bluetooth_adapter_mac.mm File device/bluetooth/bluetooth_adapter_mac.mm (right): https://codereview.chromium.org/2282763004/diff/60001/device/bluetooth/bluetooth_adapter_mac.mm#newcode577 device/bluetooth/bluetooth_adapter_mac.mm:577: if ([device isPaired]) { On 2016/09/14 at 20:35:57, Jeffrey ...
4 years, 3 months ago (2016-09-20 04:31:33 UTC) #22
ortuno
jyasskin: ping?
4 years, 3 months ago (2016-09-23 08:59:11 UTC) #23
Jeffrey Yasskin
https://codereview.chromium.org/2282763004/diff/60001/device/bluetooth/bluetooth_classic_device_mac.mm File device/bluetooth/bluetooth_classic_device_mac.mm (right): https://codereview.chromium.org/2282763004/diff/60001/device/bluetooth/bluetooth_classic_device_mac.mm#newcode260 device/bluetooth/bluetooth_classic_device_mac.mm:260: // Even when a device is discovered during an ...
4 years, 3 months ago (2016-09-23 22:25:22 UTC) #24
ortuno
https://codereview.chromium.org/2282763004/diff/60001/device/bluetooth/bluetooth_classic_device_mac.mm File device/bluetooth/bluetooth_classic_device_mac.mm (right): https://codereview.chromium.org/2282763004/diff/60001/device/bluetooth/bluetooth_classic_device_mac.mm#newcode260 device/bluetooth/bluetooth_classic_device_mac.mm:260: // Even when a device is discovered during an ...
4 years, 2 months ago (2016-09-26 08:45:29 UTC) #26
Jeffrey Yasskin
lgtm https://codereview.chromium.org/2282763004/diff/80001/device/bluetooth/bluetooth_device.h File device/bluetooth/bluetooth_device.h (right): https://codereview.chromium.org/2282763004/diff/80001/device/bluetooth/bluetooth_device.h#newcode519 device/bluetooth/bluetooth_device.h:519: // Return the timestamp for when this device ...
4 years, 2 months ago (2016-09-26 18:35:59 UTC) #31
ortuno
Thanks! https://codereview.chromium.org/2282763004/diff/80001/device/bluetooth/bluetooth_device.h File device/bluetooth/bluetooth_device.h (right): https://codereview.chromium.org/2282763004/diff/80001/device/bluetooth/bluetooth_device.h#newcode519 device/bluetooth/bluetooth_device.h:519: // Return the timestamp for when this device ...
4 years, 2 months ago (2016-09-26 23:58:18 UTC) #33
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2282763004/160001
4 years, 2 months ago (2016-09-26 23:59:08 UTC) #35
commit-bot: I haz the power
Committed patchset #9 (id:160001)
4 years, 2 months ago (2016-09-27 01:27:49 UTC) #36
commit-bot: I haz the power
4 years, 2 months ago (2016-09-27 01:29:35 UTC) #38
Message was sent while issue was closed.
Patchset 9 (id:??) landed as
https://crrev.com/154da849a1f7106c4efb3b514d88eac45a39afaa
Cr-Commit-Position: refs/heads/master@{#421069}

Powered by Google App Engine
This is Rietveld 408576698